Also known as xod/core/absolute
.
#pragma XOD dirtieness disable
node {
void evaluate(Context ctx) {
auto x = getValue<input_Eingabe>(ctx);
emitValue<output_Ausgabe>(ctx, x > 0 ? x : -x);
}
}
Eingabe | Ausgabe |
---|---|
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 |