square

xod/math/square

Computes the square (i.e. x²) of an input value.
square
@/square
Computes the square (i.e. x²) of an input value.
INnumber
square
OUT
IN
OUTnumber

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        Number x = getValue<input_IN>(ctx);
        emitValue<output_OUT>(ctx, x * x);
    }
}

Tabular tests

INOUT
00
11
24
2.255.0625
416
-11
-24
-416
NaNNaN
InfInf
-InfInf