[PD] number problem

Mathieu Bouchard matju at sympatico.ca
Tue Mar 15 19:23:58 CET 2005


On Tue, 15 Mar 2005, roc wrote:

> just out of curiosity after /doc/'s example patch: how many digits can 
> handle a message in pd?

a float atom can handle 24 significant bits (that's about 7
decimals). After that, it starts dropping the least significant digits, so
that 16777217 is the first natural number that can't be a pd-float.

However when converting floats to text and back (for example in
saving/loading patches) it's only 6 decimals: 1000001 is the first natural
number that won't be _written_ exactly by pd.

It's difficult to get extra precision in PureData. Those who really need
it can pick a language supported by PureData and write externals for
that... Using Ruby or Scheme you can easily get thousands or even millions
of digits.

If you're sticking to PureData you will have to chop that into manageable
chunks: for example, 1 or 3 or 6 decimals per float, in a list of floats
representing different parts of the number (gaaaah).



BTW, I have the impression that this should go in the FAQ. I sense déjà-vu
and if I go in my mail archives I'll prolly find myself having retyped the
same ideas many times... (some copies of it may have been on the pd-dev
mailing-list though)

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju





More information about the Pd-list mailing list