Is < faster than

No, it will not be faster on most architectures. You didn’t specify, but on x86, all of the integral comparisons will be typically implemented in two machine instructions: A test or cmp instruction, which sets EFLAGS And a Jcc (jump) instruction, depending on the comparison type (and code layout): jne – Jump if not equal … Read more

Why doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?

Because Floating Point Math is not Associative. The way you group the operands in floating point multiplication has an effect on the numerical accuracy of the answer. As a result, most compilers are very conservative about reordering floating point calculations unless they can be sure that the answer will stay the same, or unless you … Read more