Now that I've learned about the hex float format supported by C++ and Java, I wonder if it wouldn't be better to support conversion to and from that format and nothing else.
E.g. >>> math.tohex(3.14) '0x1.91eb851eb851fp+1' >>> math.fromhex('0x1.91eb851eb851fp+1') 3.1400000000000001 >>> BTW I am still hoping to be able the output of the second command to just "3.14" but the tracker issue for that (http://bugs.python.org/issue1580) is stuck on trying to decide whether it's okay to have repr(<float>) occasionally return a string that doesn't convert to the exact same value on another platform. (My preferred approach would ensure that it does convert to the same value on the same platform, because that's how I'd compute it.) Perhaps the existance of an unambiguous hex format that is also interchangeable with Java and C (and presumably C++) would alleviate that concern. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com