With downcasting off, EvalNumerical loses decimals at three limits:
using var _ = MathS.Settings.DowncastingEnabled.Set(false);
"1 / 1.37^(-200)".EvalNumerical() // NaN, not 2.21e27
"1.37^(-1500) * 1.37^1500".EvalNumerical() // 0, not 1
"(1.37^8000 + 1) / (1.37^8000 + 2)".EvalNumerical() // NaN, not 1.00...
- A small divisor. A divisor below
PrecisionErrorZeroRange (1e-16) counts as zero (Number.IsZero), so the quotient is NaN.
- Both ends of the exponent range.
DecimalPrecisionContext is new EContext(100, ERounding.HalfUp, -100, 1000, false), which bounds exponents to [-100, 1000]. At 100 digits, a decimal below about 1e-199 becomes zero and one above 1e1000 becomes infinite. LostToExponentRange works around this for an exact ratio, but a decimal has no exact value to fall back on.
The integrator's derivative check hit these and rejected correct antiderivatives in Rubi's suites (#1338). Five of those were large rational expressions: a factor near 1e-316 times one near 1e+316 came out 0, and a factor flushed to 0 times one saturated to infinity came out NaN. Another divided 2.40e-45 by 2.23e-91. The check now uses interval evaluation (#1497), which has none of these limits.
With downcasting off,
EvalNumericalloses decimals at three limits:PrecisionErrorZeroRange(1e-16) counts as zero (Number.IsZero), so the quotient isNaN.DecimalPrecisionContextisnew EContext(100, ERounding.HalfUp, -100, 1000, false), which bounds exponents to [-100, 1000]. At 100 digits, a decimal below about 1e-199 becomes zero and one above 1e1000 becomes infinite.LostToExponentRangeworks around this for an exact ratio, but a decimal has no exact value to fall back on.The integrator's derivative check hit these and rejected correct antiderivatives in Rubi's suites (#1338). Five of those were large rational expressions: a factor near 1e-316 times one near 1e+316 came out 0, and a factor flushed to 0 times one saturated to infinity came out
NaN. Another divided 2.40e-45 by 2.23e-91. The check now uses interval evaluation (#1497), which has none of these limits.