My simple divide patch doesn't work.. What am I doing wrong?
I'm trying to have the patch output a float, but it seems to be bent on staying an int if anything at all.
you need to tell your divide object to work in float as well.
do [/ 1.] and it’ll work.
you will have to add a 0. to the division object.
otherwise max ignores the floatingpoint part of a values.
----------begin_max5_patcher---------- 382.3ocyT9saBBCEF+Z3onoWyX7mhZ1c64XYwTfpVSokTpN2L9tO5ovDWLAh yX1MkzS+Nm9c90S3nuGNWcf0fQufdC44cz2yCBYC30s2CWQOTHnMfL7JgRtq BG3NplZJ1vkqWpYEFWYHoYgQAnTB7IKxtlzthduKG0NifYLeVybIXKI0fCP3 bpbM9Gc7R3BU4aehj0egqTRijVAoheUyohyVQ2F2vzKYRZt.TD0cVqiKYE7J pnVPKbMLYPEa3eA5iSBGjBW15SPa74fN2CQSrAO46aWBlH9jrOZandOaXG.p geFEENNSSV3PaRX1zX5UYIYbVNEljbUlDeCLY7Qp4yf1O9dNRk92FodriMih nzENpDO+Nhnj+CHBbFVvk+9+T.ErwujaMpc5h9lruMPmAQIqwvkTCWIGJhbg nM7xRlbXyTxar8GPmnq9BNY+jNU+D+X7CYJ9I6F4i64iVWumoa5pIXk1A7sJ sc6r.XKW51BUDqY6485S8sU6j+2.T3Gj4. -----------end_max5_patcher-----------
This applies to all arithmetic objects, by the way. A lot of other objects also default to working with ints unless you specify float in the initialization arguments.
The reasons for this lie in the distant past, but there a zillions of patches in the world that rely on that behavior.
What are the reasons for that – in PD everything is a float and it seems to make patching go a bit smoother – why are ints used at all?
…and it’s probably not a good idea to use / 0. as your default, obviously.
The reason for having integers and floats is an historical one. Max predates Pd, where our pal Mr. Puckette had the great luxury of just starting over and never having to worry about breaking every patch in the electroacoustic repertoire.
And the reason that they were used historically was that floating point math came at a great performance cost on the machines that Max was designed for (68K Macs w/o a FPU.)
@grizzle: Max is not Pd. Pd is not Max.
For all the shared ancestory, assuming one will behave like the other in all ways is a recipe for misunderstanding and disaster.
As for ints: they behave *much* more the way people expect than floats once you get used to the fact that they truncate. No problems with accuracy and the last decimal place being different from what you expect or there being more decimals places that what you expect. And, ints have a much wider range than float-with-integer-accuracy.
In short, there are a lot of reasons, beyond legacy, for using ints.
Forums > MaxMSP