[New-bugs-announce] [issue1996] float.as_integer_ratio() needs to return fraction in lowest terms

Raymond Hettinger report at bugs.python.org
Fri Feb 1 20:45:02 CET 2008


New submission from Raymond Hettinger:

Just before the sign bit is restored, add code with the following effect:

    while not top&1:
        top >>= 1
        e += 1

Tests: 
  math.pi --> (884279719003555, 281474976710656)
  7.5 --> (15, 2)
  0.875 --> (7, 8)

----------
files: tmp_float_conv.py
messages: 61975
nosy: rhettinger
severity: normal
status: open
title: float.as_integer_ratio() needs to return fraction in lowest terms
Added file: http://bugs.python.org/file9344/tmp_float_conv.py

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1996>
__________________________________


More information about the New-bugs-announce mailing list