[Python-ideas] Python Float Update
u8y7541 The Awesome Person
surya.subbarao1 at gmail.com
Mon Jun 1 04:25:46 CEST 2015
Dear Python Developers:
I will be presenting a modification to the float class, which will improve
its speed and accuracy (reduce floating point errors). This is applicable
because Python uses a numerator and denominator rather than a sign and
mantissa to represent floats.
First, I propose that a float's integer ratio should be accurate. For
example, (1 / 3).as_integer_ratio() should return (1, 3). Instead, it
returns(6004799503160661, 18014398509481984).
Second of all, even though 1 * 3 = 3 (last example), 6004799503160661 * 3
does not equal 18014398509481984. Instead, it equals 1801439850948198**3**,
one less than the value in the ratio. This means the ratio is inaccurate,
as well as completely not simplified.
[image: Inline image 1]
Even if the value displayed for a float is a rounded value, the internal
numerator and denominator should divide to equal to completely accurate
value.
Thanks for considering this improvement!
Sincerely,
u8y7541
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150531/019029a6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pythonfloats.PNG
Type: image/png
Size: 16278 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150531/019029a6/attachment.png>
More information about the Python-ideas
mailing list