[PD] long int precision lost

Mathieu Bouchard matju at sympatico.ca
Sun Dec 5 19:55:47 CET 2004

On Sun, 5 Dec 2004, Lex Ein wrote:

> At first glance, Microsoft C and GNU both provide quite adequate
> double and long double mantissa size, so the existence of this data
> degradation is odd.

Pd Floats are 32-bit, or 1:8:23-bit to be exact. So you can't have more
than 24 significant bits, and so (1<<24)+1 = 16777217 is the first integer
not representable as a float (it gets rounded).

Pd is currently pretty much stuck to float32, Miller having refused the
int/float separation and any kind of number type distinction; there is no
provision for anything other than float32.

So if you want more precision you will have to cut down your data into
smaller pieces, or use something else than Pd for handling those values
that need more precision. Some of the scripting languages connectable to
Pd support float64 and/or illimited-precision integers (both Ruby and
Scheme have those two types; Python must have something similar too)

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

More information about the Pd-list mailing list