quick math expression question

mbira's picture

Still trying to wrap my head around the syntax required.

I have an expression: a == 0.007874 || a == 1 ? a == 1 : a == 0

I'm trying to say IF "a" is .007874 OR if "a" is 1 THEN "a" equals 1 ELSE "a" equals "0"

I'm getting proper result for 1, but .007874 is still coming up as false.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

benoitlahoz's picture
Re: quick math expression question

Math exp only have one output/result so you don't have to assign a variable :

a==0.007874||a==1?1:0

mbira's picture
Re: quick math expression question

hmmm...still passing .007874 as 0.

benoitlahoz's picture
Re: quick math expression question

It works for me. Are you sure there is not an error in your syntax ?

BTW double equals are only for a condition, if you want to assign a value to a variable you have to use the simple equal sign.

PreviewAttachmentSize
Capture d’écran 2010-11-25 à 01.41.45.png
Capture d’écran 2010-11-25 à 01.41.45.png122.3 KB

gtoledo3's picture
Re: quick math expression question

Is your input signal interpolating between two values, and you're trying to get it to trigger when it hits the in-between value of .007874? I seem to remember seeing a post on that recently; forgive me if I'm mixing it up.

If that's the case, you may need to use tolerance in your calculation. Depending on the way frames render, you may not hit the value .007874 exactly if it's just one of the values on a sweep of values; it may skip from .007872 to .007875. If you start shaking the editor around or something, it may skip from .007870 to .007880. (I'm just using those numbers to illustrate the point.)

mbira's picture
Re: quick math expression question

it is not sweeping, but toggling between three values, 1, 0.007874, and 0.9975

mbira's picture
Re: quick math expression question

Hmm-So no ideas on how to make this work? I'm guessing it does need a tolerance adjustment somehow...

mbira's picture
Re: quick math expression question

Well, I just went ahead and added a simple math in front that would multiply the value by 127 so I would be dealing with non-decimal numbers, and it works fine now.