# [sdiy] Best book /resource for fixed point math??

charlie wallace charlie at finitemonkeys.com
Thu Sep 12 19:10:45 CEST 2013

```its always a tough thing to answer as best, since everyone has
different ways of learning, but here goes.

we use fixed point a lot in games programming so the google with fixed
point tutorial game development will bring you across a while bunch of
them, they tend to be less heavy on the mathematical notation, if you
want it from a more maths approach look up fixed point DSP tutorials.

there is a book called essential mathematics for game
programmers/developers and they have a website with a fixed point
powerpoint too that gives a good intro.

the basics of fixed point is basically just 12.34 * 56.78 more or less
becomes 1234*5678 the different types are usually setup for different
levels of precision, you rob peter to pay paul basically. you'll see
16.16, 8.24, 8.8, etc as basic types, and these simply are how many
bits am i allocating to the whole , and how many to the fractional
part. so 16.16 is 16 bits for an integer, and 16 for the fractional
value. there are caveats that will be explained in most tutorials.

once you look for performance in fixed point, you can then go beyond
that and stop looking at base 10 math, use powers of 2 etc, normalise
things into ranges that make sense for 0..1023 instead of 0..1 or 0 to
1000, but that is for another day.

On Thu, Sep 12, 2013 at 7:56 AM, Dan Snazelle <subjectivity at hotmail.com> wrote:
> In a few different wavetable synth programs (for avr) that I have been studying, I keep finding references to  fixed point math
>
> Variables like
>
> Q16n16
> Q0n31
> Q1n15 etc
> And functions for seperating the "fractional part" of a number, etc.
>
>
> Im wondering which book , video, etc
> Might be best for really coming to terms with understanding fixed point/floating point so that I can understand programs and so my own programs can improve.
>
> I know it would be useful as I have read that the AVR can use  the help with math it can get (just like me)
>
> Thanks!
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy

```