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 stephencanon on Thursday March 27, 2014 @10:26AM (#7480566)
Pure cargo-culting. There are circumstances in which it’s perfectly appropriate to compare floating-point data for equality. There are also circumstances in which a comparison with some tolerance is more appropriate. Understand what situation you’re in, and understand the tools that you’re using.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by TeMPOraL on Thursday March 27, 2014 @11:18AM (#7480899)
Comparing floats for equality is equivalent to comparing them with tolerance that you don't control. I don't see a good reason to risk like that.
Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by millstone on Thursday March 27, 2014 @01:13PM (#7481796)
Comparing floats for equality is equivalent to a comparison with zero tolerance, not an uncontrolled tolerance.

Consider storing a timestamp as a number of seconds since the epoch. We might use == to check if the timestamp has changed.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by nitrogen on Thursday March 27, 2014 @12:49PM (#7481619)
Read the wikipedia entry on IEEE754-1985 (it has better diagrams than the main 754 entry): http://en.wikipedia.org/wiki/IEEE_754-1985#Representation_of...

Knowing is better than fearing.

Re:Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? ... by stephencanon on Thursday March 27, 2014 @11:41AM (#7481045)
No, it's not equivalent to that at all. Why would you think such a thing?