Klang C++ 0.7.15
Language Reference (draft)
Loading...
Searching...
No Matches
mod

Language Guide / Functions ยท Generated API signature

mod

klang::mod

Remainder for integer and floating-point values.

Integer operands use the C++ remainder operator. Floating-point operands use the same remainder convention as fmod, so a negative input can give a negative result. This example uses a non-negative phase and a period of one.

-2.5-1-1.25-0.5001.250.52.51ResultInput x
mod(x, 1) for floating-point x

Floating-point inputs use std::fmod. Integer inputs use the C++ remainder operator.

Direct call

const signal wrapped = mod(phase, 1);

Signal flow

const signal wrapped = phase >> mod(1);