On Thu, Oct 8, 2020, at 13:12, Steven D'Aprano wrote:
I trimmed it because I didn't understand the relevance. If the denominator is an exact multiple of only 2 and 5, then I think the conversion will be exact if the precision is sufficient.
I wanted the conversion to be exact irrespective of the precision, not least because I'm not sure how to determine what the needed precision would be.
After I looked into the issue more it looks like changing addition and subtraction [which I was wrong about already supporting this] would be too invasive for this concern to justify adding full "exact if possible" support to decimal, but I do think it might be worthwhile to add a lossless decimal equivalent to frexp/ldexp.
On Thu, Oct 8, 2020, at 12:40, Steven D'Aprano wrote:
Related: why doesn't Decimal support direct conversion from Fraction?
That's what I wanted to know - I noticed that it didn't when I was trying to figure out what Guido meant when he alluded to some issue with Decimal in the SupportsString thread, and figured it should be easy enough to add support, then ran into a wall [because I wasn't aware the constructor supported E notation].