sqrt

koadrobot/math/sqrt

Computes the square root of an input value.
sqrt
@/sqrt
Computes the square root of an input value.
INnumber
sqrt
OUT
IN
OUTnumber
To use the node in your project you should have the koadrobot/math library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    Number x = getValue<input_IN>(ctx);
    // sqrt(-1.0));  // NaN _ nanf
    // raiseError<output_OUT>(ctx);
    emitValue<output_OUT>(ctx, sqrt(x));
}

Tabular tests

INOUT
4.02.0
-1.0NaN
0.50.707106~
00
NaNNaN
InfInf
-InfNaN