expm1 function

double expm1(
  1. double x
)

Implementation

double expm1(double x) {
  if (x.abs() < 1e-5) return x + 0.5 * x * x;
  return math.exp(x) - 1;
}