The One Man MMO Project: Looking for a Fast Square Root
Last night I needed a square root function that would work on 64-bit unsigned integers. I have been using the standard library's sqrt, but my first thought was that an integer square root could be faster.
It turns out that the hardware-based floating point sqrt is 9.45x faster than the "fast" integer square root. If I add a call to static_cast to get the float value into a uint64, it is still 8.27x faster.
I'll keep the integer square root, but this post is going in the comments for it.
Copyright (C)2009-2013 onemanmmo.com. All Rights Reserved