@maruaudio/dsp/acoustics/rounding gives the room-acoustics DSP nodes the two integer roundings they inherit from pyroomacoustics. roundHalfEven matches numpy.round: ties go to the even integer, and a zero result keeps the sign of its input (-0.2 rounds to -0). truncToward0 matches a C++ int() cast: truncation toward zero, never returning -0.
roundHalfEven(2.5) // 2
roundHalfEven(-0.2) // -0
truncToward0(-1.7) // -1Lifecycle
None: pure scalar functions, no state, no allocation, no closures.
When to use it
Porting or extending room-acoustics code where a sample index, delay or image order must round exactly as the numpy or C++ reference does, so outputs stay comparable with upstream fixtures.
Limits
- NaN and infinities pass through unchanged.
roundHalfEvenreturns any value of magnitude 2^52 or more unchanged, since it is already an integer in f64.