Zero Problem… Can you solve it?

Mar 4, 2012 at 2:42pm

Zero Problem… Can you solve it?

Hi, I’m new to Max, so don’t be too harsh on me… so how can you say “all float numbers pass except for 0. (zero)” and “replace zero with X” in max language?
I have a float number box that determines the playback speed in a sfplay~ objet. I want it to be looped and never stop, so I can’t have 0. on that float number box… I tried a few ways to go around it but I wasn’t able to solve it. I’ll be glad if you can help me. Thanks.

Mar 4, 2012 at 3:30pm

[if $f1!=0. then $f1 else X]

Mar 4, 2012 at 4:19pm


IMHO when you use FLOAT it’s often a better idea to not test strict equality but something like that instead (to avoid bad surprises with floating point artefacts) :

[if (abs(0. - $f1)) > 0.001 then $f1 else 100.]

Mar 4, 2012 at 5:38pm


@vanille béchamel: Hey your expression doesn’t work… it reports this error: “(…) has a comma or semi comma” … if I remove the semi comma it says: “bad gt string”…

Mar 4, 2012 at 5:43pm


strange, it works fine on my computer (max 5.1.9) …

– Pasted Max Patch, click to expand. –
Mar 4, 2012 at 6:35pm

you can also use select object:

– Pasted Max Patch, click to expand. –

You must be logged in to reply to this topic.