nifty to Programmer Humor@programming.dev • 10 months agoStop using floatslemmy.worldimagemessage-square84fedilinkarrow-up1792arrow-down135
arrow-up1757arrow-down1imageStop using floatslemmy.worldnifty to Programmer Humor@programming.dev • 10 months agomessage-square84fedilink
minus-squareGroteStreet 🦘linkfedilinkEnglish9•10 months ago all work in floats We even have float16 / float8 now for low-accuracy hi-throughput work.
minus-square@frezik@midwest.sociallinkfedilink6•edit-210 months agoEven float4. You get +/- 0, 0.5, 1, 1.5, 2, 3, Inf, and two values for NaN. Come to think of it, the idea of -NaN tickles me a bit. “It’s not a number, but it’s a negative not a number”.
minus-square@zaphod@feddit.delinkfedilink6•edit-210 months agoI think you got that wrong, you got +Inf, -Inf and two NaNs, but they’re both just NaN. As you wrote signed NaN makes no sense, though technically speaking they still have a sign bit.
minus-square@frezik@midwest.sociallinkfedilink5•10 months agoRight, there’s no -NaN. There are two different values of NaN. Which is why I tried to separate that clause, but maybe it wasn’t clear enough.
We even have
float16 / float8
now for low-accuracy hi-throughput work.Even float4. You get +/- 0, 0.5, 1, 1.5, 2, 3, Inf, and two values for NaN.
Come to think of it, the idea of -NaN tickles me a bit. “It’s not a number, but it’s a negative not a number”.
I think you got that wrong, you got +Inf, -Inf and two NaNs, but they’re both just NaN. As you wrote signed NaN makes no sense, though technically speaking they still have a sign bit.
Right, there’s no -NaN. There are two different values of NaN. Which is why I tried to separate that clause, but maybe it wasn’t clear enough.