blotz@lemmy.world to STOP DOING SCIENCE@lemmy.dbzer0.comEnglish · 2 years agoStop Using Floatslemmy.worldimagemessage-square7linkfedilinkarrow-up1197arrow-down18
arrow-up1189arrow-down1imageStop Using Floatslemmy.worldblotz@lemmy.world to STOP DOING SCIENCE@lemmy.dbzer0.comEnglish · 2 years agomessage-square7linkfedilink
minus-squareanton@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up6·2 years agoLet’s say our integers are 64 bit, say we put half before the point. Now our largest value is just below 4 294 967 296, a 32 bit float goes to 3.4*10^38. The representation also enables some operations to be faster (multiplication, division iirc).
minus-squareTheChurn@kbin.sociallinkfedilinkarrow-up6·2 years agoFloats have a wider range, at the cost of not having full coverage over that range. Even the integers in that range cannot be exactly represented
Let’s say our integers are 64 bit, say we put half before the point. Now our largest value is just below 4 294 967 296, a 32 bit float goes to 3.4*10^38. The representation also enables some operations to be faster (multiplication, division iirc).
Floats have a wider range, at the cost of not having full coverage over that range. Even the integers in that range cannot be exactly represented