approxExp static method
Compute an approximation of 2^63 * ccs * exp(-x).
Both x and ccs MUST be positive. Mirrors the reference's exact
big-integer fixed-point evaluation; the result can be up to ~2^63, which
is why it is returned as a BigInt (web-safe).
Implementation
static BigInt approxExp(double x, double ccs) {
// y and z are always positive.
var y = c[0];
// x >= 0, so truncation toward zero equals floor.
var z = BigInt.from((x * _twoPow63).floorToDouble());
for (var i = 1; i < c.length; i++) {
y = c[i] - ((z * y) >> 63);
}
z = BigInt.from((ccs * _twoPow63).floorToDouble()) << 1;
y = (z * y) >> 63;
return y;
}