<div class="gmail_quote">On Thu, Jun 26, 2008 at 9:28 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">Can you show us what APIs and output formats C99 and Java support?<br></div>
Maybe we can borrow something from there rather than reinventing the<br>
wheel?<br>
<div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br></div><div>Java's toHexString method is documented at:</div><div><br></div><div><a href="http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toHexString(double)">http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toHexString(double)</a><br>
</div><div><br></div><div>It's disadvantage from Python's point of view is that some features are IEEE 754</div><div>specific (e.g. treatment of subnormals, which don't exist for most other floating</div><div>
point types).</div><div><br></div><div>C99s support for hex literals uses a similar format; the standard is less</div><div>specific about the precise output format, but it's still of the form</div><div><br></div><div>
0x1.<fraction>p<exponent></div><div><br></div><div>Incidentally, the funny 'p' for the exponent instead of 'e' is apparently</div><div>there to avoid ambiguity in something like:</div><div><br>
</div><div>0x1e+3</div><div><br></div><div>Mark</div></div>