expm1

expm1(x)

Accurately compute $e^x-1$.

Examples

In the Julia programming language, the function expm1(x) is used to accurately compute the value of e^x - 1.

julia> expm1(1)
1.718281828459045

julia> expm1(0)
0.0

julia> expm1(-1)
-0.6321205588285577

Here are some common examples of how to use the expm1 function:

  1. Calculate the exponential minus one for a positive number:

    julia> expm1(2)
    6.38905609893065

    This example computes the value of e^2 - 1.

  2. Compute the exponential minus one for zero:

    julia> expm1(0)
    0.0

    It returns 0.0 since e^0 - 1 is zero.

  3. Calculate the exponential minus one for a negative number:
    julia> expm1(-0.5)
    -0.3934693402873666

    This example computes the value of e^(-0.5) - 1.

Common mistake example:

julia> expm1("hello")
ERROR: MethodError: no method matching expm1(::String)

In this example, the input to the expm1 function is a string instead of a number. This function only works with numerical inputs, so ensure that the argument passed is a valid numeric value.

See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: