Fix to issues 250, 245, 244. Added floor and ceiling functions. Refactoring: removed...
[sympy.git] / sympy / core / tests / test_evalf.py
blobcf1cdce95b824c6ee036591e4f475ba678e1d545
1 from sympy import *
2 import py
3 import decimal
5 x = Symbol('x')
7 def eq(a,b):
8 t = decimal.Decimal("0.00000000000000001")
9 return -t < a-b < t
11 def _test_evalf():
12 e = log(3)/log(2)-1
13 assert eq(e.evalf(), decimal.Decimal("0.58496250072115618145373"))
15 # XXX No errors raised for this
16 f = 2*x+2
17 py.test.raises(ValueError, f.evalf)
19 # XXX This assumption no longer raised
20 e = sqrt(Rational(2)+1)/3
21 assert e.is_number
23 def test_bug1():
24 x = Symbol('x')
25 y = x*x
26 assert eq(y.subs(x, Real(3.0)).evalf(), 9)
28 def test_bug2():
29 a = Real(4.)
30 x = a + a