[LAD] [ANN] LV2 beta3

Steve Harris steve at plugin.org.uk
Fri May 11 16:16:08 UTC 2007

On 11 May 2007, at 15:07, Fons Adriaensen wrote:

> On Fri, May 11, 2007 at 03:33:04PM +0200, Lars Luthman wrote:
>> That sounds like a good argument for two ints to me. Although  
>> you'd have
>> to do a lot better than double if you wanted to represent irrational
>> numbers in binary form. =)
> Two 32-bit ints can represent (the non-integer part of) most (not all)
> irrational values to better precision than a double. The algo to find
> them is a bit mysterious but very simple. Simple example: 355/113 is
> equal to pi with a relative error of less than 1e-7, not bad for two
> 3-digit numbers. It's not difficult to find two 32-bit ints that would
> be better than a double.

So, that's true, but I've still not seen an example of where an  
synchronous audio plugin needs to know the numerator and denominator  
individually to better do it's processing.

A double can represent pi with an error of 2e-16, and I can't believe  
that the billionth of a cent detune error is in any way significant.  
I am probably being dense here, but please give an example. In the  
meantime I'm going to write some code to measure the accumulated  
error, incase its just a trivial piece of arithmetic that's escaped  
me. Floating point maths is sometimes non-intuative.

- Steve

More information about the Linux-audio-dev mailing list