Message407097
> 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:28 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, steven.daprano |
2021-11-26 21:43:28 | tim.peters | set | messageid: <1637963008.57.0.812258670353.issue45876@roundup.psfhosted.org> |
2021-11-26 21:43:28 | tim.peters | link | issue45876 messages |
2021-11-26 21:43:28 | tim.peters | create | |
|