Replaces all numbers in the given array that are close to zero by exactly zero. To chop the array in-place, pass the same array as both x and buffer.
double[] a = [1.0, 1e-20, 2.0]; double[] x = [1.0, 0.0, 2.0]; auto b = chop(a); assert (b == x); chop(a, 1e-12L, a); assert (a == x);
See Implementation
Replaces all numbers in the given array that are close to zero by exactly zero. To chop the array in-place, pass the same array as both x and buffer.