Round a direction vector to an 8-way compass
Is the problem with the sin&#x2F;cos approach that it’s using double precision? That’s surely completely unnecessary precision. These days I don’t know what happens in x86 land with sin &amp; cos, but on a gaming GPU the fp32 cosf() is typically 16 or 32 times faster than fp64 cos(). Is that true on CPUs too? (I’m sure the simple proposed solution is always faster even in fp32, I’m just curious if the gap is much narrower, smaller than 25x.)