mod

koadrobot/maths/mod

Computes the remainder of `IN1` divided by `IN2`.
mod
@/mod
Computes the remainder of `IN1` divided by `IN2`.
IN1number
Numerator
IN2number
Denumerator
mod
IN1
IN2
OUT
OUTnumber
The remainder rounded towards zero
To use the node in your project you should have the koadrobot/maths 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 in1 = getValue<input_IN1>(ctx);
    Number in2 = getValue<input_IN2>(ctx);
    Number out = fmod(in1, in2);
    emitValue<output_OUT>(ctx, out);
}

Tabular tests

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