Oh I’m tempted to profile it. I wonder if the sqrtf() is a big bottleneck.
So for a second I started thinking this might be a great place to use the famous Doom fast inverse square root trick. But then remembered two seconds later this is fixed point, dangit. There isn’t a fixed point version of the fast inverse sqrt is there? I guess it’s not possible, the trick depends on the exponent.
Probably a simple fixed point Newton’s method would improve the sqrt perf considerably, especially for a reasonable initial guess. There must be a rule of thumb? For values greater than 1, shift right by half the number of bits between high bit and radix (Does the calculator have an ffs equivalent instruction?). For values less than 1, shift left by the distance. Would something like that be good enough in practice?
Well done video, BTW, I enjoyed the explanation and production value.
2 comments
[ 3.6 ms ] story [ 17.9 ms ] threadSo for a second I started thinking this might be a great place to use the famous Doom fast inverse square root trick. But then remembered two seconds later this is fixed point, dangit. There isn’t a fixed point version of the fast inverse sqrt is there? I guess it’s not possible, the trick depends on the exponent.
Probably a simple fixed point Newton’s method would improve the sqrt perf considerably, especially for a reasonable initial guess. There must be a rule of thumb? For values greater than 1, shift right by half the number of bits between high bit and radix (Does the calculator have an ffs equivalent instruction?). For values less than 1, shift left by the distance. Would something like that be good enough in practice?
Well done video, BTW, I enjoyed the explanation and production value.