rStats.js v1.3.0
    Preparing search index...

    Function log1pexp

    • log(1 + exp(x)), without overflow for large x and accurate for very negative x. Not an R function. R has it only in its C API (Rmath.h), as log1pexp; the DPQ package also has it.

      Parameters

      • x: number

        A number.

      Returns number

      log(1 + exp(x)); 0 at x = -Infinity, Infinity at x = Infinity.

      log1pexp(800); // 800
      log1pexp(-40); // 4.248354255291589e-18