My simple divide patch doesn't work.. What am I doing wrong?

HyperNerd's icon

I'm trying to have the patch output a float, but it seems to be bent on staying an int if anything at all.

3369.Untitled5.png
png
Wetterberg's icon

you need to tell your divide object to work in float as well.

do [/ 1.] and it'll work.

johannes's icon
Max Patch
Copy patch and select New From Clipboard in Max.

you will have to add a 0. to the division object.
otherwise max ignores the floatingpoint part of a values.

ciao, j

HyperNerd's icon

Yay! Thanks.

Peter Castine's icon

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.

AudioLemon's icon

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?

Gregory Taylor's icon

...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.

Chris Muir's icon

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.)

Peter Castine's icon

@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.