- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
cross-posted from: https://lemmy.ml/post/24332731
StolenCross-posted from here: https://fosstodon.org/@foo/113731569632505985
cross-posted from: https://lemmy.ml/post/24332731
StolenCross-posted from here: https://fosstodon.org/@foo/113731569632505985
So you have to remember how it’s represented in the system with how the bits are used? Or you just have to remember some general rules that “if you do that, it’ll fuck up.”
Well, rules like “all integers can be represented up to 2^24” and “10^-38 is where denormalisation happens” are helpful, but I often have to figure out why I got a dodgy value from first principles, floating point is too complicated to solve every problem with 3 general rules.
I wrote a float from string function once which obviously requires the details (intentionally low quality and limited but faster variant since the standard version was way too slow).