[issue9829] Unexpected Fraction.from_float() Behavior

R. David Murray report at bugs.python.org
Sat Sep 11 16:00:04 CEST 2010


R. David Murray <rdmurray at bitdance.com> added the comment:

Please read about floating point arithmetic in the tutorial:

   http://docs.python.org/tutorial/floatingpoint.html

Also observe that this works:

    >>> Fraction(Decimal('1.23'))
    Fraction(123, 100)

So yes, it is a limitation in how floating point is represented...in all languages and platforms that use binary floating point.

----------
nosy: +r.david.murray
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9829>
_______________________________________


More information about the Python-bugs-list mailing list