示例#1
0
 def __float__(self):
     return gmp.mpfr_get_d(self._mpfr, gmp.MPFR_RNDN)
示例#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))
示例#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
示例#4
0
文件: mpc.py 项目: sn6uv/gmpy_cffi
 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),
     )