On Tue, Nov 2, 2010 at 12:57 PM, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 11/2/2010 6:11 AM, Hrvoje Niksic wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1.1 .hex()<br>
</blockquote></blockquote></blockquote>
'0x1.199999999999ap+0'<br>
<br>
Here it is immediately obvious that the final digit of the infinite<br>
sequence "1.1999..." is rounded from 9 to a.  Printing the number with<br>
any more digits would just reveal zeros, as expected.<br>
<br>
Does anyone know why Python doesn't accept hex float literals in source<br>
code?<br>
</blockquote>
<br></div>
Assuming that the parser would have no problem with them:<br>
1. the format is relatively recent<br>
2. you can write float.fromhex('<hex literal>')<br>
3. it never occurred to anyone to do so<br>
4. literals are values supplied by the programmer; hex float values are rare and when they do occur, they are usually the stored output of a previous .hex() in Python or similar in other languages.<br>
5. too easy to confuse in quick reading with normal float literals<br>
6. the format is a bit weird and too esoteric for most programmers; they should not be part of the basic syntax that everyone has to learn; someone who reads float.fromhex(something) can look it up.<br><font color="#888888">
<br>
-- <br>
Terry Jan Reedy</font><div><div></div><div class="h5"><br>
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div>I have just realized that there is a program called PyNum that would be of great help to me, but I can't seem to figure out how to use it after installing, or how to build it with Python 2.7