orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 29 days agoFloating point arithmeticseviltoast.orgimagemessage-square9fedilinkarrow-up12arrow-down11
arrow-up11arrow-down1imageFloating point arithmeticseviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 29 days agomessage-square9fedilink
minus-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up0·29 days agoYep. Open your browser’s console and do .1 + .2 and you get 0.30000000000000004. One of the reasons not to use floating point when working with money.
minus-squarebamboo@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up0·29 days agoWhat’s the right way to do money math without floats?
Yep. Open your browser’s console and do
.1 + .2and you get0.30000000000000004.One of the reasons not to use floating point when working with money.
What’s the right way to do money math without floats?
Fixed-point arithmetics