1 /*
2     Copyright (C) 2009 William Hart
3     Copyright (C) 2014 Abhinav Baid
4 
5     This file is part of FLINT.
6 
7     FLINT is free software: you can redistribute it and/or modify it under
8     the terms of the GNU Lesser General Public License (LGPL) as published
9     by the Free Software Foundation; either version 2.1 of the License, or
10     (at your option) any later version.  See <http://www.gnu.org/licenses/>.
11 */
12 
13 #if defined(_WIN64) || defined(__mips64)
14 #include <stdint.h> /* to enable mpfr_set_sj in mpfr.h */
15 #endif
16 #include <gmp.h>
17 #if defined( _WIN64) && defined( _MSC_MPIR_VERSION ) && __MPIR_RELEASE >= 20700
18 #  if defined( _MSC_VER ) && _MSC_VER >= 1600
19 #    include <stdint.h>
20 #    include <mpfr.h>
21 #    define mpfr_set_si mpfr_set_sj
22 #  endif
23 #endif
24 #include "flint.h"
25 #include "ulong_extras.h"
26 #include "fmpz.h"
27 
28 void
fmpz_get_mpfr(mpfr_t x,const fmpz_t f,mpfr_rnd_t rnd)29 fmpz_get_mpfr(mpfr_t x, const fmpz_t f, mpfr_rnd_t rnd)
30 {
31     if (!COEFF_IS_MPZ(*f))
32 #if defined(_WIN64) || defined(__mips64)
33         mpfr_set_sj(x, *f, rnd);
34 #else
35         mpfr_set_si(x, *f, rnd);    /* set x to small value */
36 #endif
37     else
38         mpfr_set_z(x, COEFF_TO_PTR(*f), rnd);   /* set x to large value */
39 }
40