Back to index

python3.2  3.2.2
Functions | Variables
test.double_const Namespace Reference

Functions

def check_ok

Variables

float PI = 3.14159265358979324
float TWOPI = 6.28318530717958648
string PI_str = "3.14159265358979324"
string TWOPI_str = "6.28318530717958648"

Function Documentation

def test.double_const.check_ok (   x,
  x_str 
)

Definition at line 19 of file double_const.py.

00019 
00020 def check_ok(x, x_str):
00021     assert x > 0.0
00022     x2 = eval(x_str)
00023     assert x2 > 0.0
00024     diff = abs(x - x2)
00025     # If diff is no larger than 3 ULP (wrt x2), then diff/8 is no larger
00026     # than 0.375 ULP, so adding diff/8 to x2 should have no effect.
00027     if x2 + (diff / 8.) != x2:
00028         raise TestFailed("Manifest const %s lost too much precision " % x_str)
00029 
00030 check_ok(PI, PI_str)
00031 check_ok(TWOPI, TWOPI_str)

Variable Documentation

float test.double_const.PI = 3.14159265358979324

Definition at line 12 of file double_const.py.

string test.double_const.PI_str = "3.14159265358979324"

Definition at line 15 of file double_const.py.

float test.double_const.TWOPI = 6.28318530717958648

Definition at line 13 of file double_const.py.

string test.double_const.TWOPI_str = "6.28318530717958648"

Definition at line 16 of file double_const.py.