@@ -915,11 +915,8 @@ cdef class Basic(object):
915
915
symengine.as_real_imag(self .thisptr, symengine.outArg(_real), symengine.outArg(_imag))
916
916
return c2py(< rcp_const_basic> _real), c2py(< rcp_const_basic> _imag)
917
917
918
- def n (self , prec = 53 , real = False ):
919
- if real:
920
- return eval_real(self , prec)
921
- else :
922
- return eval (self , prec)
918
+ def n (self , unsigned long prec = 53 , cppbool real = False ):
919
+ return evalf(self , prec, real)
923
920
924
921
evalf = n
925
922
@@ -3994,13 +3991,17 @@ def Xnor(*args):
3994
3991
v.push_back(symengine.rcp_static_cast_Boolean(e_.thisptr))
3995
3992
return c2py(< rcp_const_basic> (symengine.logical_xnor(v)))
3996
3993
3997
- def eval_double ( x ):
3994
+ def evalf ( x , unsigned long bits = 53 , cppbool real = False ):
3998
3995
cdef Basic X = sympify(x)
3999
- return c2py(< rcp_const_basic> (symengine.real_double(symengine.eval_double(deref(X.thisptr)))))
3996
+ return c2py(< rcp_const_basic> (symengine.evalf(deref(X.thisptr), bits, real)))
3997
+
3998
+ def eval_double (x ):
3999
+ warnings.warn(" eval_double is deprecated. Use evalf(..., real=True)" , DeprecationWarning )
4000
+ return evalf(x, 53 , real = True )
4000
4001
4001
4002
def eval_complex_double (x ):
4002
- cdef Basic X = sympify(x )
4003
- return c2py( < rcp_const_basic > (symengine.complex_double(symengine.eval_complex_double(deref(X.thisptr)))) )
4003
+ warnings.warn( " eval_complex_double is deprecated. Use evalf(..., real=False) " , DeprecationWarning )
4004
+ return evalf(x, 53 , real = False )
4004
4005
4005
4006
have_mpfr = False
4006
4007
have_mpc = False
@@ -4010,19 +4011,15 @@ have_llvm = False
4010
4011
4011
4012
IF HAVE_SYMENGINE_MPFR:
4012
4013
have_mpfr = True
4013
- def eval_mpfr (x , long prec ):
4014
- cdef Basic X = sympify(x)
4015
- cdef symengine.mpfr_class a = symengine.mpfr_class(prec)
4016
- symengine.eval_mpfr(a.get_mpfr_t(), deref(X.thisptr), symengine.MPFR_RNDN)
4017
- return c2py(< rcp_const_basic> (symengine.real_mpfr(symengine.std_move_mpfr(a))))
4014
+ def eval_mpfr (x , unsigned long prec ):
4015
+ warnings.warn(" eval_mpfr is deprecated. Use evalf(..., real=True)" , DeprecationWarning )
4016
+ return evalf(x, prec, real = True )
4018
4017
4019
4018
IF HAVE_SYMENGINE_MPC:
4020
4019
have_mpc = True
4021
- def eval_mpc (x , long prec ):
4022
- cdef Basic X = sympify(x)
4023
- cdef symengine.mpc_class a = symengine.mpc_class(prec)
4024
- symengine.eval_mpc(a.get_mpc_t(), deref(X.thisptr), symengine.MPFR_RNDN)
4025
- return c2py(< rcp_const_basic> (symengine.complex_mpc(symengine.std_move_mpc(a))))
4020
+ def eval_mpc (x , unsigned long prec ):
4021
+ warnings.warn(" eval_mpc is deprecated. Use evalf(..., real=False)" , DeprecationWarning )
4022
+ return evalf(x, prec, real = True )
4026
4023
4027
4024
IF HAVE_SYMENGINE_PIRANHA:
4028
4025
have_piranha = True
@@ -4038,22 +4035,12 @@ def require(obj, t):
4038
4035
raise TypeError (" {} required. {} is of type {}" .format(t, obj, type (obj)))
4039
4036
4040
4037
def eval (x , long prec ):
4041
- if prec <= 53 :
4042
- return eval_complex_double(x)
4043
- else :
4044
- IF HAVE_SYMENGINE_MPC:
4045
- return eval_mpc(x, prec)
4046
- ELSE :
4047
- raise ValueError (" Precision %s is only supported with MPC" % prec)
4038
+ warnings.warn(" eval is deprecated. Use evalf(..., real=False)" , DeprecationWarning )
4039
+ return evalf(x, prec, real = False )
4048
4040
4049
4041
def eval_real (x , long prec ):
4050
- if prec <= 53 :
4051
- return eval_double(x)
4052
- else :
4053
- IF HAVE_SYMENGINE_MPFR:
4054
- return eval_mpfr(x, prec)
4055
- ELSE :
4056
- raise ValueError (" Precision %s is only supported with MPFR" % prec)
4042
+ warnings.warn(" eval_real is deprecated. Use evalf(..., real=True)" , DeprecationWarning )
4043
+ return evalf(x, prec, real = True )
4057
4044
4058
4045
def probab_prime_p (n , reps = 25 ):
4059
4046
cdef Basic _n = sympify(n)
0 commit comments