modulo_2π

Computes \(a\) modulo \(2\pi\), the result being in the \(\left[0,2\pi\right[\) interval.

Namespace: dsp

Prototype

T modulo_2π(T x)

Description

The result is in the \(\left[0,2\pi\right[\) interval: \[ y = x + k\cdot 2\pi,\quad k\in\mathbb{Z},\ y\in \left[0,2\pi\right[ \]

Example

assertion(modulo_2π(2*π+1e-5) == 1e-5);

See also

modulo_pm_π(), phase_unwrap(), modulo()