Message135583
> we should check that it's not pow that's at fault here
Some tests on Mac OS X Tiger:
>>> (2.0 ** -255).hex()
'0x1.0000000000000p-255'
=> pow is correct
>>> import ctypes; import ctypes.util, math
>>> libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
>>> clog2=libc.log2
>>> clog2.restype=ctypes.c_double
>>> clog2.argtypes=(ctypes.c_double,)
>>> clog2(2.0**-255)
-254.99999999999997
>>> math.log(2.0**-255) / math.log(2.0)
-255.0
>>> math.log(2.0**-255)
-176.75253104278605
>>> math.log(2.0**-255).hex()
'-0x1.61814bbfb3fb5p+7'
>>> math.log(2.0)
0.6931471805599453
>>> math.log(2.0).hex()
'0x1.62e42fefa39efp-1'
>>> clog2(2.0**-255).hex()
'-0x1.fdfffffffffffp+7'
>>> (math.log(2.0**-255) / math.log(2.0)).hex()
'-0x1.fe00000000000p+7'
clog2() is wrong for 2^-255. |
|
Date |
User |
Action |
Args |
2011-05-09 12:50:47 | vstinner | set | recipients:
+ vstinner, rhettinger, jcea, mark.dickinson, python-dev |
2011-05-09 12:50:47 | vstinner | set | messageid: <1304945447.81.0.388594193202.issue11888@psf.upfronthosting.co.za> |
2011-05-09 12:50:42 | vstinner | link | issue11888 messages |
2011-05-09 12:50:42 | vstinner | create | |
|