DoxigAlpha

expm1

Returns e raised to the power of x, minus 1 (e^x - 1). This is more accurate than exp(e, x) - 1 when x is near 0.

Special Cases:

  • expm1(+inf) = +inf
  • expm1(-inf) = -1
  • expm1(nan) = nan

Function parameters

Parameters

#
x:anytype

Returns e raised to the power of x, minus 1 (e^x - 1).

Functions

#
expm1
Returns e raised to the power of x, minus 1 (e^x - 1).

Source

Implementation

#
pub fn expm1(x: anytype) @TypeOf(x) {
    const T = @TypeOf(x);
    return switch (T) {
        f32 => expm1_32(x),
        f64 => expm1_64(x),
        else => @compileError("exp1m not implemented for " ++ @typeName(T)),
    };
}