coerceZeroI function
Forces small numbers near zero to zero, according to the specified absolute accuracy.
The real number to coerce to zero, if it is almost zero.
The maximum count of numbers between the zero and the number
Implementation
double coerceZeroI(double a, int maxNumbersBetween) {
if (maxNumbersBetween < 0) {
throw ArgumentError.value(
maxNumbersBetween, 'maxNumbersBetween', messages.argumentNotNegative);
}
if (a.isInfinite || a.isNaN) {
return a;
}
// We allow maxNumbersBetween between 0 and the number so
// we need to check if there a
if (numbersBetween(0.0, a) <= maxNumbersBetween) {
return 0.0;
}
return a;
}