News for hackers. Stuff that matters.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by acqq on Thursday March 27, 2014 @05:01PM (#7483454)
> floating-point multiplication is commutative.

It's not, except in the special case of one and the same number.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by pascal_cuoq on Thursday March 27, 2014 @05:49PM (#7483757)
You have to be kidding. Otherwise, read up on the definition of “commutative” here: http://en.wikipedia.org/wiki/Commutative_property

Look for the first occurrence of the word “commutative” in this page: http://en.wikipedia.org/wiki/Floating_point

But remember, if both the Wikipedia editors and I are wrong, you only need to produce one pair of operands a and b such that a * b does not produce not the same result(1) as b * a to be vindicated.

(1) I suggest we consider all NaN values to be “the same result” for the purpose of this challenge.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by acqq on Friday March 28, 2014 @03:12AM (#7485760)
You're right of course. I was thinking about associtivity, not seeing what's really written. Sorry. I didn't expect discussing commutativity in the context (it's the non-associativity that doesn't allow all the "automatic" optimizations expected by some) where the formula in the same sentence is with three elements and the different order of computation. Which doesn't change the fact that I've made an error.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by ska on Thursday March 27, 2014 @08:13PM (#7484407)
No, fp (IEEE-745) + and * are both commutative. They aren't associative or distributive in general.