[sdiy] Accuracy with integer maths

Jim Credland jim at cernproductions.com
Tue Feb 4 15:47:14 CET 2014


Tom, 

Everything I know I wrote down here: 

http://blog.credland.net/2013/09/binary-fixed-point-explanation.

Does that help? 

What are you doing the maths on?  

On Tue, Feb 4, 2014, at 02:00 PM, Tom Wiltshire wrote:
> Hi All,
> 
> Does anyone know any good websites where I can learn about accuracy
> requirements in integer maths?
> 
> Specifically, I'd like to know how many bits I need to calculate for
> various algorithms; multiplication, interpolation, etc.
> I've been doing some experiments and they suggest to me that I need more
> bits than I'd expected to eliminate errors. For example, if I take two
> 8-bit integers and multiply them, I get a 16-bit result. If I'm only
> interested in (say) the top 10 bits of that result, do I need to
> calculate the full 8x8 multiplication? Can I eliminate some of the
> calculation without getting any errors?

There are all sorts of tricks you can do to make this faster and easier.
 It's very architecture dependent though.  For example, the
multiplication instruction on a CPU might use two registers for the
result and you can just discard one of them.  

> What about if I needed 12 bits? Or what about if I were treating one
> 8-bit value as a 0 -> 0.99 amount value, and I multiply by the other
> 8-bit value and then use only the top 8 bits of the result.

 
> If anyone knows anywhere where there is a clear, programmer-orientated
> explanation of this sort of stuff, I'd be grateful. A serious academic
> number-theory treatment probably won't get through to me, since I'm not a
> (remotely!) serious academic or a number theoretician.
> 

  Jim Credland
  jim at cernproductions.com



More information about the Synth-diy mailing list