Add more tests to fixedToFloat(), showing previous commit is broken

Fix coming.
This commit is contained in:
Behdad Esfahbod 2014-12-29 11:30:48 -08:00
parent 97a07ce536
commit db3b2817bf

View File

@ -29,6 +29,14 @@ def fixedToFloat(value, precisionBits):
1.0
>>> fixedToFloat(16383, 14)
0.99994
>>> fixedToFloat(-639, 6)
-9.99
>>> fixedToFloat(-640, 6)
-10.0
>>> fixedToFloat(639, 6)
9.99
>>> fixedToFloat(640, 6)
10.0
"""
if not value: return 0.0
@ -64,6 +72,10 @@ def floatToFixed(value, precisionBits):
16384
>>> floatToFixed(1, 14)
16384
>>> floatToFixed(-1.0, 14)
-16384
>>> floatToFixed(-1, 14)
-16384
>>> floatToFixed(0, 14)
0
"""