[PD] Can $0 be 0?

Mathieu Bouchard matju at artengine.ca
Mon Aug 14 04:15:20 CEST 2006


On Sun, 13 Aug 2006, Miller Puckette wrote:

> Anyway, $0 uses true integers, so that it's unlikely they will ever 
> reach zero (you'd have to fill your address speace 100s of times)... so 
> I think you're safe.

Not quite.
It breaks after 16776217 object creations.
16776217 = (1<<24)-1000+1.

Your "true integer" has a maximum value of (1<<31)-1, because the return 
value of canvas_getdollarzero is "int".

But then it gets converted to a 32-bit float (A_FLOAT) by 
canvas_realizedollar, and the maximum contiguous integer value of 32-bit 
floats is 1<<24 = 16777216 (if you increment it, it may stick there or 
increment by 2 instead, because there are no odd numbers beyond that 
point).

You don't have to fill your address space even once to get there, if 
abstraction instances get dynamically created and deleted over a long 
period of time.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| 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