Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:06

0001 /*
0002     Copyright (C) 2014 Fredrik Johansson
0003 
0004     This file is part of FLINT.
0005 
0006     FLINT is free software: you can redistribute it and/or modify it under
0007     the terms of the GNU Lesser General Public License (LGPL) as published
0008     by the Free Software Foundation; either version 3 of the License, or
0009     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0010 */
0011 
0012 #ifndef ARB_H
0013 #define ARB_H
0014 
0015 #ifdef ARB_INLINES_C
0016 #define ARB_INLINE
0017 #else
0018 #define ARB_INLINE static inline
0019 #endif
0020 
0021 #include "arf.h"
0022 #include "arb_types.h"
0023 
0024 #ifdef __cplusplus
0025 extern "C" {
0026 #endif
0027 
0028 #define arb_midref(x) (&(x)->mid)
0029 #define arb_radref(x) (&(x)->rad)
0030 
0031 #define ARB_IS_LAGOM(x) (ARF_IS_LAGOM(arb_midref(x)) && MAG_IS_LAGOM(arb_radref(x)))
0032 
0033 #define ARB_RND ARF_RND_DOWN
0034 
0035 ARB_INLINE void
0036 arb_init(arb_t x)
0037 {
0038     arf_init(arb_midref(x));
0039     mag_init(arb_radref(x));
0040 }
0041 
0042 void arb_clear(arb_t x);
0043 
0044 arb_ptr _arb_vec_init(slong n);
0045 void _arb_vec_clear(arb_ptr v, slong n);
0046 
0047 ARB_INLINE arf_ptr arb_mid_ptr(arb_t z) { return arb_midref(z); }
0048 ARB_INLINE mag_ptr arb_rad_ptr(arb_t z) { return arb_radref(z); }
0049 
0050 ARB_INLINE int
0051 arb_is_exact(const arb_t x)
0052 {
0053     return mag_is_zero(arb_radref(x));
0054 }
0055 
0056 ARB_INLINE int
0057 arb_equal(const arb_t x, const arb_t y)
0058 {
0059     return arf_equal(arb_midref(x), arb_midref(y)) &&
0060            mag_equal(arb_radref(x), arb_radref(y));
0061 }
0062 
0063 ARB_INLINE int
0064 arb_equal_si(const arb_t x, slong y)
0065 {
0066     return arf_equal_si(arb_midref(x), y) && mag_is_zero(arb_radref(x));
0067 }
0068 
0069 /* implementations are in arb/richcmp.c */
0070 int arb_eq(const arb_t x, const arb_t y);
0071 int arb_ne(const arb_t x, const arb_t y);
0072 int arb_lt(const arb_t x, const arb_t y);
0073 int arb_le(const arb_t x, const arb_t y);
0074 int arb_gt(const arb_t x, const arb_t y);
0075 int arb_ge(const arb_t x, const arb_t y);
0076 
0077 void arb_zero(arb_t x);
0078 
0079 ARB_INLINE int
0080 arb_is_zero(const arb_t x)
0081 {
0082     return arf_is_zero(arb_midref(x)) && mag_is_zero(arb_radref(x));
0083 }
0084 
0085 ARB_INLINE void
0086 arb_pos_inf(arb_t x)
0087 {
0088     arf_pos_inf(arb_midref(x));
0089     mag_zero(arb_radref(x));
0090 }
0091 
0092 ARB_INLINE void
0093 arb_neg_inf(arb_t x)
0094 {
0095     arf_neg_inf(arb_midref(x));
0096     mag_zero(arb_radref(x));
0097 }
0098 
0099 ARB_INLINE void
0100 arb_zero_pm_inf(arb_t x)
0101 {
0102     arf_zero(arb_midref(x));
0103     mag_inf(arb_radref(x));
0104 }
0105 
0106 ARB_INLINE void
0107 arb_zero_pm_one(arb_t x)
0108 {
0109     arf_zero(arb_midref(x));
0110     mag_one(arb_radref(x));
0111 }
0112 
0113 ARB_INLINE void
0114 arb_unit_interval(arb_t x)
0115 {
0116     arf_one(arb_midref(x));
0117     mag_one(arb_radref(x));
0118     ARF_EXP(arb_midref(x))--;
0119     MAG_EXP(arb_radref(x))--;
0120 }
0121 
0122 void arb_indeterminate(arb_t x);
0123 
0124 int arb_is_finite(const arb_t x);
0125 
0126 void arb_set(arb_t y, const arb_t x);
0127 
0128 ARB_INLINE void
0129 arb_swap(arb_t x, arb_t y)
0130 {
0131     FLINT_SWAP(arb_struct, *x, *y);
0132 }
0133 
0134 void arb_set_round(arb_t z, const arb_t x, slong prec);
0135 
0136 void arb_trim(arb_t y, const arb_t x);
0137 
0138 void arb_neg(arb_t y, const arb_t x);
0139 
0140 void arb_neg_round(arb_t y, const arb_t x, slong prec);
0141 
0142 void arb_abs(arb_t y, const arb_t x);
0143 void arb_nonnegative_abs(arb_t y, const arb_t x);
0144 
0145 void arb_sgn(arb_t res, const arb_t x);
0146 int arb_sgn_nonzero(const arb_t x);
0147 
0148 void _arb_digits_round_inplace(char * s, flint_bitcnt_t * shift, fmpz_t error, slong n, arf_rnd_t rnd);
0149 
0150 int arb_set_str(arb_t res, const char * inp, slong prec);
0151 
0152 #define ARB_STR_MORE UWORD(1)
0153 #define ARB_STR_NO_RADIUS UWORD(2)
0154 #define ARB_STR_CONDENSE UWORD(16)
0155 
0156 char * arb_get_str(const arb_t x, slong n, ulong flags);
0157 
0158 
0159 ARB_INLINE void
0160 arb_set_arf(arb_t x, const arf_t y)
0161 {
0162     arf_set(arb_midref(x), y);
0163     mag_zero(arb_radref(x));
0164 }
0165 
0166 void arb_set_si(arb_t y, slong x);
0167 
0168 void arb_set_ui(arb_t y, ulong x);
0169 
0170 void arb_set_d(arb_t y, double x);
0171 
0172 void arb_set_fmpz(arb_t y, const fmpz_t x);
0173 
0174 ARB_INLINE void
0175 arb_set_fmpz_2exp(arb_t x, const fmpz_t y, const fmpz_t exp)
0176 {
0177     arf_set_fmpz_2exp(arb_midref(x), y, exp);
0178     mag_zero(arb_radref(x));
0179 }
0180 
0181 void arb_set_round_fmpz_2exp(arb_t y, const fmpz_t x, const fmpz_t exp, slong prec);
0182 
0183 void arb_set_round_fmpz(arb_t y, const fmpz_t x, slong prec);
0184 
0185 ARB_INLINE int
0186 arb_is_one(const arb_t f)
0187 {
0188     return arf_is_one(arb_midref(f)) && mag_is_zero(arb_radref(f));
0189 }
0190 
0191 void arb_one(arb_t f);
0192 
0193 #ifdef FLINT_HAVE_FILE
0194 void arb_fprint(FILE * file, const arb_t x);
0195 void arb_fprintd(FILE * file, const arb_t x, slong digits);
0196 void arb_fprintn(FILE * file, const arb_t x, slong digits, ulong flags);
0197 #endif
0198 
0199 void arb_print(const arb_t x);
0200 void arb_printd(const arb_t x, slong digits);
0201 void arb_printn(const arb_t x, slong digits, ulong flags);
0202 
0203 void _arb_vec_printn(arb_srcptr vec, slong len, slong ndigits, ulong flags);
0204 void _arb_vec_printd(arb_srcptr vec, slong len, slong ndigits);
0205 
0206 void arb_mul_2exp_si(arb_t y, const arb_t x, slong e);
0207 
0208 ARB_INLINE void
0209 arb_mul_2exp_fmpz(arb_t y, const arb_t x, const fmpz_t e)
0210 {
0211     arf_mul_2exp_fmpz(arb_midref(y), arb_midref(x), e);
0212     mag_mul_2exp_fmpz(arb_radref(y), arb_radref(x), e);
0213 }
0214 
0215 ARB_INLINE int
0216 arb_is_int(const arb_t x)
0217 {
0218     return mag_is_zero(arb_radref(x)) &&
0219            arf_is_int(arb_midref(x));
0220 }
0221 
0222 ARB_INLINE int
0223 arb_is_int_2exp_si(const arb_t x, slong e)
0224 {
0225     return mag_is_zero(arb_radref(x)) &&
0226            arf_is_int_2exp_si(arb_midref(x), e);
0227 }
0228 
0229 /* implementations are in arb/richcmp.c */
0230 int arb_contains_zero(const arb_t x);
0231 int arb_is_nonzero(const arb_t x);
0232 int arb_is_positive(const arb_t x);
0233 int arb_is_nonnegative(const arb_t x);
0234 int arb_is_negative(const arb_t x);
0235 int arb_is_nonpositive(const arb_t x);
0236 int arb_contains_negative(const arb_t x);
0237 int arb_contains_nonpositive(const arb_t x);
0238 int arb_contains_positive(const arb_t x);
0239 int arb_contains_nonnegative(const arb_t x);
0240 
0241 void arb_get_mag_lower(mag_t z, const arb_t x);
0242 
0243 void arb_get_mag_lower_nonnegative(mag_t z, const arb_t x);
0244 
0245 ARB_INLINE void
0246 arb_get_mag(mag_t z, const arb_t x)
0247 {
0248     mag_t t;
0249     mag_init_set_arf(t, arb_midref(x));
0250     mag_add(z, t, arb_radref(x));
0251     mag_clear(t);
0252 }
0253 
0254 ARB_INLINE void
0255 arb_get_mid_arb(arb_t z, const arb_t x)
0256 {
0257     arf_set(arb_midref(z), arb_midref(x));
0258     mag_zero(arb_radref(z));
0259 }
0260 
0261 ARB_INLINE void
0262 arb_get_rad_arb(arb_t z, const arb_t x)
0263 {
0264     arf_set_mag(arb_midref(z), arb_radref(x));
0265     mag_zero(arb_radref(z));
0266 }
0267 
0268 void arb_get_abs_ubound_arf(arf_t u, const arb_t x, slong prec);
0269 void arb_get_abs_lbound_arf(arf_t u, const arb_t x, slong prec);
0270 void arb_get_ubound_arf(arf_t u, const arb_t x, slong prec);
0271 void arb_get_lbound_arf(arf_t u, const arb_t x, slong prec);
0272 
0273 void arb_nonnegative_part(arb_t res, const arb_t x);
0274 
0275 slong arb_rel_error_bits(const arb_t x);
0276 
0277 ARB_INLINE slong
0278 arb_rel_accuracy_bits(const arb_t x)
0279 {
0280     return -arb_rel_error_bits(x);
0281 }
0282 
0283 slong arb_rel_one_accuracy_bits(const arb_t x);
0284 
0285 ARB_INLINE slong
0286 arb_bits(const arb_t x)
0287 {
0288     return arf_bits(arb_midref(x));
0289 }
0290 
0291 void arb_randtest_exact(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0292 
0293 void arb_randtest_wide(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0294 
0295 void arb_randtest_precise(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0296 
0297 void arb_randtest_positive(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0298 
0299 void arb_randtest(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0300 
0301 void arb_randtest_special(arb_t x, flint_rand_t state, slong prec, slong mag_bits);
0302 
0303 void arb_urandom(arb_t x, flint_rand_t state, slong prec);
0304 
0305 void arb_add_error_arf(arb_t x, const arf_t err);
0306 
0307 void arb_add_error_2exp_si(arb_t x, slong err);
0308 
0309 void arb_add_error_2exp_fmpz(arb_t x, const fmpz_t err);
0310 
0311 void arb_add_error(arb_t x, const arb_t error);
0312 
0313 ARB_INLINE void
0314 arb_add_error_mag(arb_t x, const mag_t err)
0315 {
0316     mag_add(arb_radref(x), arb_radref(x), err);
0317 }
0318 
0319 int arb_contains_arf(const arb_t x, const arf_t y);
0320 
0321 int arb_contains_fmpq(const arb_t x, const fmpq_t y);
0322 
0323 int arb_contains_fmpz(const arb_t x, const fmpz_t y);
0324 
0325 int arb_contains_si(const arb_t x, slong y);
0326 
0327 #ifdef __MPFR_H
0328 int arb_contains_mpfr(const arb_t x, const mpfr_t y);
0329 #endif
0330 
0331 int arb_overlaps(const arb_t x, const arb_t y);
0332 
0333 int arb_contains(const arb_t x, const arb_t y);
0334 
0335 int arb_contains_interior(const arb_t x, const arb_t y);
0336 
0337 int arb_contains_int(const arb_t x);
0338 
0339 void arb_get_interval_fmpz_2exp(fmpz_t a, fmpz_t b, fmpz_t exp, const arb_t x);
0340 int arb_get_unique_fmpz(fmpz_t z, const arb_t x);
0341 int arb_get_simplest_fmpq(fmpq_t res, const arb_t x);
0342 
0343 void arb_get_fmpz_mid_rad_10exp(fmpz_t mid, fmpz_t rad, fmpz_t exp, const arb_t x, slong n);
0344 
0345 void arb_floor(arb_t z, const arb_t x, slong prec);
0346 void arb_ceil(arb_t z, const arb_t x, slong prec);
0347 void arb_nint(arb_t res, const arb_t x, slong prec);
0348 void arb_trunc(arb_t res, const arb_t x, slong prec);
0349 
0350 void arb_set_interval_arf(arb_t x, const arf_t a, const arf_t b, slong prec);
0351 #ifdef __MPFR_H
0352 void arb_set_interval_mpfr(arb_t x, const mpfr_t a, const mpfr_t b, slong prec);
0353 #endif
0354 
0355 void arb_get_interval_arf(arf_t a, arf_t b, const arb_t x, slong prec);
0356 #ifdef __MPFR_H
0357 void arb_get_interval_mpfr(mpfr_t a, mpfr_t b, const arb_t x);
0358 #endif
0359 
0360 void arb_set_interval_mag(arb_t res, const mag_t a, const mag_t b, slong prec);
0361 void arb_set_interval_neg_pos_mag(arb_t res, const mag_t a, const mag_t b, slong prec);
0362 
0363 void arb_union(arb_t z, const arb_t x, const arb_t y, slong prec);
0364 int arb_intersection(arb_t z, const arb_t x, const arb_t y, slong prec);
0365 void arb_get_rand_fmpq(fmpq_t q, flint_rand_t state, const arb_t x, slong bits);
0366 
0367 void arb_min(arb_t z, const arb_t x, const arb_t y, slong prec);
0368 void arb_max(arb_t z, const arb_t x, const arb_t y, slong prec);
0369 void arb_minmax(arb_t z1, arb_t z2, const arb_t x, const arb_t y, slong prec);
0370 
0371 int arb_can_round_arf(const arb_t x, slong prec, arf_rnd_t rnd);
0372 #ifdef __MPFR_H
0373 int arb_can_round_mpfr(const arb_t x, slong prec, mpfr_rnd_t rnd);
0374 #endif
0375 
0376 void arb_add(arb_t z, const arb_t x, const arb_t y, slong prec);
0377 void arb_add_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0378 void arb_add_ui(arb_t z, const arb_t x, ulong y, slong prec);
0379 void arb_add_si(arb_t z, const arb_t x, slong y, slong prec);
0380 void arb_add_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0381 void arb_add_fmpz_2exp(arb_t z, const arb_t x, const fmpz_t man, const fmpz_t exp, slong prec);
0382 
0383 void arb_sub(arb_t z, const arb_t x, const arb_t y, slong prec);
0384 void arb_sub_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0385 void arb_sub_ui(arb_t z, const arb_t x, ulong y, slong prec);
0386 void arb_sub_si(arb_t z, const arb_t x, slong y, slong prec);
0387 void arb_sub_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0388 
0389 void arb_mul(arb_t z, const arb_t x, const arb_t y, slong prec);
0390 void arb_mul_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0391 void arb_mul_si(arb_t z, const arb_t x, slong y, slong prec);
0392 void arb_mul_ui(arb_t z, const arb_t x, ulong y, slong prec);
0393 void arb_mul_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0394 
0395 void arb_addmul(arb_t z, const arb_t x, const arb_t y, slong prec);
0396 void arb_addmul_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0397 void arb_addmul_si(arb_t z, const arb_t x, slong y, slong prec);
0398 void arb_addmul_ui(arb_t z, const arb_t x, ulong y, slong prec);
0399 void arb_addmul_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0400 
0401 void arb_submul(arb_t z, const arb_t x, const arb_t y, slong prec);
0402 void arb_submul_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0403 void arb_submul_si(arb_t z, const arb_t x, slong y, slong prec);
0404 void arb_submul_ui(arb_t z, const arb_t x, ulong y, slong prec);
0405 void arb_submul_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0406 
0407 void arb_fma(arb_t res, const arb_t x, const arb_t y, const arb_t z, slong prec);
0408 void arb_fma_arf(arb_t res, const arb_t x, const arf_t y, const arb_t z, slong prec);
0409 void arb_fma_si(arb_t res, const arb_t x, slong y, const arb_t z, slong prec);
0410 void arb_fma_ui(arb_t res, const arb_t x, ulong y, const arb_t z, slong prec);
0411 void arb_fma_fmpz(arb_t res, const arb_t x, const fmpz_t y, const arb_t z, slong prec);
0412 
0413 void arb_dot_simple(arb_t res, const arb_t initial, int subtract,
0414     arb_srcptr x, slong xstep, arb_srcptr y, slong ystep, slong len, slong prec);
0415 void arb_dot_precise(arb_t res, const arb_t initial, int subtract,
0416     arb_srcptr x, slong xstep, arb_srcptr y, slong ystep, slong len, slong prec);
0417 void arb_dot(arb_t res, const arb_t initial, int subtract,
0418     arb_srcptr x, slong xstep, arb_srcptr y, slong ystep, slong len, slong prec);
0419 
0420 void arb_approx_dot(arb_t res, const arb_t initial, int subtract,
0421     arb_srcptr x, slong xstep, arb_srcptr y, slong ystep, slong len, slong prec);
0422 
0423 void arb_dot_ui(arb_t res, const arb_t initial, int subtract,
0424     arb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0425 void arb_dot_si(arb_t res, const arb_t initial, int subtract,
0426     arb_srcptr x, slong xstep, const slong * y, slong ystep, slong len, slong prec);
0427 void arb_dot_uiui(arb_t res, const arb_t initial, int subtract,
0428     arb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0429 void arb_dot_siui(arb_t res, const arb_t initial, int subtract,
0430     arb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0431 void arb_dot_fmpz(arb_t res, const arb_t initial, int subtract,
0432     arb_srcptr x, slong xstep, const fmpz * y, slong ystep, slong len, slong prec);
0433 
0434 void arb_div(arb_t z, const arb_t x, const arb_t y, slong prec);
0435 void arb_div_arf(arb_t z, const arb_t x, const arf_t y, slong prec);
0436 void arb_div_si(arb_t z, const arb_t x, slong y, slong prec);
0437 void arb_div_ui(arb_t z, const arb_t x, ulong y, slong prec);
0438 void arb_div_fmpz(arb_t z, const arb_t x, const fmpz_t y, slong prec);
0439 void arb_fmpz_div_fmpz(arb_t z, const fmpz_t x, const fmpz_t y, slong prec);
0440 void arb_ui_div(arb_t z, ulong x, const arb_t y, slong prec);
0441 
0442 void arb_div_arf_newton(arb_t res, const arb_t x, const arf_t y, slong prec);
0443 void arb_div_newton(arb_t res, const arb_t x, const arb_t y, slong prec);
0444 void arb_fmpz_divapprox(fmpz_t res, const fmpz_t x, const fmpz_t y);
0445 
0446 ARB_INLINE void
0447 arb_inv(arb_t y, const arb_t x, slong prec)
0448 {
0449     arb_ui_div(y, 1, x, prec);
0450 }
0451 
0452 ARB_INLINE void
0453 arb_set_fmpq(arb_t y, const fmpq_t x, slong prec)
0454 {
0455     arb_fmpz_div_fmpz(y, fmpq_numref(x), fmpq_denref(x), prec);
0456 }
0457 
0458 void arb_sqrt(arb_t z, const arb_t x, slong prec);
0459 void arb_sqrt_arf(arb_t z, const arf_t x, slong prec);
0460 void arb_sqrt_fmpz(arb_t z, const fmpz_t x, slong prec);
0461 void arb_sqrt_ui(arb_t z, ulong x, slong prec);
0462 
0463 void arb_sqrtpos(arb_t z, const arb_t x, slong prec);
0464 void arb_hypot(arb_t z, const arb_t x, const arb_t y, slong prec);
0465 
0466 void arb_rsqrt(arb_t z, const arb_t x, slong prec);
0467 void arb_rsqrt_ui(arb_t z, ulong x, slong prec);
0468 void arb_sqrt1pm1(arb_t r, const arb_t z, slong prec);
0469 
0470 void arb_rsqrt_arf_newton(arb_t res, const arf_t x, slong prec);
0471 void arb_sqrt_arf_newton(arb_t res, const arf_t x, slong prec);
0472 void arb_sqrt_newton(arb_t z, const arb_t x, slong prec);
0473 
0474 void arb_pow_fmpz_binexp(arb_t y, const arb_t b, const fmpz_t e, slong prec);
0475 void arb_pow_fmpz(arb_t y, const arb_t b, const fmpz_t e, slong prec);
0476 void arb_pow_ui(arb_t y, const arb_t b, ulong e, slong prec);
0477 void arb_ui_pow_ui(arb_t y, ulong b, ulong e, slong prec);
0478 void arb_si_pow_ui(arb_t y, slong b, ulong e, slong prec);
0479 void arb_pow_fmpq(arb_t y, const arb_t x, const fmpq_t a, slong prec);
0480 
0481 void arb_div_2expm1_ui(arb_t z, const arb_t x, ulong n, slong prec);
0482 void arb_pow(arb_t z, const arb_t x, const arb_t y, slong prec);
0483 void arb_root_ui(arb_t z, const arb_t x, ulong k, slong prec);
0484 void arb_root(arb_t z, const arb_t x, ulong k, slong prec); /* back compat */
0485 void _arb_log_precompute_reductions(short * rel, double * eps, arb_srcptr alpha, slong n, slong max_rel, double C);
0486 void arb_log(arb_t z, const arb_t x, slong prec);
0487 void arb_log_arf(arb_t z, const arf_t x, slong prec);
0488 void arb_log_ui(arb_t z, ulong x, slong prec);
0489 void arb_log_fmpz(arb_t z, const fmpz_t x, slong prec);
0490 void arb_log1p(arb_t r, const arb_t z, slong prec);
0491 void arb_log_base_ui(arb_t res, const arb_t x, ulong b, slong prec);
0492 void arb_log_hypot(arb_t res, const arb_t x, const arb_t y, slong prec);
0493 void arb_exp(arb_t z, const arb_t x, slong prec);
0494 void arb_expm1(arb_t z, const arb_t x, slong prec);
0495 void arb_exp_invexp(arb_t z, arb_t w, const arb_t x, slong prec);
0496 void arb_sin(arb_t s, const arb_t x, slong prec);
0497 void arb_cos(arb_t c, const arb_t x, slong prec);
0498 void arb_sin_cos(arb_t s, arb_t c, const arb_t x, slong prec);
0499 void arb_sin_pi(arb_t s, const arb_t x, slong prec);
0500 void arb_cos_pi(arb_t c, const arb_t x, slong prec);
0501 void arb_sin_cos_pi(arb_t s, arb_t c, const arb_t x, slong prec);
0502 void arb_tan(arb_t y, const arb_t x, slong prec);
0503 void arb_cot(arb_t y, const arb_t x, slong prec);
0504 void arb_tan_pi(arb_t y, const arb_t x, slong prec);
0505 void arb_cot_pi(arb_t y, const arb_t x, slong prec);
0506 void _arb_sin_pi_fmpq_algebraic(arb_t s, ulong p, ulong q, slong prec);
0507 void _arb_cos_pi_fmpq_algebraic(arb_t c, ulong p, ulong q, slong prec);
0508 void _arb_sin_cos_pi_fmpq_algebraic(arb_t s, arb_t c, ulong p, ulong q, slong prec);
0509 void arb_sin_cos_pi_fmpq(arb_t s, arb_t c, const fmpq_t x, slong prec);
0510 void arb_sin_pi_fmpq(arb_t s, const fmpq_t x, slong prec);
0511 void arb_cos_pi_fmpq(arb_t c, const fmpq_t x, slong prec);
0512 void arb_sinc(arb_t z, const arb_t x, slong prec);
0513 void arb_sinc_pi(arb_t z, const arb_t x, slong prec);
0514 void arb_sinh(arb_t z, const arb_t x, slong prec);
0515 void arb_cosh(arb_t z, const arb_t x, slong prec);
0516 void arb_sinh_cosh(arb_t s, arb_t c, const arb_t x, slong prec);
0517 void arb_tanh(arb_t y, const arb_t x, slong prec);
0518 void arb_coth(arb_t y, const arb_t x, slong prec);
0519 void arb_atan_arf(arb_t z, const arf_t x, slong prec);
0520 void arb_atan(arb_t z, const arb_t x, slong prec);
0521 void arb_atan2(arb_t z, const arb_t b, const arb_t a, slong prec);
0522 void arb_asin(arb_t z, const arb_t x, slong prec);
0523 void arb_acos(arb_t z, const arb_t x, slong prec);
0524 void arb_atanh(arb_t z, const arb_t x, slong prec);
0525 void arb_asinh(arb_t z, const arb_t x, slong prec);
0526 void arb_acosh(arb_t z, const arb_t x, slong prec);
0527 
0528 void arb_sec(arb_t res, const arb_t x, slong prec);
0529 void arb_csc(arb_t res, const arb_t x, slong prec);
0530 void arb_csc_pi(arb_t res, const arb_t x, slong prec);
0531 void arb_sech(arb_t res, const arb_t x, slong prec);
0532 void arb_csch(arb_t res, const arb_t x, slong prec);
0533 
0534 void arb_fac_ui(arb_t z, ulong n, slong prec);
0535 void arb_doublefac_ui(arb_t z, ulong n, slong prec);
0536 void arb_bin_ui(arb_t z, const arb_t n, ulong k, slong prec);
0537 void arb_bin_uiui(arb_t z, ulong n, ulong k, slong prec);
0538 void arb_fib_fmpz(arb_t z, const fmpz_t n, slong prec);
0539 void arb_fib_ui(arb_t z, ulong n, slong prec);
0540 void arb_const_pi(arb_t z, slong prec);
0541 void arb_const_sqrt_pi(arb_t z, slong prec);
0542 void arb_const_log_sqrt2pi(arb_t z, slong prec);
0543 void arb_const_log2(arb_t z, slong prec);
0544 void arb_const_log10(arb_t z, slong prec);
0545 void arb_const_euler(arb_t z, slong prec);
0546 void arb_const_catalan(arb_t z, slong prec);
0547 void arb_const_e(arb_t z, slong prec);
0548 void arb_const_khinchin(arb_t z, slong prec);
0549 void arb_const_glaisher(arb_t z, slong prec);
0550 void arb_const_reciprocal_fibonacci(arb_t res, slong prec);
0551 void arb_agm(arb_t z, const arb_t x, const arb_t y, slong prec);
0552 void arb_lgamma(arb_t z, const arb_t x, slong prec);
0553 void arb_rgamma(arb_t z, const arb_t x, slong prec);
0554 void arb_gamma(arb_t z, const arb_t x, slong prec);
0555 void arb_gamma_fmpq(arb_t z, const fmpq_t x, slong prec);
0556 void arb_gamma_fmpz(arb_t z, const fmpz_t x, slong prec);
0557 void arb_digamma(arb_t y, const arb_t x, slong prec);
0558 void arb_zeta(arb_t z, const arb_t s, slong prec);
0559 void arb_hurwitz_zeta(arb_t z, const arb_t s, const arb_t a, slong prec);
0560 
0561 void arb_rising_ui(arb_t z, const arb_t x, ulong n, slong prec);
0562 void arb_rising_fmpq_ui(arb_t y, const fmpq_t x, ulong n, slong prec);
0563 void arb_rising(arb_t z, const arb_t x, const arb_t n, slong prec);
0564 void arb_rising2_ui(arb_t u, arb_t v, const arb_t x, ulong n, slong prec);
0565 
0566 void arb_log_ui_from_prev(arb_t s, ulong k, arb_t log_prev, ulong prev, slong prec);
0567 
0568 void arb_const_apery(arb_t s, slong prec);
0569 
0570 void arb_zeta_ui_asymp(arb_t x, ulong s, slong prec);
0571 void arb_zeta_ui_borwein_bsplit(arb_t x, ulong s, slong prec);
0572 void arb_zeta_ui_euler_product(arb_t z, ulong s, slong prec);
0573 void arb_zeta_ui_bernoulli(arb_t x, ulong n, slong prec);
0574 void arb_zeta_ui_vec_borwein(arb_ptr z, ulong start, slong num, ulong step, slong prec);
0575 void arb_zeta_ui(arb_t x, ulong n, slong prec);
0576 void arb_zeta_ui_vec_even(arb_ptr x, ulong start, slong num, slong prec);
0577 void arb_zeta_ui_vec_odd(arb_ptr x, ulong start, slong num, slong prec);
0578 void arb_zeta_ui_vec(arb_ptr x, ulong start, slong num, slong prec);
0579 void arb_bernoulli_ui(arb_t b, ulong n, slong prec);
0580 void arb_bernoulli_ui_zeta(arb_t b, ulong n, slong prec);
0581 void arb_bernoulli_fmpz(arb_t b, const fmpz_t n, slong prec);
0582 
0583 void arb_bernoulli_poly_ui(arb_t res, ulong n, const arb_t x, slong prec);
0584 
0585 void arb_polylog(arb_t w, const arb_t s, const arb_t z, slong prec);
0586 void arb_polylog_si(arb_t w, slong s, const arb_t z, slong prec);
0587 
0588 void arb_chebyshev_t_ui(arb_t a, ulong n, const arb_t x, slong prec);
0589 void arb_chebyshev_t2_ui(arb_t a, arb_t b, ulong n, const arb_t x, slong prec);
0590 void arb_chebyshev_u_ui(arb_t a, ulong n, const arb_t x, slong prec);
0591 void arb_chebyshev_u2_ui(arb_t a, arb_t b, ulong n, const arb_t x, slong prec);
0592 
0593 void arb_power_sum_vec(arb_ptr res, const arb_t a, const arb_t b, slong len, slong prec);
0594 void arb_bell_sum_taylor(arb_t res, const fmpz_t n, const fmpz_t a, const fmpz_t b, const fmpz_t mmag, slong prec);
0595 void arb_bell_sum_bsplit(arb_t res, const fmpz_t n, const fmpz_t a, const fmpz_t b, const fmpz_t mmag, slong prec);
0596 void arb_bell_fmpz(arb_t res, const fmpz_t n, slong prec);
0597 void arb_bell_ui(arb_t res, ulong n, slong prec);
0598 
0599 void arb_euler_number_fmpz(arb_t res, const fmpz_t n, slong prec);
0600 void arb_euler_number_ui(arb_t res, ulong n, slong prec);
0601 void arb_fmpz_euler_number_ui_multi_mod(fmpz_t res, ulong n, double alpha);
0602 void arb_fmpz_euler_number_ui(fmpz_t res, ulong n);
0603 
0604 void arb_partitions_fmpz(arb_t res, const fmpz_t n, slong prec);
0605 void arb_partitions_ui(arb_t res, ulong n, slong prec);
0606 
0607 void arb_primorial_nth_ui(arb_t res, ulong n, slong prec);
0608 void arb_primorial_ui(arb_t res, ulong n, slong prec);
0609 
0610 void arb_lambertw(arb_t res, const arb_t x, int flags, slong prec);
0611 
0612 ARB_INLINE void
0613 arb_sqr(arb_t res, const arb_t val, slong prec)
0614 {
0615     arb_mul(res, val, val, prec);
0616 }
0617 
0618 #define _ARB_DEF_CACHED_CONSTANT(dcl, name, comp_func) \
0619     FLINT_TLS_PREFIX slong name ## _cached_prec = 0; \
0620     FLINT_TLS_PREFIX arb_t name ## _cached_value; \
0621     static void name ## _cleanup(void) \
0622     { \
0623         arb_clear(name ## _cached_value); \
0624         name ## _cached_prec = 0; \
0625     } \
0626     dcl void name(arb_t x, slong prec) \
0627     { \
0628         if (name ## _cached_prec < prec) \
0629         { \
0630             if (name ## _cached_prec == 0) \
0631             { \
0632                 arb_init(name ## _cached_value); \
0633                 flint_register_cleanup_function(name ## _cleanup); \
0634             } \
0635             comp_func(name ## _cached_value, prec + 32); \
0636             name ## _cached_prec = prec; \
0637         } \
0638         arb_set_round(x, name ## _cached_value, prec); \
0639     }
0640 #define ARB_DEF_CACHED_CONSTANT(name, comp_func) _ARB_DEF_CACHED_CONSTANT(, name, comp_func)
0641 
0642 /* vector functions */
0643 
0644 arb_ptr _arb_vec_entry_ptr(arb_ptr vec, slong i);
0645 
0646 void _arb_vec_zero(arb_ptr A, slong n);
0647 void _arb_vec_indeterminate(arb_ptr vec, slong len);
0648 
0649 int _arb_vec_is_zero(arb_srcptr vec, slong len);
0650 int _arb_vec_is_finite(arb_srcptr x, slong len);
0651 
0652 int _arb_vec_equal(arb_srcptr vec1, arb_srcptr vec2, slong len);
0653 int _arb_vec_overlaps(arb_srcptr vec1, arb_srcptr vec2, slong len);
0654 int _arb_vec_contains(arb_srcptr vec1, arb_srcptr vec2, slong len);
0655 
0656 void _arb_vec_set(arb_ptr res, arb_srcptr vec, slong len);
0657 void _arb_vec_swap(arb_ptr res, arb_ptr vec, slong len);
0658 void _arb_vec_neg(arb_ptr B, arb_srcptr A, slong n);
0659 
0660 void _arb_vec_set_round(arb_ptr res, arb_srcptr vec, slong len, slong prec);
0661 
0662 void _arb_vec_sub(arb_ptr C, arb_srcptr A, arb_srcptr B, slong n, slong prec);
0663 void _arb_vec_add(arb_ptr C, arb_srcptr A, arb_srcptr B, slong n, slong prec);
0664 
0665 void _arb_vec_scalar_mul(arb_ptr res, arb_srcptr vec, slong len, const arb_t c, slong prec);
0666 void _arb_vec_scalar_mul_arf(arb_ptr res, arb_srcptr vec, slong len, const arf_t c, slong prec);
0667 void _arb_vec_scalar_mul_ui(arb_ptr res, arb_srcptr vec, slong len, ulong c, slong prec);
0668 void _arb_vec_scalar_mul_si(arb_ptr res, arb_srcptr vec, slong len, slong c, slong prec);
0669 void _arb_vec_scalar_mul_fmpz(arb_ptr res, arb_srcptr vec, slong len, const fmpz_t c, slong prec);
0670 void _arb_vec_scalar_mul_2exp_si(arb_ptr res, arb_srcptr src, slong len, slong c);
0671 void _arb_vec_scalar_div(arb_ptr res, arb_srcptr vec, slong len, const arb_t c, slong prec);
0672 void _arb_vec_scalar_addmul(arb_ptr res, arb_srcptr vec, slong len, const arb_t c, slong prec);
0673 
0674 void _arb_vec_get_mag(mag_t bound, arb_srcptr vec, slong len);
0675 
0676 slong _arb_vec_bits(arb_srcptr x, slong len);
0677 
0678 void _arb_vec_set_powers(arb_ptr xs, const arb_t x, slong len, slong prec);
0679 
0680 void _arb_vec_add_error_arf_vec(arb_ptr res, arf_srcptr err, slong len);
0681 void _arb_vec_add_error_mag_vec(arb_ptr res, mag_srcptr err, slong len);
0682 
0683 void _arb_vec_trim(arb_ptr res, arb_srcptr vec, slong len);
0684 
0685 int _arb_vec_get_unique_fmpz_vec(fmpz * res,  arb_srcptr vec, slong len);
0686 
0687 /* arctangent implementation */
0688 
0689 #define ARB_ATAN_TAB1_BITS 8
0690 #define ARB_ATAN_TAB1_PREC 512
0691 #define ARB_ATAN_TAB1_LIMBS (ARB_ATAN_TAB1_PREC / FLINT_BITS)
0692 
0693 #define ARB_ATAN_TAB21_BITS 5
0694 #define ARB_ATAN_TAB22_BITS 5
0695 #define ARB_ATAN_TAB2_PREC 4608
0696 #define ARB_ATAN_TAB2_LIMBS (ARB_ATAN_TAB2_PREC / FLINT_BITS)
0697 
0698 FLINT_DLL extern const ulong arb_atan_tab1[1 << ARB_ATAN_TAB1_BITS][ARB_ATAN_TAB1_LIMBS];
0699 FLINT_DLL extern const ulong arb_atan_tab21[1 << ARB_ATAN_TAB21_BITS][ARB_ATAN_TAB2_LIMBS];
0700 FLINT_DLL extern const ulong arb_atan_tab22[1 << ARB_ATAN_TAB22_BITS][ARB_ATAN_TAB2_LIMBS];
0701 FLINT_DLL extern const ulong arb_atan_pi2_minus_one[ARB_ATAN_TAB2_LIMBS];
0702 
0703 void
0704 _arb_atan_taylor_naive(nn_ptr y, ulong * error,
0705     nn_srcptr x, slong xn, ulong N, int alternating);
0706 
0707 void _arb_atan_taylor_rs(nn_ptr y, ulong * error,
0708     nn_srcptr x, slong xn, ulong N, int alternating);
0709 
0710 #define ARB_ATAN_NEWTON_PREC 3400
0711 
0712 void arb_atan_newton(arb_t res, const arb_t x, slong prec);
0713 void arb_atan_arf_newton(arb_t res, const arf_t x, slong prec);
0714 
0715 /* logarithm implementation */
0716 
0717 #define ARB_LOG_TAB11_BITS 7
0718 #define ARB_LOG_TAB12_BITS 7
0719 #define ARB_LOG_TAB1_PREC 512
0720 #define ARB_LOG_TAB1_LIMBS (ARB_LOG_TAB1_PREC / FLINT_BITS)
0721 
0722 #define ARB_LOG_TAB21_BITS 5
0723 #define ARB_LOG_TAB22_BITS 5
0724 #define ARB_LOG_TAB2_PREC 4608
0725 #define ARB_LOG_TAB2_LIMBS (ARB_LOG_TAB2_PREC / FLINT_BITS)
0726 
0727 FLINT_DLL extern const ulong arb_log_tab11[1 << ARB_LOG_TAB11_BITS][ARB_LOG_TAB1_LIMBS];
0728 FLINT_DLL extern const ulong arb_log_tab12[1 << ARB_LOG_TAB12_BITS][ARB_LOG_TAB1_LIMBS];
0729 FLINT_DLL extern const ulong arb_log_tab21[1 << ARB_LOG_TAB21_BITS][ARB_LOG_TAB2_LIMBS];
0730 FLINT_DLL extern const ulong arb_log_tab22[1 << ARB_LOG_TAB22_BITS][ARB_LOG_TAB2_LIMBS];
0731 FLINT_DLL extern const nn_srcptr arb_log_log2_tab;
0732 
0733 void arb_log_newton(arb_t res, const arb_t x, slong prec);
0734 void arb_log_arf_newton(arb_t res, const arf_t x, slong prec);
0735 
0736 /* logarithms of primes */
0737 
0738 #define ARB_LOG_PRIME_CACHE_NUM 13
0739 
0740 FLINT_DLL extern const ulong arb_log_p_tab[ARB_LOG_PRIME_CACHE_NUM][ARB_LOG_TAB2_LIMBS];
0741 void arb_log_primes_vec_bsplit(arb_ptr res, slong n, slong prec);
0742 
0743 void _arb_log_p_ensure_cached(slong prec);
0744 arb_srcptr _arb_log_p_cache_vec(void);
0745 
0746 /* exponential implementation */
0747 
0748 /* only goes up to log(2) * 256 */
0749 #define ARB_EXP_TAB1_NUM 178
0750 #define ARB_EXP_TAB1_BITS 8
0751 #define ARB_EXP_TAB1_PREC 512
0752 #define ARB_EXP_TAB1_LIMBS (ARB_EXP_TAB1_PREC / FLINT_BITS)
0753 
0754 /* only goes up to log(2) * 32 */
0755 #define ARB_EXP_TAB21_NUM 23
0756 #define ARB_EXP_TAB21_BITS 5
0757 #define ARB_EXP_TAB22_NUM (1 << ARB_EXP_TAB22_BITS)
0758 #define ARB_EXP_TAB22_BITS 5
0759 #define ARB_EXP_TAB2_PREC 4608
0760 #define ARB_EXP_TAB2_LIMBS (ARB_EXP_TAB2_PREC / FLINT_BITS)
0761 
0762 FLINT_DLL extern const ulong arb_exp_tab1[ARB_EXP_TAB1_NUM][ARB_EXP_TAB1_LIMBS];
0763 FLINT_DLL extern const ulong arb_exp_tab21[ARB_EXP_TAB21_NUM][ARB_EXP_TAB2_LIMBS];
0764 FLINT_DLL extern const ulong arb_exp_tab22[ARB_EXP_TAB22_NUM][ARB_EXP_TAB2_LIMBS];
0765 
0766 void _arb_exp_taylor_naive(nn_ptr y, ulong * error,
0767     nn_srcptr x, slong xn, ulong N);
0768 
0769 void _arb_exp_taylor_rs(nn_ptr y, ulong * error,
0770     nn_srcptr x, slong xn, ulong N);
0771 
0772 void arb_exp_arf_bb(arb_t z, const arf_t x, slong prec, int minus_one);
0773 void arb_exp_arf_rs_generic(arb_t res, const arf_t x, slong prec, int minus_one);
0774 
0775 int _arb_get_mpn_fixed_mod_log2(nn_ptr w, fmpz_t q, ulong * error,
0776                                                 const arf_t x, slong wn);
0777 
0778 slong _arb_exp_taylor_bound(slong mag, slong prec);
0779 
0780 void _arb_exp_sum_bs_powtab(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp,
0781     const fmpz_t x, flint_bitcnt_t r, slong N);
0782 
0783 void _arb_exp_sum_bs_simple(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp,
0784     const fmpz_t x, flint_bitcnt_t r, slong N);
0785 
0786 #define ARB_LOG_REDUCTION_DEFAULT_MAX_PREC 4000000
0787 #define ARB_EXP_LOG_REDUCTION_PREC 2240
0788 #define ARB_LOG_NEWTON_PREC 2800
0789 
0790 void arb_exp_arf_log_reduction(arb_t res, const arf_t x, slong prec, int minus_one);
0791 void arb_exp_arf_generic(arb_t z, const arf_t x, slong prec, int minus_one);
0792 void arb_exp_arf(arb_t z, const arf_t x, slong prec, int minus_one, slong maglim);
0793 
0794 /* sin/cos implementation */
0795 
0796 /* only goes up to (pi/4) * 256 */
0797 #define ARB_SIN_COS_TAB1_NUM 203
0798 #define ARB_SIN_COS_TAB1_BITS 8
0799 #define ARB_SIN_COS_TAB1_PREC 512
0800 #define ARB_SIN_COS_TAB1_LIMBS (ARB_SIN_COS_TAB1_PREC / FLINT_BITS)
0801 
0802 /* only goes up to (pi/4) * 32 */
0803 #define ARB_SIN_COS_TAB21_NUM 26
0804 #define ARB_SIN_COS_TAB21_BITS 5
0805 #define ARB_SIN_COS_TAB22_NUM (1 << ARB_SIN_COS_TAB22_BITS)
0806 #define ARB_SIN_COS_TAB22_BITS 5
0807 #define ARB_SIN_COS_TAB2_PREC 4608
0808 #define ARB_SIN_COS_TAB2_LIMBS (ARB_SIN_COS_TAB2_PREC / FLINT_BITS)
0809 
0810 FLINT_DLL extern const ulong arb_sin_cos_tab1[2 * ARB_SIN_COS_TAB1_NUM][ARB_SIN_COS_TAB1_LIMBS];
0811 FLINT_DLL extern const ulong arb_sin_cos_tab21[2 * ARB_SIN_COS_TAB21_NUM][ARB_SIN_COS_TAB2_LIMBS];
0812 FLINT_DLL extern const ulong arb_sin_cos_tab22[2 * ARB_SIN_COS_TAB22_NUM][ARB_SIN_COS_TAB2_LIMBS];
0813 
0814 #define ARB_PI4_TAB_LIMBS (4608 / FLINT_BITS)
0815 FLINT_DLL extern const ulong arb_pi4_tab[ARB_PI4_TAB_LIMBS];
0816 
0817 void _arb_sin_cos_taylor_naive(nn_ptr ysin, nn_ptr ycos, ulong * error,
0818     nn_srcptr x, slong xn, ulong N);
0819 
0820 void _arb_sin_cos_taylor_rs(nn_ptr ysin, nn_ptr ycos,
0821     ulong * error, nn_srcptr x, slong xn, ulong N,
0822     int sinonly, int alternating);
0823 
0824 int _arb_get_mpn_fixed_mod_pi4(nn_ptr w, fmpz_t q, int * octant,
0825     ulong * error, const arf_t x, slong wn);
0826 
0827 void arb_sin_cos_arf_bb(arb_t zsin, arb_t zcos, const arf_t x, slong prec);
0828 void arb_sin_cos_arf_rs_generic(arb_t res_sin, arb_t res_cos, const arf_t x, slong prec);
0829 void arb_sin_cos_arf_generic(arb_t res_sin, arb_t res_cos, const arf_t x, slong prec);
0830 
0831 void _arb_sin_cos_wide(arb_t s, arb_t c, const arf_t x, const mag_t r, slong prec);
0832 void arb_sin_cos_wide(arb_t s, arb_t c, const arb_t x, slong prec);
0833 
0834 void _arb_sin_cos_generic(arb_t s, arb_t c, const arf_t x, const mag_t xrad, slong prec);
0835 void arb_sin_cos_generic(arb_t s, arb_t c, const arb_t x, slong prec);
0836 
0837 void arb_atan_gauss_primes_vec_bsplit(arb_ptr res, slong n, slong prec);
0838 
0839 #define ARB_ATAN_GAUSS_PRIME_CACHE_NUM 13
0840 
0841 #define ARB_SIN_COS_ATAN_REDUCTION_DEFAULT_MAX_PREC 4000000
0842 #define ARB_SIN_COS_ATAN_REDUCTION_PREC 2600
0843 
0844 FLINT_DLL extern const ulong arb_atan_gauss_tab[ARB_ATAN_GAUSS_PRIME_CACHE_NUM][ARB_ATAN_TAB2_LIMBS];
0845 
0846 void _arb_atan_gauss_p_ensure_cached(slong prec);
0847 arb_srcptr _arb_atan_gauss_p_cache_vec(void);
0848 
0849 void arb_sin_cos_arf_atan_reduction(arb_t res1, arb_t res2, const arf_t x, slong prec);
0850 
0851 
0852 ARB_INLINE flint_bitcnt_t
0853 _arb_mpn_leading_zeros(nn_srcptr d, slong n)
0854 {
0855     ulong t;
0856     slong zero_limbs;
0857     flint_bitcnt_t bits;
0858 
0859     zero_limbs = 0;
0860 
0861     while (1)
0862     {
0863         t = d[n - zero_limbs - 1];
0864 
0865         if (t != 0)
0866         {
0867             bits = flint_clz(t);
0868             return bits + FLINT_BITS * zero_limbs;
0869         }
0870 
0871         zero_limbs++;
0872 
0873         if (zero_limbs == n)
0874             return FLINT_BITS * zero_limbs;
0875     }
0876 }
0877 
0878 void _arb_atan_sum_bs_simple(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp,
0879     const fmpz_t x, flint_bitcnt_t r, slong N);
0880 
0881 void _arb_atan_sum_bs_powtab(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp,
0882     const fmpz_t x, flint_bitcnt_t r, slong N);
0883 
0884 void arb_atan_arf_bb(arb_t z, const arf_t x, slong prec);
0885 
0886 void arb_atan_frac_bsplit(arb_t s, const fmpz_t p, const fmpz_t q, int hyperbolic, slong prec);
0887 
0888 ARB_INLINE slong
0889 arb_allocated_bytes(const arb_t x)
0890 {
0891     return arf_allocated_bytes(arb_midref(x)) + mag_allocated_bytes(arb_radref(x));
0892 }
0893 
0894 slong _arb_vec_allocated_bytes(arb_srcptr vec, slong len);
0895 
0896 double _arb_vec_estimate_allocated_bytes(slong len, slong prec);
0897 
0898 int arb_load_str(arb_t res, const char * data);
0899 char * arb_dump_str(const arb_t x);
0900 
0901 #ifdef FLINT_HAVE_FILE
0902 int arb_load_file(arb_t res, FILE *stream);
0903 int arb_dump_file(FILE* stream, const arb_t x);
0904 #endif
0905 
0906 #ifdef __cplusplus
0907 }
0908 #endif
0909 
0910 #endif