The short answer to your questions is no, but if you’re careful you can prevent indeterminism. I’ve personally ran into it encoding audio files using the Opus codec on AMD vs Intel processors (slightly different binary outputs for the exact same inputs). But if you’re able to control your dev environment from platform choice all the way down to the assembly instructions being used, you can prevent it.
Mostly standardized? Maybe. What I know is that float summation is not associative, which means that things that are supposed to be equal (x + y + z = y + z + x) are not necessarily that for floats.
I got hung up on this line:
Aren’t floats mostly standardized these days? The article even mentions that standard. Has anyone here seen platform-dependent float behaviour?
Not that this affects the article’s main point, which is perfectly reasonable.
Floating-Point Determinism | Random ASCII - tech blog of Bruce Dawson https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/
The short answer to your questions is no, but if you’re careful you can prevent indeterminism. I’ve personally ran into it encoding audio files using the Opus codec on AMD vs Intel processors (slightly different binary outputs for the exact same inputs). But if you’re able to control your dev environment from platform choice all the way down to the assembly instructions being used, you can prevent it.
Thanks, that’s an excellent article, and it’s exactly what I was looking for.
The IEEE standard actually does not dictate a rounding policy
Mostly standardized? Maybe. What I know is that float summation is not associative, which means that things that are supposed to be equal (x + y + z = y + z + x) are not necessarily that for floats.
The real standard is whatever Katherine in accounting got out of the Excel nightmare sheets they reconcile against.
If you count the programming language you use as ‘platform’, then yes. Python rounds both 11.5 and 12.5 to 12.
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.
This is a common rounding strategy because it doesn’t consistently overestimate like the grade school rounding strategy of always rounding up does.