orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 21 hours agoFloating point arithmeticseviltoast.orgimagemessage-square44fedilinkarrow-up1699arrow-down14
arrow-up1695arrow-down1imageFloating point arithmeticseviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 21 hours agomessage-square44fedilink
minus-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up9·18 hours agoUse a dedicated data type or library. Some languages also have something like python’s Decimal type >>> .1 + .2 0.30000000000000004 >>> Decimal(".1") + Decimal(".2") Decimal('0.3')
Use a dedicated data type or library. Some languages also have something like python’s Decimal type
>>> .1 + .2 0.30000000000000004 >>> Decimal(".1") + Decimal(".2") Decimal('0.3')