Skip to content

Comment on Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? (2013)

Comments

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.

Technically it is not a matter of precision but of accuracy.

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

Also a crap ton faster, right?

Yes, if by faster you mean slower.

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.)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.