https://en.wikipedia.org/wiki/IEEE_754
cross-posted from: https://lemmy.ml/post/24332731
StolenCross-posted from here: https://fosstodon.org/@foo/113731569632505985
https://en.wikipedia.org/wiki/IEEE_754
cross-posted from: https://lemmy.ml/post/24332731
StolenCross-posted from here: https://fosstodon.org/@foo/113731569632505985
7 Comments
finallymadeanaccount@lemmy.world · 12 pts · 30d
Son of a bitch. Actual fifteen seconds of real laughter. Maybe even twenty.
the_beber@feddit.org · 9 pts · 30d
And sometimes it seems irrational.
AnnaFrankfurter@lemmy.ml · 8 pts · 30d
And other times 0.1 + 0.2 = 0.3000004
cypherpunks@lemmy.ml · 5 pts · 30d
::: spoiler 0.1 + 0.2 != 0.3000004
You're off by 0.000000399999999955991114575226674787700176239013671875
(0.1 + 0.2 is actually 0.3000000000000000444089209850062616169452667236328125) :::
pleiades@lemmy.ml · 1 pts · 29d
Funny meme, never got why they used a bias instead of two's complement for the exponent though
CausticFlames@sopuli.xyz · 5 pts · 29d
they could have used two’s complement for the exponent, but the biased exponent is objectively a better encoding for what floating point hardware needs to do.
This is paraphrased like mad, but basically that means hardware can compare exponent fields as plain unsigned integers. With twos complement, unsigned comparison says 255 > 1, even though -1 < 1. So every comparison would need special signed comparison logic.
pleiades@lemmy.ml · 1 pts · 28d
Gotcha, very cool!