factorial of negative one (-1)

Bj Raz whitequill.bj at gmail.com
Wed Nov 24 04:02:37 EST 2010


On Tue, Nov 2, 2010 at 12:57 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 11/2/2010 6:11 AM, Hrvoje Niksic wrote:
>
>  1.1 .hex()
>>>>>
>>>> '0x1.199999999999ap+0'
>>
>> Here it is immediately obvious that the final digit of the infinite
>> sequence "1.1999..." is rounded from 9 to a.  Printing the number with
>> any more digits would just reveal zeros, as expected.
>>
>> Does anyone know why Python doesn't accept hex float literals in source
>> code?
>>
>
> Assuming that the parser would have no problem with them:
> 1. the format is relatively recent
> 2. you can write float.fromhex('<hex literal>')
> 3. it never occurred to anyone to do so
> 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.
> 5. too easy to confuse in quick reading with normal float literals
> 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.
>
> --
> Terry Jan Reedy
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101124/728d05d4/attachment-0001.html>


More information about the Python-list mailing list