www.delorie.com/gnu/docs/glibc/libc_387.html   search  
Buy the book!

The GNU C Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

19. Mathematics

This chapter contains information about functions for performing mathematical computations, such as trigonometric functions. Most of these functions have prototypes declared in the header file `math.h'. The complex-valued functions are defined in `complex.h'.

All mathematical functions which take a floating-point argument have three variants, one each for double, float, and long double arguments. The double versions are mostly defined in ISO C89. The float and long double versions are from the numeric extensions to C included in ISO C99.

Which of the three versions of a function should be used depends on the situation. For most calculations, the float functions are the fastest. On the other hand, the long double functions have the highest precision. double is somewhere in between. It is usually wise to pick the narrowest type that can accommodate your data. Not all machines have a distinct long double type; it may be the same as double.

19.1 Predefined Mathematical Constants  Precise numeric values for often-used constants.
19.2 Trigonometric Functions  Sine, cosine, tangent, and friends.
19.3 Inverse Trigonometric Functions  Arcsine, arccosine, etc.
19.4 Exponentiation and Logarithms  Also pow and sqrt.
19.5 Hyperbolic Functions  sinh, cosh, tanh, etc.
19.6 Special Functions  Bessel, gamma, erf.
19.7 Known Maximum Errors in Math Functions  
19.8 Pseudo-Random Numbers  Functions for generating pseudo-random numbers.
19.9 Is Fast Code or Small Code preferred?  Fast code or small code.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003