[PD] more about float limitation (was: weird float/add limitation)

Claude Heiland-Allen claude at mathr.co.uk
Thu Jan 29 17:48:36 CET 2015


On 29/01/15 16:17, Alexandre Torres Porres wrote:
> Pd can only represent up to 6 significant digits, so they say. For example,
> in a message, you can have a number with up to 5 decimal places, like:
> -5.29314e+12
>
> but it does have a better internal resolution, if you compare 4 / 3 to
> 1.33333 you'll see 4 / 3 is higher ( try [expr 4./3 > 1.33333] and check).
>
> So, what's this internal resolution?

32 bit float with 24 bit precision (around 7.22 decimal digits)

> And why can't you have the same
> resolution in a message?

You can have higher resolution in .pd files, but when they are loaded Pd 
decides to reduce the resolution for display purposes.  Then when you 
save the patch the higher resolution is lost.

Pd reduces the resolution for display purposes so that (eg) adding "0.1" 
ten times displays as "1" instead of it's true value which is closer to 
"1.0000001".

Whether this is a good idea or not is debatable - on the plus side "1" 
is easier to read, on the minus side numbers can look the same but 
compare unequal (eg) adding "0.1" ten times then [select 1].

> 2015-01-28 16:06 GMT-02:00 Martin Peach <chakekatzil at gmail.com>:
>> You could use an object made with pdlua to manipulate large floating-point
>> numbers, as there is no(?) limit to the size of a float in lua.

pdlua uses whatever number type Lua was compiled with, usually double.


Claude
-- 
http://mathr.co.uk




More information about the Pd-list mailing list