Code archives/Algorithms/Not-So-Faster Sqr( x^2 + y^2 )

This code has been declared by its author to be Public Domain code.

Download source code

Not-So-Faster Sqr( x^2 + y^2 ) by Entity2002
Argh, I thought a^2 would be translated to a*a by the compiler and they'd be identical, but apparently it actually performs a pow() (tsk?)

This means that this snippet of code was in fact slower than:
dist = Sqr( x*x + y*y )
(Thanks to Beaker for pointing that one out :)
[code has been obsoleted :]

Comments

None.

Code Archives Forum