Forums > MaxMSP

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


Feb 16 2012 | 1:26 pm

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

[attachment=185523,3369]

Attachments:
  1. Untitled5.png

    Untitled5.png

Feb 16 2012 | 1:29 pm

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

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

Feb 16 2012 | 1:33 pm

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


-- Pasted Max Patch, click to expand. --

ciao, j

Feb 16 2012 | 1:38 pm

Yay! Thanks.

Feb 16 2012 | 2:18 pm

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.

Feb 16 2012 | 4:25 pm

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?

Feb 16 2012 | 5:27 pm

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

Feb 16 2012 | 7:02 pm

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

Feb 20 2012 | 12:19 pm

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

Viewing 9 posts - 1 through 9 (of 9 total)

Forums > MaxMSP