Hacker News new | ask | show | jobs
by science404 2485 days ago
Misleading title is misleading...

CPython rounds float values by converting them to string and then back

1 comments

PyPy does it too: https://bitbucket.org/pypy/pypy/src/2fc0a29748362f2a4b99ab57...

Jython instead uses BigDecimal::doubleValue: https://github.com/jythontools/jython/blob/b9ff520f4f6523120...

But as another comment noted, BigDecimal::doubleValue can pull a similar trick: https://news.ycombinator.com/item?id=20818586