1 module deimos.mpfr; 2 3 import deimos.gmp; 4 import core.stdc.stdio : FILE; 5 import core.stdc.stdarg : va_list; 6 import core.stdc.config : c_long, c_ulong; 7 8 nothrow extern(C): 9 10 enum mpfr_rnd_t { 11 MPFR_RNDN=0, /* round to nearest, with ties to even */ 12 MPFR_RNDZ, /* round toward zero */ 13 MPFR_RNDU, /* round toward +Inf */ 14 MPFR_RNDD, /* round toward -Inf */ 15 MPFR_RNDA, /* round away from zero */ 16 MPFR_RNDF, /* faithful rounding (not implemented yet) */ 17 MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */ 18 } 19 20 // Types 21 alias mpfr_prec_t = c_long; 22 alias mpfr_uprec_t = c_ulong; 23 alias mpfr_sign_t = int; 24 alias mpfr_exp_t = c_long; 25 alias mpfr_uexp_t = c_ulong; 26 alias intmax_t = mpfr_exp_t; 27 alias uintmax_t = mpfr_uexp_t; 28 29 // Structs 30 struct __mpfr_struct { 31 mpfr_prec_t _mpfr_prec; 32 mpfr_sign_t _mpfr_sign; 33 mpfr_exp_t _mpfr_exp; 34 mp_limb_t *_mpfr_d; 35 } 36 37 alias mpfr_t = __mpfr_struct; 38 alias mpfr_ptr = __mpfr_struct*; 39 40 // Initialization Functions 41 42 void mpfr_init2 (ref mpfr_t x, mpfr_prec_t prec); 43 // void mpfr_inits2 (mpfr_prec_t prec, ref mpfr_t x, ...); 44 void mpfr_clear (ref mpfr_t x); 45 // void mpfr_clears (ref mpfr_t x, ...); 46 void mpfr_init (ref mpfr_t x); 47 // void mpfr_inits (ref mpfr_t x, ...); 48 void mpfr_set_default_prec (mpfr_prec_t prec); 49 mpfr_prec_t mpfr_get_default_prec (); 50 void mpfr_set_prec (ref mpfr_t x, mpfr_prec_t prec); 51 mpfr_prec_t mpfr_get_prec (ref const mpfr_t x); 52 53 // Assignment Functions 54 55 int mpfr_set (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 56 int mpfr_set_ui (ref mpfr_t rop, c_ulong op, mpfr_rnd_t rnd); 57 int mpfr_set_si (ref mpfr_t rop, c_long op, mpfr_rnd_t rnd); 58 int mpfr_set_uj (ref mpfr_t rop, uintmax_t op, mpfr_rnd_t rnd); 59 int mpfr_set_sj (ref mpfr_t rop, intmax_t op, mpfr_rnd_t rnd); 60 int mpfr_set_flt (ref mpfr_t rop, float op, mpfr_rnd_t rnd); 61 int mpfr_set_d (ref mpfr_t rop, double op, mpfr_rnd_t rnd); 62 int mpfr_set_ld (ref mpfr_t rop, real op, mpfr_rnd_t rnd); 63 // int mpfr_set_decimal64 (ref mpfr_t rop, _Decimal64 op, mpfr_rnd_t rnd); 64 int mpfr_set_z (ref mpfr_t rop, ref mpz_t op, mpfr_rnd_t rnd); 65 int mpfr_set_q (ref mpfr_t rop, ref mpq_t op, mpfr_rnd_t rnd); 66 int mpfr_set_f (ref mpfr_t rop, ref mpf_t op, mpfr_rnd_t rnd); 67 int mpfr_set_ui_2exp (ref mpfr_t rop, c_ulong op, mpfr_exp_t e, mpfr_rnd_t rnd); 68 int mpfr_set_si_2exp (ref mpfr_t rop, c_long op, mpfr_exp_t e, mpfr_rnd_t rnd); 69 int mpfr_set_uj_2exp (ref mpfr_t rop, uintmax_t op, intmax_t e, mpfr_rnd_t rnd); 70 int mpfr_set_sj_2exp (ref mpfr_t rop, intmax_t op, intmax_t e, mpfr_rnd_t rnd); 71 int mpfr_set_z_2exp (ref mpfr_t rop, mpz_t op, mpfr_exp_t e, mpfr_rnd_t rnd); 72 int mpfr_set_str (ref mpfr_t rop, const(char)*s, int base, mpfr_rnd_t rnd); 73 int mpfr_strtofr (ref mpfr_t rop, const(char)*nptr, char **endptr, int base, mpfr_rnd_t rnd); 74 void mpfr_set_nan (ref mpfr_t x); 75 void mpfr_set_inf (ref mpfr_t x, int sign); 76 void mpfr_set_zero (ref mpfr_t x, int sign); 77 void mpfr_swap (ref mpfr_t x, ref mpfr_t y); 78 int mpfr_init_set_str (ref mpfr_t x, const(char)*s, int base, mpfr_rnd_t rnd); 79 80 // Conversion Functions 81 82 float mpfr_get_flt (ref const mpfr_t op, mpfr_rnd_t rnd); 83 double mpfr_get_d (ref const mpfr_t op, mpfr_rnd_t rnd); 84 real mpfr_get_ld (ref const mpfr_t op, mpfr_rnd_t rnd); 85 // _Decimal64 mpfr_get_decimal64 (ref const mpfr_t op, mpfr_rnd_t rnd); 86 c_long mpfr_get_si (ref const mpfr_t op, mpfr_rnd_t rnd); 87 c_ulong mpfr_get_ui (ref const mpfr_t op, mpfr_rnd_t rnd); 88 intmax_t mpfr_get_sj (ref const mpfr_t op, mpfr_rnd_t rnd); 89 uintmax_t mpfr_get_uj (ref const mpfr_t op, mpfr_rnd_t rnd); 90 double mpfr_get_d_2exp (c_long *exp, ref const mpfr_t op, mpfr_rnd_t rnd); 91 real mpfr_get_ld_2exp (c_long *exp, ref const mpfr_t op, mpfr_rnd_t rnd); 92 int mpfr_frexp (mpfr_exp_t *exp, ref mpfr_t y, ref mpfr_t x, mpfr_rnd_t rnd); 93 mpfr_exp_t mpfr_get_z_2exp (mpz_t rop, ref const mpfr_t op); 94 int mpfr_get_z (mpz_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 95 int mpfr_get_f (mpf_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 96 char * mpfr_get_str (char *str, mpfr_exp_t *expptr, int b, size_t n, ref const mpfr_t op, mpfr_rnd_t rnd); 97 void mpfr_free_str (char *str); 98 int mpfr_fits_uc_long_p (ref const mpfr_t op, mpfr_rnd_t rnd); 99 int mpfr_fits_sc_long_p (ref const mpfr_t op, mpfr_rnd_t rnd); 100 int mpfr_fits_uint_p (ref const mpfr_t op, mpfr_rnd_t rnd); 101 int mpfr_fits_sint_p (ref const mpfr_t op, mpfr_rnd_t rnd); 102 int mpfr_fits_ushort_p (ref const mpfr_t op, mpfr_rnd_t rnd); 103 int mpfr_fits_sshort_p (ref const mpfr_t op, mpfr_rnd_t rnd); 104 int mpfr_fits_uintmax_p (ref const mpfr_t op, mpfr_rnd_t rnd); 105 int mpfr_fits_intmax_p (ref const mpfr_t op, mpfr_rnd_t rnd); 106 107 // Basic Arithmetic Functions 108 109 int mpfr_add (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 110 int mpfr_add_ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 111 int mpfr_add_si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 112 int mpfr_add_d (ref mpfr_t rop, ref const mpfr_t op1, double op2, mpfr_rnd_t rnd); 113 int mpfr_add_z (ref mpfr_t rop, ref const mpfr_t op1, mpz_t op2, mpfr_rnd_t rnd); 114 int mpfr_add_q (ref mpfr_t rop, ref const mpfr_t op1, mpq_t op2, mpfr_rnd_t rnd); 115 int mpfr_sub (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 116 int mpfr_ui_sub (ref mpfr_t rop, c_ulong op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 117 int mpfr_sub_ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 118 int mpfr_si_sub (ref mpfr_t rop, c_long op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 119 int mpfr_sub_si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 120 int mpfr_d_sub (ref mpfr_t rop, double op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 121 int mpfr_sub_d (ref mpfr_t rop, ref const mpfr_t op1, double op2, mpfr_rnd_t rnd); 122 int mpfr_z_sub (ref mpfr_t rop, mpz_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 123 int mpfr_sub_z (ref mpfr_t rop, ref const mpfr_t op1, mpz_t op2, mpfr_rnd_t rnd); 124 int mpfr_sub_q (ref mpfr_t rop, ref const mpfr_t op1, mpq_t op2, mpfr_rnd_t rnd); 125 int mpfr_mul (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 126 int mpfr_mul_ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 127 int mpfr_mul_si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 128 int mpfr_mul_d (ref mpfr_t rop, ref const mpfr_t op1, double op2, mpfr_rnd_t rnd); 129 int mpfr_mul_z (ref mpfr_t rop, ref const mpfr_t op1, mpz_t op2, mpfr_rnd_t rnd); 130 int mpfr_mul_q (ref mpfr_t rop, ref const mpfr_t op1, mpq_t op2, mpfr_rnd_t rnd); 131 int mpfr_sqr (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 132 int mpfr_div (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 133 int mpfr_ui_div (ref mpfr_t rop, c_ulong op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 134 int mpfr_div_ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 135 int mpfr_si_div (ref mpfr_t rop, c_long op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 136 int mpfr_div_si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 137 int mpfr_d_div (ref mpfr_t rop, double op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 138 int mpfr_div_d (ref mpfr_t rop, ref const mpfr_t op1, double op2, mpfr_rnd_t rnd); 139 int mpfr_div_z (ref mpfr_t rop, ref const mpfr_t op1, mpz_t op2, mpfr_rnd_t rnd); 140 int mpfr_div_q (ref mpfr_t rop, ref const mpfr_t op1, mpq_t op2, mpfr_rnd_t rnd); 141 int mpfr_sqrt (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 142 int mpfr_sqrt_ui (ref mpfr_t rop, c_ulong op, mpfr_rnd_t rnd); 143 int mpfr_rec_sqrt (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 144 int mpfr_cbrt (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 145 int mpfr_root (ref mpfr_t rop, ref const mpfr_t op, c_ulong k, mpfr_rnd_t rnd); 146 int mpfr_pow (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 147 int mpfr_pow_ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 148 int mpfr_pow_si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 149 int mpfr_pow_z (ref mpfr_t rop, ref const mpfr_t op1, mpz_t op2, mpfr_rnd_t rnd); 150 int mpfr_ui_pow_ui (ref mpfr_t rop, c_ulong op1, c_ulong op2, mpfr_rnd_t rnd); 151 int mpfr_ui_pow (ref mpfr_t rop, c_ulong op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 152 int mpfr_neg (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 153 int mpfr_abs (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 154 int mpfr_dim (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 155 int mpfr_mul_2ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 156 int mpfr_mul_2si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 157 int mpfr_div_2ui (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 158 int mpfr_div_2si (ref mpfr_t rop, ref const mpfr_t op1, c_long op2, mpfr_rnd_t rnd); 159 160 // Comparison Functions 161 162 int mpfr_cmp (ref const mpfr_t op1, ref const mpfr_t op2); 163 int mpfr_cmp_ui (ref const mpfr_t op1, c_ulong op2); 164 int mpfr_cmp_si (ref const mpfr_t op1, c_long op2); 165 int mpfr_cmp_d (ref const mpfr_t op1, double op2); 166 int mpfr_cmp_ld (ref const mpfr_t op1, real op2); 167 int mpfr_cmp_z (ref const mpfr_t op1, mpz_t op2); 168 int mpfr_cmp_q (ref const mpfr_t op1, mpq_t op2); 169 int mpfr_cmp_f (ref const mpfr_t op1, mpf_t op2); 170 int mpfr_cmp_ui_2exp (ref const mpfr_t op1, c_ulong op2, mpfr_exp_t e); 171 int mpfr_cmp_si_2exp (ref const mpfr_t op1, c_long op2, mpfr_exp_t e); 172 int mpfr_cmpabs (ref const mpfr_t op1, ref const mpfr_t op2); 173 int mpfr_nan_p (ref const mpfr_t op); 174 int mpfr_inf_p (ref const mpfr_t op); 175 int mpfr_number_p (ref const mpfr_t op); 176 int mpfr_zero_p (ref const mpfr_t op); 177 int mpfr_regular_p (ref const mpfr_t op); 178 int mpfr_greater_p (ref const mpfr_t op1, ref const mpfr_t op2); 179 int mpfr_greaterequal_p (ref const mpfr_t op1, ref const mpfr_t op2); 180 int mpfr_less_p (ref const mpfr_t op1, ref const mpfr_t op2); 181 int mpfr_lessequal_p (ref const mpfr_t op1, ref const mpfr_t op2); 182 int mpfr_equal_p (ref const mpfr_t op1, ref const mpfr_t op2); 183 int mpfr_lessgreater_p (ref const mpfr_t op1, ref const mpfr_t op2); 184 int mpfr_unordered_p (ref const mpfr_t op1, ref const mpfr_t op2); 185 186 // Special Functions 187 188 int mpfr_log (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 189 int mpfr_log2 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 190 int mpfr_log10 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 191 int mpfr_exp (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 192 int mpfr_exp2 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 193 int mpfr_exp10 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 194 int mpfr_cos (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 195 int mpfr_sin (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 196 int mpfr_tan (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 197 int mpfr_sin_cos (ref mpfr_t sop, ref mpfr_t cop, ref const mpfr_t op, mpfr_rnd_t rnd); 198 int mpfr_sec (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 199 int mpfr_csc (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 200 int mpfr_cot (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 201 int mpfr_acos (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 202 int mpfr_asin (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 203 int mpfr_atan (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 204 int mpfr_atan2 (ref mpfr_t rop, ref mpfr_t y, ref mpfr_t x, mpfr_rnd_t rnd); 205 int mpfr_cosh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 206 int mpfr_sinh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 207 int mpfr_tanh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 208 int mpfr_sinh_cosh (ref mpfr_t sop, ref mpfr_t cop, ref const mpfr_t op, mpfr_rnd_t rnd); 209 int mpfr_sech (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 210 int mpfr_csch (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 211 int mpfr_coth (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 212 int mpfr_acosh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 213 int mpfr_asinh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 214 int mpfr_atanh (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 215 int mpfr_fac_ui (ref mpfr_t rop, c_ulong op, mpfr_rnd_t rnd); 216 int mpfr_log1p (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 217 int mpfr_expm1 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 218 int mpfr_eint (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 219 int mpfr_li2 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 220 int mpfr_gamma (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 221 int mpfr_lngamma (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 222 int mpfr_lgamma (ref mpfr_t rop, int *signp, ref const mpfr_t op, mpfr_rnd_t rnd); 223 int mpfr_digamma (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 224 int mpfr_zeta (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 225 int mpfr_zeta_ui (ref mpfr_t rop, c_ulong op, mpfr_rnd_t rnd); 226 int mpfr_erf (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 227 int mpfr_erfc (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 228 int mpfr_j0 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 229 int mpfr_j1 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 230 int mpfr_jn (ref mpfr_t rop, c_long n, ref const mpfr_t op, mpfr_rnd_t rnd); 231 int mpfr_y0 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 232 int mpfr_y1 (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 233 int mpfr_yn (ref mpfr_t rop, c_long n, ref const mpfr_t op, mpfr_rnd_t rnd); 234 int mpfr_fma (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, ref const mpfr_t op3, mpfr_rnd_t rnd); 235 int mpfr_fms (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, ref const mpfr_t op3, mpfr_rnd_t rnd); 236 int mpfr_agm (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 237 int mpfr_hypot (ref mpfr_t rop, ref mpfr_t x, ref mpfr_t y, mpfr_rnd_t rnd); 238 int mpfr_ai (ref mpfr_t rop, ref mpfr_t x, mpfr_rnd_t rnd); 239 int mpfr_const_log2 (ref mpfr_t rop, mpfr_rnd_t rnd); 240 int mpfr_const_pi (ref mpfr_t rop, mpfr_rnd_t rnd); 241 int mpfr_const_euler (ref mpfr_t rop, mpfr_rnd_t rnd); 242 int mpfr_const_catalan (ref mpfr_t rop, mpfr_rnd_t rnd); 243 void mpfr_free_cache (); 244 int mpfr_sum (ref mpfr_t rop, const mpfr_ptr tab, c_long n, mpfr_rnd_t rnd); 245 246 // Input and Output Functions 247 248 size_t __gmpfr_out_str (FILE *stream, int base, size_t n, ref const mpfr_t op, mpfr_rnd_t rnd); 249 alias mpfr_out_str = __gmpfr_out_str; 250 251 size_t __gmpfr_inp_str (ref mpfr_t rop, FILE *stream, int base, mpfr_rnd_t rnd); 252 alias mpfr_inp_str = __gmpfr_inp_str; 253 254 // Functions 255 256 int mpfr_fprintf (FILE *stream, const(char)*tmpl, ...); 257 int mpfr_vfprintf (FILE *stream, const(char)*tmpl, va_list ap); 258 int mpfr_printf (const(char)*tmpl, ...); 259 int mpfr_vprintf (const(char)*tmpl, va_list ap); 260 int mpfr_sprintf (char *buf, const(char)*tmpl, ...); 261 int mpfr_vsprintf (char *buf, const(char)*tmpl, va_list ap); 262 int mpfr_snprintf (char *buf, size_t n, const(char)*tmpl, ...); 263 int mpfr_vsnprintf (char *buf, size_t n, const(char)*tmpl, va_list ap); 264 int mpfr_asprintf (char **str, const(char)*tmpl, ...); 265 int mpfr_vasprintf (char **str, const(char)*tmpl, va_list ap); 266 267 // Integer and Remainder Related Functions 268 269 int mpfr_rint (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 270 int mpfr_ceil (ref mpfr_t rop, ref const mpfr_t op); 271 int mpfr_floor (ref mpfr_t rop, ref const mpfr_t op); 272 int mpfr_round (ref mpfr_t rop, ref const mpfr_t op); 273 int mpfr_trunc (ref mpfr_t rop, ref const mpfr_t op); 274 int mpfr_rint_ceil (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 275 int mpfr_rint_floor (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 276 int mpfr_rint_round (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 277 int mpfr_rint_trunc (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 278 int mpfr_frac (ref mpfr_t rop, ref const mpfr_t op, mpfr_rnd_t rnd); 279 int mpfr_modf (ref mpfr_t iop, ref mpfr_t fop, ref const mpfr_t op, mpfr_rnd_t rnd); 280 int mpfr_fmod (ref mpfr_t r, ref mpfr_t x, ref mpfr_t y, mpfr_rnd_t rnd); 281 int mpfr_remainder (ref mpfr_t r, ref mpfr_t x, ref mpfr_t y, mpfr_rnd_t rnd); 282 int mpfr_remquo (ref mpfr_t r, c_long* q, ref mpfr_t x, ref mpfr_t y, mpfr_rnd_t rnd); 283 int mpfr_integer_p (ref const mpfr_t op); 284 285 // Rounding Related Functions 286 287 void mpfr_set_default_rounding_mode (mpfr_rnd_t rnd); 288 mpfr_rnd_t mpfr_get_default_rounding_mode (); 289 int mpfr_prec_round (ref mpfr_t x, mpfr_prec_t prec, mpfr_rnd_t rnd); 290 int mpfr_can_round (ref mpfr_t b, mpfr_exp_t err, mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec); 291 mpfr_prec_t mpfr_min_prec (ref mpfr_t x); 292 const(char)* mpfr_print_rnd_mode (mpfr_rnd_t rnd); 293 294 // Miscellaneous Functions 295 296 void mpfr_nexttoward (ref mpfr_t x, ref mpfr_t y); 297 void mpfr_nextabove (ref mpfr_t x); 298 void mpfr_nextbelow (ref mpfr_t x); 299 int mpfr_min (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 300 int mpfr_max (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 301 // int mpfr_urandomb (ref mpfr_t rop, gmp_randstate_t state); 302 // int mpfr_urandom (ref mpfr_t rop, gmp_randstate_t state, mpfr_rnd_t rnd); 303 // int mpfr_grandom (ref mpfr_t rop1, ref mpfr_t rop2, gmp_randstate_t state, mpfr_rnd_t rnd); 304 mpfr_exp_t mpfr_get_exp (ref mpfr_t x); 305 int mpfr_set_exp (ref mpfr_t x, mpfr_exp_t e); 306 int mpfr_signbit (ref const mpfr_t op); 307 int mpfr_setsign (ref mpfr_t rop, ref const mpfr_t op, int s, mpfr_rnd_t rnd); 308 int mpfr_copysign (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 309 const(char)* mpfr_get_version (); 310 const(char)* mpfr_get_patches (); 311 int mpfr_buildopt_tls_p (); 312 int mpfr_buildopt_decimal_p (); 313 int mpfr_buildopt_gmpinternals_p (); 314 const(char)* mpfr_buildopt_tune_case (); 315 316 // Exception Related Functions 317 318 mpfr_exp_t mpfr_get_emin (); 319 mpfr_exp_t mpfr_get_emax (); 320 int mpfr_set_emin (mpfr_exp_t exp); 321 int mpfr_set_emax (mpfr_exp_t exp); 322 mpfr_exp_t mpfr_get_emin_min (); 323 mpfr_exp_t mpfr_get_emin_max (); 324 mpfr_exp_t mpfr_get_emax_min (); 325 mpfr_exp_t mpfr_get_emax_max (); 326 int mpfr_check_range (ref mpfr_t x, int t, mpfr_rnd_t rnd); 327 int mpfr_subnormalize (ref mpfr_t x, int t, mpfr_rnd_t rnd); 328 void mpfr_clear_underflow (); 329 void mpfr_clear_overflow (); 330 void mpfr_clear_divby0 (); 331 void mpfr_clear_nanflag (); 332 void mpfr_clear_inexflag (); 333 void mpfr_clear_erangeflag (); 334 void mpfr_set_underflow (); 335 void mpfr_set_overflow (); 336 void mpfr_set_divby0 (); 337 void mpfr_set_nanflag (); 338 void mpfr_set_inexflag (); 339 void mpfr_set_erangeflag (); 340 void mpfr_clear_flags (); 341 int mpfr_underflow_p (); 342 int mpfr_overflow_p (); 343 int mpfr_divby0_p (); 344 int mpfr_nanflag_p (); 345 int mpfr_inexflag_p (); 346 int mpfr_erangeflag_p (); 347 348 // Compatibility With MPF 349 350 void mpfr_set_prec_raw (ref mpfr_t x, mpfr_prec_t prec); 351 int mpfr_eq (ref const mpfr_t op1, ref const mpfr_t op2, c_ulong op3); 352 void mpfr_reldiff (ref mpfr_t rop, ref const mpfr_t op1, ref const mpfr_t op2, mpfr_rnd_t rnd); 353 int mpfr_mul_2exp (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 354 int mpfr_div_2exp (ref mpfr_t rop, ref const mpfr_t op1, c_ulong op2, mpfr_rnd_t rnd); 355 356 // Custom Interface 357 358 size_t mpfr_custom_get_size (mpfr_prec_t prec); 359 void mpfr_custom_init (void *significand, mpfr_prec_t prec); 360 void mpfr_custom_init_set (ref mpfr_t x, int kind, mpfr_exp_t exp, mpfr_prec_t prec, void *significand); 361 int mpfr_custom_get_kind (ref mpfr_t x); 362 void * mpfr_custom_get_significand (ref mpfr_t x); 363 mpfr_exp_t mpfr_custom_get_exp (ref mpfr_t x); 364 void mpfr_custom_move (ref mpfr_t x, void *new_position); 365