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 ww2 on Thursday March 27, 2014 @09:23AM (#7480187)
How would a functional language compiler deal with this case? like GHC?
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 @10:22AM (#7480533)
It doesn't. If we forget about FPU flags, floating-point multiplication is pure. That does not change anything to the fact that a * (b * c) is different from (a * b) * c.

The problem is not side-effects in multiplication. The problem is that * is not associative.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by skrebbel on Thursday March 27, 2014 @09:36AM (#7480258)
You could try it out!