[Python-Dev] [Python-checkins] r64424 - in python/trunk:Include/object.h Lib/test/test_sys.py Misc/NEWSObjects/intobject.c Objects/longobject.c Objects/typeobject.cPython/bltinmodule.c

Mark Dickinson dickinsm at gmail.com
Thu Jun 26 22:55:54 CEST 2008


On Thu, Jun 26, 2008 at 9:28 PM, Guido van Rossum <guido at python.org> wrote:

> Can you show us what APIs and output formats C99 and Java support?
> Maybe we can borrow something from there rather than reinventing the
> wheel?
>

Java's toHexString method is documented at:

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toHexString(double)

It's disadvantage from Python's point of view is that some features are IEEE
754
specific (e.g. treatment of subnormals, which don't exist for most other
floating
point types).

C99s support for hex literals uses a similar format;  the standard is less
specific about the precise output format, but it's still of the form

0x1.<fraction>p<exponent>

Incidentally, the funny 'p' for the exponent instead of 'e' is apparently
there to avoid ambiguity in something like:

0x1e+3

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080626/5c5e70fc/attachment.htm>


More information about the Python-Dev mailing list