-
Tell if a value is positive or negative without IF statement.
I’m trying to determine if my value is positive or negative. Of course I could easily do an IF ELSE statement, but I need this expression to work on 400 layers simultaneously and IF ELSE has proven to slow things down immensely, so I try to find a way without using it.
In an ideal world I would get 1 if my value is positive and -1 if it’s negative, but of course anything else like 1 and 0 or something like this would be great too.
I wrote this tiny expression, which works exactly like I want it to, but fails if the value is 0. Do anybody here know a better way?PosNeg = Math.abs(value)/value;