5 ms·
Yep. Along the same lines. This one is even simpler, though, as it requires only a single integer CPU instruction (and the simplest of all instructions too). I
by mbitsnbites 2y ago
Yep. Along the same lines. This one is even simpler, though, as it requires only a single integer CPU instruction (and the simplest of all instructions too).
If you want full precision, you need to do three Newton-Raphson iterations after the initial approximation. One iteration is:
y = y * (2.0F - x * y);
- magicalhippo 2y agoIt's a neat trick, and could be very useful on microcontrollers which doesn't have hardware division but does have hardware multiplication.
- actionfromafar 2y agoHm, like 68000?
- pechay 2y agoThe 68k has both signed and unsigned 32/16 bit divide instructions.