Author mark.dickinson
Recipients mark.dickinson, rhettinger, steven.daprano, tim.peters
Date 2021-11-26.21:33:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637962398.72.0.957827145318.issue45876@roundup.psfhosted.org>
In-reply-to
Content
> Will it suffer the same issues with subnormals on Windows?

No, it should be fine. All the rounding has already happened at the point where ldexp is called, and the result of the ldexp call is exact.

> Is CPython int/int true division guaranteed to be correctly rounded?

Funny you should ask. :-) There's certainly no documented guarantee, and there _is_ a case (documented in comments) where the current code may not return correctly rounded results on machines that use x87: there's a fast path where both numerator and denominator fit into an IEEE 754 double without rounding, and we then do a floating-point division.

But we can't hit that case with the proposed code, since the numerator will always have at least 55 bits, so the fast path is never taken.
History
Date User Action Args
2021-11-26 21:33:18mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, steven.daprano
2021-11-26 21:33:18mark.dickinsonsetmessageid: <1637962398.72.0.957827145318.issue45876@roundup.psfhosted.org>
2021-11-26 21:33:18mark.dickinsonlinkissue45876 messages
2021-11-26 21:33:18mark.dickinsoncreate