[sdiy] Harmonic bandwidth

Jason Tribbeck Jason.Tribbeck at argogroup.com
Wed Jan 9 16:44:36 CET 2008


Hi,

> One thing I just noticed, in the documentation for the sin() 
> function for C, it says "The sin() function may lose accuracy 
> when its argument is far from 0.0".  
> 
> My particular program checks the value before handing it to 
> the sin() function, but I have two
> questions:
> 
> 1) No computer value for pi is exactly accurate, so to 
> monitor the current angle value and subtract 2*pi when it 
> goes over 2*pi is also an inaccurate value.
> 
> 2) how far from 0.0 does one have to go to get an inaccurate 
> _enough_ sin() value?
> 
> Is it possible that these reasons are all it takes?  I would 
> have to assume that these problems exist in any digital 
> approximation of this.

Floating point (effectively) depends on how many digits are being used,
accuraccy decreases the higher the number of decimal places you're
calculating.

I'll simplify it a bit, by assuming there's 4 digits.

pi = 3.142

2pi = 6.284

200pi = 628.4 - so if you're now trying to get to a multiple of 2pi:

200pi / 2pi = 628.4 / 006.3 [you need to get them into the same digit
range]

=> 99.75

Which isn't what you are expecting.

Double precision floating point is accurate to about 16 digits, so
hopefully that'll give you an idea as to what you can expect.

Note: It isn't quite like this, but I think it's easier to explain. Feel
free to correct :)
--
Jason Tribbeck




More information about the Synth-diy mailing list