chop

Replaces real numbers that are close to zero by exactly zero.

assert (chop(1.0) == 1.0);
assert (chop(1e-20) == 0.0);
  1. Real chop(Real x, real threshold)
    pure nothrow
    Real
    chop
    (
    Real
    )
    (
    Real x
    ,
    real threshold = 1e-10L
    )
    if (
    isFloatingPoint!(Real)
    )
  2. Real[] chop(Real[] x, real threshold, Real[] buffer)

Meta