3 ms·
I was surprised that pre-calculating xx as double xx = xx made a difference. The author's compiler must not be great at optimization if this is the case.
by deepspace 5y ago
I was surprised that pre-calculating xx as double xx = xx made a difference.
The author's compiler must not be great at optimization if this is the case.
- FartyMcFarter 5y agoI haven't checked, but off the top of my head this could be because this optimisation changes the precision of the result enough for it to be an illegal optimisation. Some compilers have options such as -ffast-math that result in ignoring some precision issues. This could be worth a try as an alternative to manual optimisation.