Trev13@programming.dev to Programming@programming.dev · 6 天前Big Decimals: Stop Using Floats or Cents for Moneymedium.comexternal-linkmessage-square53fedilinkarrow-up1103arrow-down13
arrow-up1100arrow-down1external-linkBig Decimals: Stop Using Floats or Cents for Moneymedium.comTrev13@programming.dev to Programming@programming.dev · 6 天前message-square53fedilink
minus-squarebleistift2@sopuli.xyzlinkfedilinkEnglisharrow-up2arrow-down2·edit-26 天前If 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 天前This 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·5 天前That 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.