Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@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) // -1

Lifecycle

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.
  • roundHalfEven returns any value of magnitude 2^52 or more unchanged, since it is already an integer in f64.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

Used by