This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: float.as_integer_ratio() needs to return fraction in lowest terms
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jyasskin Nosy List: jyasskin, rhettinger
Priority: normal Keywords:

Created on 2008-02-01 19:45 by rhettinger, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tmp_float_conv.py rhettinger, 2008-02-01 19:45 Pure python equivalent
Messages (2)
msg61975 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-02-01 19:45
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)
msg61978 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-02-01 21:30
Fixed in revision 60511.
History
Date User Action Args
2022-04-11 14:56:30adminsetgithub: 46280
2008-02-01 21:31:00rhettingersetstatus: open -> closed
messages: + msg61978
2008-02-01 19:45:53rhettingersetassignee: jyasskin
nosy: + jyasskin
components: + Interpreter Core
versions: + Python 2.6
2008-02-01 19:45:01rhettingercreate