Fixed Point Arithmetic 2: Multiplication and Division

Опубликовано: 21 Март 2026
на канале: Creel
24,572
285

In this tute we'll look at multiplication and division using fixed point, 32 bit integers. Most of the time you can just cast to 64 bit ints to keep precision and range, multiply or divide and cast back to 32 bits.

Sometimes this is not a good option. Casting and shifting 64 bit integers on 32 bit machines is very slow. Plus, SIMD is fantastic at fixed point, but not if it has to cast all the time. We'll have a look at a way we can tweak these operations, and trade a little precision or range for speed. This can greatly speedup packed fixed point arithmetic since it avoids casting altogether!

The technique in this video is particularly good when you're dealing with normalized numbers in some range, for instance -1.0 to 1.0. It is not good at all when your numbers might have a large range, -16000.0 to 16000.0 for instance.