[PD] 32bit integer float

Tim Blechmann TimBlechmann at gmx.net
Sat Mar 25 19:30:29 CET 2006


> 1.question
> 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) ...
floating point math is not associative, so 1.4 - 1 - 0.4 != 0
see:
http://en.wikipedia.org/wiki/Floating_point#Properties_of_floating_point_arithmetic

> 2.question
> is there a way to check the result with [== 0.4] which outputs 1?
> 
> 3.question
> is 0.4 in [== 0.4] a 32bit float?

no, because there is no possibility to encode 0.4 as a floating point
number without rounding ... an equality test only makes sense, if a
number can be encoded as floating point number and it's sure, you're
experiencing rounding problems ...

hth ... tim

--
TimBlechmann at gmx.de    ICQ: 96771783
http://www.mokabar.tk

Happiness is a byproduct of function, purpose, and conflict; those who
seek happiness for itself seek victory without war.
  William S. Burroughs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20060325/083ce8c9/attachment.pgp>


More information about the Pd-list mailing list