3 if statements in max/msp
Not behind the computer.
Lot of mistakes there
So its hard to help.
Variable 2 (or 1 ?) is $f. Not possible it has to be $f1 or $f2.
Look at the help file.
Or is ||.
And is &&
To check two conditions in one statement you need ()
If ($f1 > 0.35 ) && ($f1 < 0.75) then 1. Else out2.
Linnea, it looks like you are trying to output a value based on a range. For the sake of illustration, let's assume the following.
If the input is greater than 0.35 then output 2.
If the input is less than 0.35 but greater than or equal to 0.3 then output 1.
If the input is less than 0.3 then output -1.
You can use: [expr ($f1>=0.35)*2+(($f1>=0.3)&&($f1
That's because logical operators in [expr] are solved as 1 or 0. For example, [expr $f1>=0.35] is 0 or 1 depending on the input. The useful thing about this is you can MULTIPLY the expression by whatever you want for an output (because 0*whatever is 0 and 1*whatever is whatever). Hence, [expr ($f1>= 0.35)*2.] --> 0 or 2.
In other words, everything to the left of the * is the 'if' part of your statement and everything after is the 'then' part of your statement.
Even better, you can connect multiple conditional expressions together in a single [expr] object by ADDING each sub-expression (because the conditions that fail are 0 and 0 + 0... = 0). You just have to make sure that no more than one conditional sub-expression is true for a given input, otherwise you will be adding multiple values greater than 0. Check out the [expr] help file for logical operators.
thank you Metamax!
If you don't like icky expressions ; ) you can do it with the help of [split]
very useful information, METAMAX!
there are some more mistakes in the original picture than the synthax things.
it is simply not possible to get two different results at the same time from >= 0.3 and >= 0.35
so: what do you want to do? :)
and of course i second the suggestion to use expr the way meta discribed it. once you got the hang on it, it will be quite fun to extend it with further calculations, all in one object - in a way which is not possible using the boring if object.
it is simply not possible to get two different results at the same time from >= 0.3 and >= 0.35
Yes, but with Max, all things are possible! :)
u cheating me u use 2 objekt!
Cute example, Metamax. One of the objects is presumably comparing 32-bit representations while the other compares 64-bit representations (and in one of the two cases, converting the text representation to the one binary representation and then further converting to the other binary representation).
Floating point values still have gotchas, although compared to the implementations we worked with four or five decades ago they're very well behaved.
PS: You might want to check out http://www.h-schmidt.net/FloatConverter/IEEE754.html and type 0.35 into the "Decimal Representation" box.
Peter Castine.. in the house!
I actually built a patch (after one of our conversations no less) that casts accurate double precision floats. Nothing more than a novelty.. but it's accurate. :) Not sure why Max doesn't have some way to access the info directly.