Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ exp(3m) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hypot(3M)

matherr(3M)

sinh(3M)

exp(3M)



exp(3M)                 LIBRARY FUNCTIONS                 exp(3M)



NAME
     exp, expf, cbrt, log, logf, log10, log10f, 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 cbrt (double x);

     double log (double x);

     float logf (float x);

     double log10 (double x);

     float log10f (float 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 ex.

     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.

     pow and powf return xy.  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.

SEE ALSO
     hypot(3M), matherr(3M), sinh(3M).



                                                                1





exp(3M)                 LIBRARY FUNCTIONS                 exp(3M)



DIAGNOSTICS
     exp and expf return HUGE when the correct value would  over-
     flow,  or  0 when the correct value would underflow, and set
     errno to ERANGE.

     log, logf, log10, and log10f return -HUGE and set  errno  to
     EDOM  when  x  is non-positive.  A message indicating DOMAIN
     error is printed on the standard error output.

     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  printed  on the standard error output.  When the correct
     value for pow or powf would  overflow  or  underflow,  these
     functions  return +HUGE or 0, respectively, and set errno to
     ERANGE.

     sqrt and sqrtf return 0 and set errno  to  EDOM  when  x  is
     negative.   A  message indicating DOMAIN error is printed on
     the standard error output.

     Except when  the  -Xc  compilation  option  is  used,  these
     error-handling  procedures  may be changed with the function
     matherr.  When the -Xa or -Xc compilation options are  used,
     HUGEVAL  is  returned instead of HUGE and no error messages
     are printed.  In  these  compilation  modes,  pow  and  powf
     return  1, with no error, when both x and y are 0; when x is
     0 and y is negative, they return -HUGEVAL and set errno  to
     EDOM.   Under  -Xc,  log  and  logf return -HUGEVAL and set
     errno to ERANGE when x is 0.   Under  -Xc,  sqrt  and  sqrtf
     return NaN when x is negative.
























                                                                2



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