[PD] 32bit integer float

Mathieu Bouchard matju at artengine.ca
Sun Mar 26 18:18:19 CEST 2006


On Sun, 26 Mar 2006, Enrique Erne wrote:
> > > 1.4 - int(1.4) = something like 0.39999999999999999999999999999
> > > is this the way pd calculate?
> > i guess, you want to write 1.4 - int(1) ...

int(1) and int(1.4) are both equal to exactly 1.

1.4 - int(1.4) != 0.4 because floats aren't decimal, they are binary, so 
you can't write tenths, you can only write halves, quarters, eighths, 
sixteenths, and so on.

> Thanks Tim and Roman for your help
> I'll try [+ 1e-006]

With that you'll get more than 0.4. Floats have more than 6 decimal digits
(they have 24 binary digits). Try this:

[1.4(
 |
[- 1]
 |
[- 0.4]
 |
[print]

I get this: -2.98023e-08

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-list mailing list