4 ms·
> And sqrt is called only once before the loop starts. Umm.. it should be evaluated at the top of the loop each time.
by waynecochran 11y ago
> And sqrt is called only once before the loop starts.
Umm.. it should be evaluated at the top of the loop each time.
- giancarlostoro 11y agoThe value of x doesn't change so calling sqrt once and re-using that value is a quicker approach I would think.
- junke 11y agoThe sqrt implementation is probably known to be side-effect free by the compiler.