/* Returns data $N_1 = N_0 + r + s$ such that, in order to determine the coefficients of the characteristic polynomial of $p^{-1} F_p$ to $p$-adic precision $N_0$ it suffices to compute the matrix to precision $N_1$. When $X$ is a smooth projective surface and $p > 2$, we can do better by instead computing $q^{h_{0,2}} f(T/q)$, in which case the extraction of the polynomial requires an extra $a$ digits of precision. */ static __inline__ long _frobq(long *r, long *s, const fmpz_t p, long a, long n, long d, long N0) { if (n == 3 && fmpz_cmp_ui(p, 2) != 0) { *r = 0; *s = 0; return N0 + a; } else { *r = padic_val_fac_ui(n - 1, p); *s = (n + 1) * n_flog(n - 1, *p); return N0 + *r + *s; } }
int main(void) { int i, result; FLINT_TEST_INIT(state); flint_printf("flog...."); fflush(stdout); for (i = 0; i < 10000 * flint_test_multiplier(); i++) { mp_limb_t a = 0, b = 0, k, x; while (a < 1) a = n_randtest(state); while (b < 2) b = n_randtest(state); k = n_flog(a, b); x = n_pow(b, k); result = (x <= a && a / b < x); if (!result) { flint_printf("FAIL:\n"); flint_printf("a = %wu\n", a); flint_printf("b = %wu\n", b); flint_printf("x = %wu\n", x); flint_printf("k = %wu\n", k); } } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return EXIT_SUCCESS; }