Also known as xod/core/absolute
.
#pragma XOD dirtieness disable
node {
void evaluate(Context ctx) {
auto x = getValue<input_IN>(ctx);
emitValue<output_OUT>(ctx, x > 0 ? x : -x);
}
}
IN | OUT |
0 | 0 |
-1 | 1 |
-0.251 | 0.251 |
-0.9924 | 0.9924 |
-99999.999 | 99999.999 |
-27638.247 | 27638.247 |
NaN | NaN |
Inf | Inf |
+Inf | Inf |
-Inf | Inf |