[New-bugs-announce] [issue25971] Optimize converting float and Decimal to Fraction
Serhiy Storchaka
report at bugs.python.org
Mon Dec 28 17:48:18 EST 2015
New submission from Serhiy Storchaka:
Proposed patch makes following things:
1. Rewrite error messages in float.as_integer_ratio() and Python implementation of Decimal.as_integer_ratio() in more general form, not mentioning as_integer_ratio(), as in C implementation of Decimal.as_integer_ratio().
2. Use Decimal.as_integer_ratio() to convert Decimal to Fraction.
3. Get rid of additional checks in Fraction constructor that raise errors with appropriate messages, since new error messages from as_integer_ratio() are appropriate enough.
This speeds up creating a Fraction from float and Decimal 2 to 3 times.
----------
components: Interpreter Core, Library (Lib)
files: fraction_from_floating.patch
keywords: patch
messages: 257145
nosy: facundobatista, mark.dickinson, rhettinger, serhiy.storchaka, skrah
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize converting float and Decimal to Fraction
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41442/fraction_from_floating.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25971>
_______________________________________
More information about the New-bugs-announce
mailing list