News for hackers. Stuff that matters.
Re:0.30000000000000004 by chrisseaton on Tuesday December 03, 2019 @03:35AM (#21690822)
Every single time you run those two statements, you’ll get the same result. Yes they're non-associative. But that's specified and documented. That's not the same thing as non-deterministic in any way.
Re:0.30000000000000004 by lmilcin on Tuesday December 03, 2019 @03:57AM (#21690917)
Yet, in accounting, you are expected to be able to sum a set of numbers in different ways and still get the same result
Re:0.30000000000000004 by throwawaymath on Tuesday December 03, 2019 @11:47AM (#21693975)
Yes, sorry, I was just intending to highlight non-associativity :) I agree it's not "non-deterministic".
Re:0.30000000000000004 by FabHK on Tuesday December 03, 2019 @03:31PM (#21696383)
The same code might be optimised in different ways by different compilers, though (or the same compiler with different flags). This might lead to different results for the same code. In that sense, it's non-deterministic.
Re:0.30000000000000004 by chrisseaton on Tuesday December 03, 2019 @06:43PM (#21698164)
> The same code might be optimised in different ways by different compilers, though

It's not an optimisation if it changes the result! And if you use non-standard flags that's your problem.

Re:0.30000000000000004 by lmilcin on Wednesday December 04, 2019 @04:48AM (#21700884)
What is and what is not optimization and what changes are allowed or not depends on the application.

MP3 is an optimization of WAV, yet it changes the result.

Some applications are ok with reducing precision of calculations because they are not sensitive enough to small inaccuracies or they take effort to control inaccuarcies.

For example, graphics applications are typically heavy in FP calculations and yet they tend to not care much about precision and much more about performance. For those applications reducing accuracy for slight performance increase is likely win.