DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
System calls and libraries

Math library (libm)

The math library, libm, contains the mathematics functions supplied by the C compilation system. These are described on the Section S manual pages. Here we describe some of the major functions. Note that functions whose names end with the letter f are single-precision versions, which means that their argument and return types are float. Functions whose names end with the letter l are long double-precision versions, which means that their argument and return types are long double. The header file math.h should be included in programs that use math functions.

Math functions

bessel(S) j0 j1 jn Bessel functions
  y0 y1 yn Bessel functions
erf(S) erfc erfcf erfcl return complementary error function of x
  erf erff erfl return error function of x
exp(S) cbrt cbrtf cbrtl cube root function
  exp expf expl exponential, mod, power, square root functions
  exp2 exp2f exp2l exponential function
  expm1 expm1f expm1l exponential function
  frexp frexpf frexpl exponential function
  ldexp ldexpf ldexpl exponential function
  modf modff modfl modulus function
  pow powf powl power function
  pown pownf pownl power function
  scalbln scalblnf scalblnl scalbln function
  scalbn scalbnf scalbnl scalbn function
  sqrt sqrtf sqrtl square root function
fdim(S) fdim fdimf fdiml return positive difference between two arguments
floor(S) ceil ceilf ceill return smallest integer not smaller than x
  copysign copysignf copysignl return x with the sign of y
  fabs fabsf fabsl return the absolute value of x, |x|
  floor floorf floorl return largest integer not greater than x
  fmod fmodf fmodl return the floating point remainder of the division of x by y
  nan nanf nanl return a quiet NaN, if available, with content indicated by tagp
  nearbyint nearbyintf nearbyintl return nearest integer value to floating point argument x
  nextafter nextafterf nextafterl return the next representable value in the specified format after x in the direction of y
  nexttoward nexttowardf nexttowardl return the next representable value in the specified format after x in the direction of y
fma(S) fma fmaf fmal return rounded result of (x x y) + z
fmax(S) fmax fmaxf fmaxl return maximum numeric value of two arguments
  fmin fminf fminl return minimum numeric value of two arguments
fpclassify(S) isfinite     determines whether x has a finite value
  isgreater     determines whether x is greater than y
  isgreaterequal     determines whether x is greater than or equal to y
  isinf     determines whether x is positive or negative infinity
  isles     determines whether x is less than y
  islessequal     determines whether x is less than or equal to y
  islessgreater     determines whether x is less than or greater than y
  isnan     determines whether x is a NaN
  isnormal     determines whether x is not zero, subnormal, infinite, or a NaN
  isunordered     determines whether x and y are unordered
  signbit     determines whether the sign of x is negative
gamma(S) gamma gammaf gammal log gamma function
  lgamma lgammaf lgammal log gamma function
  signgam     storage for sign for gamma and lgamma
  tgamma tgammaf tgammal gamma function
hypot(S) hypot hypotf hypotl return result of sqrt((x x x) + (y x y))
log(S) ilogb ilogbf ilogbl logarithm function
  log logf logl logarithm function
  log10 log10f log10l logarithm function
  log1p log1pf log1pl logarithm function
  log2 log2f log2l logarithm function
  logb logbf logbl logarithm function
matherr(S) matherr matherrl   error-handling function
remainder(S) remainder remainderf remainderl return floating point remainder of division of x by y
  remquo remquof remquol return floating point remainder of division of x by y
rint(S) llrint llrintf llrintl return nearest integer value to floating point argument x
  llround llroundf llroundl return the rounded integer value of x
  lrint lrintf lrintl return nearest integer value to floating point argument x
  lround lroundf lroundl return the rounded integer value of x
  rint rintf rintl return nearest integer value to floating point argument x
  round roundf roundl return the rounded integer value of x
  trunc truncf truncl return the truncated integer value of x
sinh(S) acosh acoshf acoshl return inverse hyperbolic cosine of argument
  asinh asinhf asinhl return inverse hyperbolic sine of argument
  atanh atanhf atanhl return inverse hyperbolic tangent of argument
  cosh coshf coshl return hyperbolic cosine of argument
  sinh sinhf sinhl return hyperbolic sine of argument
  tanh tanhf tanhl return hyperbolic tangent of argument
trig(S) acos acosf acosl return the arccosine of an argument in radians
  asin asinf asinl return the arcsine of an argument in radians
  atan atanf atanl return the arctangent of an argument in radians
  atan2 atan2f atan2l return the arctangent of y/x in radians
  cos cosf cosl return the cosine of an argument in radians
  sin sinf sinl return the sine of an argument in radians
  tan tanf tanl return the tangent of an argument in radians


Next topic: General purpose library (libgen)
Previous topic: Standard I/O functions and macros

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005