On 2010-03-30, John Nagle <na...@animats.com> wrote: > Hex floats are useful because you can get a string representation of > the exact value of a binary floating point number. It should always > be the case that > > float.fromhex(float.hex(x)) == x
Until you try running your program on a machine that represents floats using a radix other than 2,4, or 16. ;) And it works for NaN and Inf too! It would have been nice to have had that 5-6 years ago when I had to write my own pickle/unpickle methods for floating point values so that inf and nan were portable between Windows and Linux. -- Grant Edwards grant.b.edwards Yow! But they went to MARS at around 1953!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list