▲ 100 ▼ Big Decimals: Stop Using Floats or Cents for Money (medium.com) submitted 10 months ago by Trev13@programming.dev to c/programming@programming.dev 54 comments fedilink hide all child comments
[–] bleistift2@sopuli.xyz 0 points 10 months ago* (2 children) If you count the programming language you use as ‘platform’, then yes. Python rounds both 11.5 and 12.5 to 12. permalink fedilink source parent hideshow 4 child comments replies: [–] WolfLink@sh.itjust.works 4 points 10 months ago This is a common rounding strategy because it doesn’t consistently overestimate like the grade school rounding strategy of always rounding up does. permalink fedilink source parent [–] FizzyOrange@programming.dev 2 points 10 months ago 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. permalink fedilink source parent
[–] WolfLink@sh.itjust.works 4 points 10 months ago This is a common rounding strategy because it doesn’t consistently overestimate like the grade school rounding strategy of always rounding up does. permalink fedilink source parent
[–] FizzyOrange@programming.dev 2 points 10 months ago 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. permalink fedilink source parent