News for hackers. Stuff that matters.
Re:Python rounds float values by converting them to string a... by ben509 on Wednesday August 28, 2019 @11:05AM (#20820499)
Related to that problem, a major source of confusion with IEEE floats is that languages go to great lengths[1] to present them as decimals and hide the underlying binary denominator. Even when you know they're binary internally, it throws you off.

High level languages are also annoying in that they don't provide great support for working with them as binary denominated rationals, e.g. there's no round_base2 in python, and there's no hex float representation in printf.

[1]: https://news.ycombinator.com/item?id=10915182

Re:Python rounds float values by converting them to string a... by mark-r on Wednesday August 28, 2019 @11:23AM (#20820675)
Python doesn't support hex float in printf, but it does give you an easy way to do the conversion: x.hex()