Trev13@programming.dev to Programming@programming.dev · 5 days agoBig Decimals: Stop Using Floats or Cents for Moneymedium.comexternal-linkmessage-square54linkfedilinkarrow-up1103arrow-down13
arrow-up1100arrow-down1external-linkBig Decimals: Stop Using Floats or Cents for Moneymedium.comTrev13@programming.dev to Programming@programming.dev · 5 days agomessage-square54linkfedilink
minus-squarebleistift2@sopuli.xyzlinkfedilinkEnglisharrow-up2arrow-down2·edit-25 days agoIf you count the programming language you use as ‘platform’, then yes. Python rounds both 11.5 and 12.5 to 12.
minus-squareWolfLink@sh.itjust.workslinkfedilinkarrow-up4·5 days agoThis is a common rounding strategy because it doesn’t consistently overestimate like the grade school rounding strategy of always rounding up does.
minus-squareFizzyOrange@programming.devlinkfedilinkarrow-up2·4 days agoThat is default IEEE behaviour: https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even This is the default rounding mode used in IEEE 754 operations for results in binary floating-point formats. Though it’s definitely a bad default because it’s so surprising. Javascript and Rust do not do this. Not really anything to do with determinism though.
If you count the programming language you use as ‘platform’, then yes. Python rounds both 11.5 and 12.5 to 12.
This is a common rounding strategy because it doesn’t consistently overestimate like the grade school rounding strategy of always rounding up does.
That is default IEEE behaviour: https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even
Though it’s definitely a bad default because it’s so surprising. Javascript and Rust do not do this.
Not really anything to do with determinism though.