Skip to content

Commit

Permalink
Include standard headers instead of using builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed Jan 27, 2025
1 parent 66ec320 commit 9550096
Show file tree
Hide file tree
Showing 136 changed files with 134 additions and 918 deletions.
12 changes: 1 addition & 11 deletions src/acb/lambertw.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"

#ifdef __GNUC__
# define atan2 __builtin_atan2
# define cos __builtin_cos
# define fabs __builtin_fabs
# define log __builtin_log
# define pow __builtin_pow
# define sin __builtin_sin
#else
# include <math.h>
#endif

/* Check if z crosses a branch cut. */
int
acb_lambertw_branch_crossing(const acb_t z, const acb_t ez1, const fmpz_t k)
Expand Down
7 changes: 1 addition & 6 deletions src/acb/test/t-agm1.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

#define EPS 1e-13
#define NUM_DERIVS 4
#define NUM_TESTS 11
Expand Down
7 changes: 1 addition & 6 deletions src/acb_calc/integrate_taylor.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb_poly.h"
#include "arb_calc.h"
#include "acb_calc.h"

#ifdef __GNUC__
# define log __builtin_log
#else
# include <math.h>
#endif

int
acb_calc_integrate_taylor(acb_t res,
acb_calc_func_t func, void * param,
Expand Down
8 changes: 1 addition & 7 deletions src/acb_dirichlet/euler_product_real_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "thread_pool.h"
#include "thread_support.h"
#include "arb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
# define sqrt __builtin_sqrt
#else
# include <math.h>
#endif

#define ONE_OVER_LOG2 1.4426950408889634

typedef struct
Expand Down
9 changes: 1 addition & 8 deletions src/acb_dirichlet/hurwitz_precomp_choose_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
# define log __builtin_log
# define sqrt __builtin_sqrt
#else
# include <math.h>
#endif

void
acb_dirichlet_hurwitz_precomp_choose_param(ulong * _A, ulong *_K, ulong *_N,
const acb_t s, double num_eval, slong prec)
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/l.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
#else
# include <math.h>
#endif

void
acb_dirichlet_l_general(acb_t res, const acb_t s,
const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
Expand Down
9 changes: 1 addition & 8 deletions src/acb_dirichlet/l_euler_product.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
# define pow __builtin_pow
# define sqrt __builtin_sqrt
#else
# include <math.h>
#endif

#define ONE_OVER_LOG2 1.4426950408889634

void
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/l_fmpq.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "fmpq.h"
#include "arb_mat.h"
#include "arb_hypgeom.h"
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

int
acb_dirichlet_l_fmpq_use_afe(ulong q, const fmpq_t s, slong prec)
{
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/l_fmpq_afe.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "fmpq.h"
#include "arb_mat.h"
#include "arb_hypgeom.h"
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
#else
# include <math.h>
#endif

#define VERBOSE 0

static double
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/platt_local_hardy_z_zeros.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_dirichlet.h"
#include "arb_calc.h"

#ifdef __GNUC__
# define exp __builtin_exp
#else
# include <math.h>
#endif

static const slong LOOPCOUNT = 4;

/*
Expand Down
13 changes: 1 addition & 12 deletions src/acb_dirichlet/stieltjes.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb_poly.h"
#include "acb_dirichlet.h"
#include "acb_calc.h"

#ifdef __GNUC__
# define atan2 __builtin_atan2
# define cos __builtin_cos
# define exp __builtin_exp
# define log __builtin_log
# define pow __builtin_pow
# define sqrt __builtin_sqrt
# define tan __builtin_tan
#else
# include <math.h>
#endif

/* Bound the quadratic Taylor error term. */
static void
stieltjes_bound_quadratic_term(arb_t B, const acb_t z,
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/test/t-euler_product_real_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
#else
# include <math.h>
#endif

const signed char chi[8][6] = {
{1, 1},
{2, 0, 1},
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/test/t-l_jet.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

/* Laurent expansions at s = 1 of first 10 principal L-functions */

/* with mpmath:
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/zeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb_poly.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define sqrt __builtin_sqrt
#else
# include <math.h>
#endif

void acb_zeta_si(acb_t z, slong s, slong prec);

static void
Expand Down
7 changes: 1 addition & 6 deletions src/acb_dirichlet/zeta_jet.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb_poly.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define sqrt __builtin_sqrt
#else
# include <math.h>
#endif

void
_acb_dirichlet_zeta_jet(acb_t t, const acb_t h, int deflate, slong len, slong prec)
{
Expand Down
8 changes: 1 addition & 7 deletions src/acb_dirichlet/zeta_rs_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_dirichlet.h"

#ifdef __GNUC__
# define log __builtin_log
# define pow __builtin_pow
#else
# include <math.h>
#endif

void
acb_dirichlet_zeta_rs_r(acb_t res, const acb_t s, slong K, slong prec)
{
Expand Down
7 changes: 1 addition & 6 deletions src/acb_elliptic/rf.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_elliptic.h"

#ifdef __GNUC__
# define pow __builtin_pow
#else
# include <math.h>
#endif

static const unsigned short den_ratio_tab[512] = {
1,1,10,7,12,11,26,1,136,19,2,23,20,1,58,31,
16,1,74,1,164,43,2,47,56,1,106,1,4,59,122,1,
Expand Down
7 changes: 1 addition & 6 deletions src/acb_elliptic/rj.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "acb.h"
#include "acb_elliptic.h"
#include "acb_calc.h"

#ifdef __GNUC__
# define pow __builtin_pow
#else
# include <math.h>
#endif

static const unsigned short den_ratio_tab[512] = {
1,1,14,3,44,13,10,17,152,1,46,1,12,29,62,1,
16,37,2,41,172,1,94,7,8,53,2,1,236,61,2,1,
Expand Down
7 changes: 1 addition & 6 deletions src/acb_elliptic/test/t-pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb.h"
#include "acb_elliptic.h"
#include "acb_modular.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

static const double testdata_pi[17][6] = {
{-2.0, 0.0, 0.0, 0.0, 0.9068996821171089253, 0.0},
{-2.0, 0.0, 2.0, 0.0, 0.90023699434287315449, -0.5446596026314193538},
Expand Down
7 changes: 1 addition & 6 deletions src/acb_elliptic/test/t-rg.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb.h"
#include "acb_elliptic.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

/* Test input from Carlson's paper and checked with mpmath. */

static const double testdata_rg[7][8] = {
Expand Down
7 changes: 1 addition & 6 deletions src/acb_elliptic/test/t-rj.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include <math.h>
#include "test_helpers.h"
#include "acb.h"
#include "acb_elliptic.h"

#ifdef __GNUC__
# define fabs __builtin_fabs
#else
# include <math.h>
#endif

/* Test input from Carlson's paper and checked with mpmath. */

static const double testdata_rj[16][10] = {
Expand Down
Loading

0 comments on commit 9550096

Please sign in to comment.