Routine to call mpfr function with proper rounding
| 49 | |
| 50 | /// Routine to call mpfr function with proper rounding |
| 51 | forceinline double |
| 52 | invoke_mpfr(FloatNum x, mpfr_func f, mp_rnd_t r) { |
| 53 | mpfr_t xx; |
| 54 | mpfr_init_set_d(xx, x, GMP_RNDN); |
| 55 | f(xx, xx, r); |
| 56 | FloatNum res = mpfr_get_d(xx, r); |
| 57 | mpfr_clear(xx); |
| 58 | return res; |
| 59 | } |
| 60 | |
| 61 | /// Define mpfr functions with proper rounding |
| 62 | #define GECODE_GENR_FUNC(name) \ |