math expression question

zqpm1qaz's picture

if a<b then a=0

'a' is float numbers. how to do that in qc math expression pacth?

thanks for the help!

zanroversi's picture
Re: math expression question

hello,

You can use the ternary operator, it works inside mathematical expression :

a < b ? 0.0 : a

this means "if a < b then return 0.0 otherwise return a".

Or something like : !(a<b) * a

Bye !

zqpm1qaz's picture
Re: math expression question

Thanks! I will give it a try soon!

zqpm1qaz's picture
Re: math expression question

it work perfect!