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 pygy_ on Thursday March 27, 2014 @08:01AM (#7479788)
I already knew about the lack of associativity of IEEE floats, but TIL that `pow(x,n)` is more precise than chained multiplications.

Good to know.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by rbonvall on Thursday March 27, 2014 @10:17AM (#7480502)
Technically it is not a matter of precision but of accuracy.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by pygy_ on Thursday March 27, 2014 @12:27PM (#7481416)
Interesting, thanks for the correction.

I'm neither a native English speaker nor an engineer, and I didn't know about the distinction.

https://en.wikipedia.org/wiki/Accuracy_and_precision

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by taeric on Thursday March 27, 2014 @10:27AM (#7480572)
Also a crap ton faster, right?
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by Narishma on Thursday March 27, 2014 @11:29AM (#7480974)
Yes, if by faster you mean slower.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by taeric on Thursday March 27, 2014 @12:11PM (#7481265)
Ha! Yes, for floating point. I meant my post to more communicate that moving it behind a library/method would allow you to make that decision elsewhere easily. I did not even come close to making that point. (I got distracted reading some interesting hacks that approximate this in insane speed.)