Re:Python rounds float values by converting them to string a...
by messe on Wednesday August 28, 2019 @10:48AM
(#20820309)
Using native x86_64 instructions isn't portable.
[ Parent
| on HN ]
Re:Python rounds float values by converting them to string a...
by jharger on Wednesday August 28, 2019 @10:52AM
(#20820356)
Why not have optimized versions that use native instructions when available, and then fall back to the portable version when they are not?
Re:Python rounds float values by converting them to string a...
by messe on Wednesday August 28, 2019 @11:21AM
(#20820659)
I'm unsure as to why they don't do that, I suspect it's because nobody using Python has found floating-point rounding to be a bottleneck yet.
Re:Python rounds float values by converting them to string a...
by DoctorOetker on Wednesday August 28, 2019 @02:09PM
(#20822387)
I have encountered situations where irregular rounding became solvable but annoyingly problematic to detect / calculate, in the LANL Earthquake dataset on Kaggle, it had a column with samples and a column with (incorrectly incrementing) sample times that were rounded. In order to create a corrected column, I noticed quite a lot of irregularities in the python rounding (or the underlying mechanism)
I also consider simultaneously deterministic, fast, portable rounding or binary formats to be important for decentralized delegation of computation, say a TrueBit style platform:
Re:Python rounds float values by converting them to string a...
by ChrisLomont on Thursday August 29, 2019 @04:35PM
(#20833400)
It's because Python is slow everywhere, so it's hard to find bottlenecks like this. This method is easily 100x slower than need be. If everything else were well written, this would stand out. Since lots of Python is written like this, none stand out.
Death by 1000 papercuts....
Re:Python rounds float values by converting them to string a...
by joshuamorton on Wednesday August 28, 2019 @01:30PM
(#20821986)
More specifically, cpython generally biases toward simpler implementations. I'd be surprised if there's any custom x86 assembly anywhere in cpython.