/*============================================================================= This file is part of FLINT. FLINT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. FLINT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FLINT; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =============================================================================*/ /****************************************************************************** Copyright (C) 2010 Fredrik Johansson ******************************************************************************/ #include #include #include "flint.h" #include "arith.h" #include "ulong_extras.h" void check_value(slong n, char *ans) { fmpz_t x, y; fmpz_init(x); fmpz_init(y); fmpz_set_si(y, n); arith_ramanujan_tau(x, y); fmpz_set_str(y, ans, 10); if (!fmpz_equal(x,y)) { flint_printf("FAIL:\n"); flint_printf("tau(%wd) gave ", n); fmpz_print(x); flint_printf(", expected %s\n", ans); abort(); } fmpz_clear(x); fmpz_clear(y); } void consistency_check(slong n) { fmpz_poly_t p; fmpz_t x, y; slong k; fmpz_poly_init(p); fmpz_init(x); fmpz_init(y); arith_ramanujan_tau_series(p, n); if (p->length != n && !(n == 1 && p->length == 0)) { flint_printf("FAIL:\n"); flint_printf("wrong length of polynomial %wd\n", n); abort(); } for (k=0; k