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.

Author joncle
Recipients joncle
Date 2012-06-22.11:51:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340365912.14.0.935631231431.issue15136@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not a numeric expert but I was looking at a post on S/O which related to converting a Fraction to a certain amount of decimal places. I've had a hunt on the tracker but couldn't find anything relevant, but if I've missed it, I apologise.

# F=Fraction, D=Decimal classes

If I try num = D( F(5, 7) )

I get: TypeError: Cannot convert Fraction(5, 7) to Decimal

So I do:

>>> D(f.numerator) / D(f.denominator)
Decimal('0.7142857142857142857142857143')

Which I think is the correct result?

I guess my question is - should Decimal do this implicitly for Fraction?
History
Date User Action Args
2012-06-22 11:51:52jonclesetrecipients: + joncle
2012-06-22 11:51:52jonclesetmessageid: <1340365912.14.0.935631231431.issue15136@psf.upfronthosting.co.za>
2012-06-22 11:51:51jonclelinkissue15136 messages
2012-06-22 11:51:51jonclecreate