Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ exp(3M) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ilogb(3C)

isnan(3C)

hypot(3M)

matherr(3M)

sinh(3M)

math(5)

exp(3M)                                                             exp(3M)

NAME
     exp, expf, expm1, cbrt, log, logf, log10, log10f, log1p, pow, powf,
     sqrt, sqrtf - exponential, logarithm, power, square root functions

SYNOPSIS
     cc [flag ...] file ... -lm [library ...]

     cc -O -Ksd [flag ...] file ... -J sfm [library ...]

     #include <math.h>

     double exp(double x);

     float expf(float x);

     double expm1(double x);

     double cbrt(double x);

     double log(double x);

     float logf(float x);

     double log10(double x);

     float log10f(float x);

     double log1p(double x);

     double pow(double x, double y);

     float powf(float x, float y);

     double sqrt(double x);

     float sqrtf(float x);

DESCRIPTION
     exp() and expf() return e^x.

     expm1() computes e^x-1.0.

     cbrt() returns the cube root of x.

     log() and logf() return the natural logarithm of x. The value of x
     must be positive.

     log10() and log10f() return the base ten logarithm of x. The value of
     x must be positive.






Page 1                       Reliant UNIX 5.44                Printed 11/98

exp(3M)                                                             exp(3M)

     log1p() computes loge(1.0 + x). The value of x must be greater than
     -1.0.

     pow() and powf() return x^y. If x is 0, y must be positive. If x is
     negative, y must be an integer.

     sqrt() and sqrtf() return the non-negative square root of x. The value
     of x may not be negative.

RESULT
     exp() and expf() return HUGEVAL when the value would overflow, or 0
     when the value would underflow. errno is set to ERANGE.

     If x is NaN, then expm1 returns NaN and errno may be set to EDOM. If x
     is positive infinity, expm1() returns positive infinity. If x is nega-
     tive infinity, expm1() returns -1.0. If the value overflows, expm1()
     returns HUGEVAL and may set errno to ERANGE.

     The value of expm1(x) may be more accurate than exp(x)-1.0 for small
     values of x.

     The expm1() and log1p() functions are useful for financial calcula-
     tions of ((1+x)^n-1)/x, namely:

          expm1(n * log1p(x))/x

     when x is very small (for example, when calculating small daily
     interest rates). These functions also simplify writing accurate
     inverse hyperbolic functions.

     log(), logf(), log10(), and log10f() return -HUGEVAL and set errno to
     EDOM when x is non-positive. A message indicating DOMAIN error is out-
     put on standard error.

     Upon successful completion, log1p() returns the natural logarithm of
     1.0 + x. If x is NaN, log1p() returns NaN and may set errno to EDOM.
     If x is less than -1.0, log1p() returns -HUGEVAL or NaN and sets
     errno to EDOM. If x is -1.0, log1p() returns -HUGEVAL and may set
     errno to ERANGE.

     pow() and powf() return 0 and set errno to EDOM when x is 0 and y is
     non-positive, or when x is negative and y is not an integer. In these
     cases, a message indicating DOMAIN error is output on standard error.
     When the correct value for pow() or powf() would overflow or under-
     flow, these functions return HUGEVAL or 0, respectively, and set
     errno to ERANGE.

     sqrt() and sqrtf() return 0 and set errno to EDOM when x is negative,
     and a message indicating DOMAIN error is output on standard error.





Page 2                       Reliant UNIX 5.44                Printed 11/98

exp(3M)                                                             exp(3M)

NOTES
     The functions sinhf(), coshf(), and tanhf() can be used in ANSI mode
     only.

SEE ALSO
     ilogb(3C), isnan(3C), hypot(3M), matherr(3M), sinh(3M), math(5).
















































Page 3                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026