Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

exp(3)  —  Subroutines

NAME

exp, expm1, log, log2, log10, log1p, pow − Exponential, logarithm, and power functions

LIBRARY

Math Library (libm.a)

SYNOPSIS

#include <math.h>

double exp    (double x);
float  expf   (float  x);
double expm1  (double x);
float  expm1f (float  x);
double log    (double x);
float  logf   (float  x);
double log2   (double x);
float  log2f  (float  x);
double log10  (double x);
float  log10f (float  x);
double log1p  (double y);
float  log1pf (float  y);
double pow    (double x, double y);
float  powf   (float  x, float  y);

DESCRIPTION

exp() and expf() compute the exponential function of x, defined as e∗∗x, where e is the constant used as a base for natural logarithms. 

expm1() and expm1f() compute exp(x)-1 accurately, even for tiny x. 

log() and logf() compute the natural (base e) logarithm of x. 

log2() and log2f() compute the base 2 logarithm of x. 

log10() and log10f() compute the common (base 10) logarithm of x. 

log1p() and log1pf() compute ln(1+y) accurately, even for tiny y. 

pow() and powf() raise a floating-point base x to a floating-point exponent y. Passing a NaN input value to this routine always produces a NaN result; but for ANSI C, pow(NaN,0) = 1.  pow(x,y) is equivalent to e∗∗(y  ln(x)). 

Function Exceptional Argument Routine Behavior
exp(), expf() x > ln(max_float) overflow
exp(), expf() x < ln(min_float) underflow
expm1(), expm1f() x > ln(max_float) overflow
expm1(), expm1f() x < ln(min_float) underflow
log(), logf() x < 0 invalid argument
log(), logf() x = 0 overflow
log2(), log2f() x < 0 invalid argument
log2(), logf2() x = 0 overflow
log10(), log10f() x < 0 invalid argument
log10(), log10f() x = 0 overflow
log1p(), log1pf() 1+y < 0 invalid argument
log1p(), log1pf() 1+y = 0 overflow
pow(), powf() y ln(x) > ln(max_float) overflow
pow(), powf() y ln(x) < ln(min_float) underflow

Function ANSI C -- Exceptional Argument Routine Behavior
pow(), powf() |x| = 1, |y| = infinity invalid argument
pow(), powf() x < 0,  y is not integral invalid argument

Function FORTRAN -- Exceptional Argument Routine Behavior
pow(), powf() x < 0 invalid argument
pow(), powf() x = 0, y < 0 divide by zero
pow(), powf() x = 0, y = 0 invalid argument
pow(), powf() x = +infinity, y = 0 invalid argument
pow(), powf() x = 1, |y| = infinity invalid argument

Value Data Hexadecimal Value Decimal Value
Name Type

ln(max_float) F_FLOAT 0F3443B0 88.029692
G_FLOAT 7B616E3A28B740A6 709.0895657128241
S_FLOAT 42B17218 88.7228391
T_FLOAT 40862E42FEFA39EF 709.7827128933840
ln(min_float) F_FLOAT 7218C3B1 -88.72284
G_FLOAT 39EFFEFA2E42C0A6 -709.7827128933840
S_FLOAT C2CE8ED0 -103.2789
T_FLOAT C0874385446D71C3 -744.4400719213813

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