Example #1
0
 def __float__(self):
     return gmp.mpfr_get_d(self._mpfr, gmp.MPFR_RNDN)
Example #2
0
 def __complex__(self):
     return complex(
         gmp.mpfr_get_d(gmp.mpc_realref(self._mpc), gmp.MPFR_RNDN),
         gmp.mpfr_get_d(gmp.mpc_imagref(self._mpc), gmp.MPFR_RNDN))
Example #3
0
 def __trunc__(self):
     tmp_mpfr = _new_mpfr()
     gmp.mpfr_trunc(tmp_mpfr, self._mpfr)
     res = gmp.mpfr_get_d(tmp_mpfr, gmp.MPFR_RNDN)
     _del_mpfr(tmp_mpfr)
     return res
Example #4
0
 def __complex__(self):
     return complex(
         gmp.mpfr_get_d(gmp.mpc_realref(self._mpc), gmp.MPFR_RNDN),
         gmp.mpfr_get_d(gmp.mpc_imagref(self._mpc), gmp.MPFR_RNDN),
     )