modulo_pm_π

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

Namespace: dsp

Prototype

T modulo_pm_π(T x)

Description

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

Example

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

See also

modulo_2π(), phase_unwrap(), modulo()