mod

koadrobot/math/mod

Computes the remainder of `IN1` divided by `IN2`.
mod
@/mod
Computes the remainder of `IN1` divided by `IN2`.
Divnumber
Numerator
Quatnumber
Denumerator
mod
OUT
Div
Quat
OUTnumber
The remainder rounded towards zero
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_Div>(ctx);
    Number y = getValue<input_Quat>(ctx);
    Number xy = fmod(x, y);   
    emitValue<output_OUT>(ctx, xy);
}

Tabular tests

DivQuatOUT
13103
4104
-610-6
-2610-6
-26-10-6
26-106
735.252.331.29~
NaN10NaN
26NaNNaN
InfInfNaN
-InfInfNaN
Inf-InfNaN
Inf2NaN
-Inf2NaN