1 # basic benchmark for the Float class
5 from sympy
.numerics
import *
6 from sympy
.numerics
.functions
import *
7 from sympy
.numerics
.functions2
import *
14 x = Float(random() * 2.0**randint(-10, 10)) ** 0.5
15 y = Float(random() * 2.0**randint(-10, 10)) ** 0.5
25 tests.append(("OP", f))
30 exec w
.replace("OP", op
)
32 atests
= ["x + y", "x - y", "x * y", "x / y", "x == y",
33 "x < y", "abs(x)", "abs(x)**0.5", "exp(x)", "sin(x)",
39 precs
= [15, 30, 100, 500, 1000]
42 print "\n prec (dps) =",
47 for name
, test
in tests
:
48 print ("%12s" % name
), ":",
51 print "%7s" % test(max(50, 5000//prec
)),
55 print "\nFloat timings (operations / second)"