DoxigAlpha

log1p

Returns the natural logarithm of 1 + x with greater accuracy when x is near zero.

Special Cases:

  • log1p(+inf) = +inf
  • log1p(+-0) = +-0
  • log1p(-1) = -inf
  • log1p(x) = nan if x < -1
  • log1p(nan) = nan

Function parameters

Parameters

#
x:anytype

Returns the natural logarithm of 1 + x with greater accuracy when x is near zero.

Functions

#
log1p
Returns the natural logarithm of 1 + x with greater accuracy when x is near zero.

Source

Implementation

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