Author tim.peters
Recipients mark.dickinson, rhettinger, steven.daprano, tim.peters
Date 2021-11-26.21:43:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Objects/longobject.c::long_true_divide() uses ldexp() internally.
> Will it suffer the same issues with subnormals on Windows?

Doesn't look like it will. In context, looks like it's ensuring that ldexp can only lose trailing 0 bits, so that _whatever_ ldexp does in the way of rounding is irrelevant. But it's not doing this because of Windows - it's to prevent "double-rounding" errors regardless of platform.

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

If there's some promise of that in the docs, I don't know where it is. But the code clearly intends to strive for correct rounding. Ironically, PEP 238 guarantees that if it is correctly rounded, that's purely by accident ;-) :

True division for ints and longs will convert the arguments to float and then apply a float division. That is, even 2/1 will return a float 

But i/j is emphatically not implemented via float(i)/float(j).
Date User Action Args
2021-11-26 21:43:28tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, steven.daprano
2021-11-26 21:43:28tim.peterssetmessageid: <>
2021-11-26 21:43:28tim.peterslinkissue45876 messages
2021-11-26 21:43:28tim.peterscreate