Go to the first, previous, next, last section, table of contents.


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.

Predefined Mathematical Constants

The header `math.h' defines several useful mathematical constants. All values are defined as preprocessor macros starting with M_. The values provided are:

M_E
The base of natural logarithms.
M_LOG2E
The logarithm to base 2 of M_E.
M_LOG10E
The logarithm to base 10 of M_E.
M_LN2
The natural logarithm of 2.
M_LN10
The natural logarithm of 10.
M_PI
Pi, the ratio of a circle's circumference to its diameter.
M_PI_2
Pi divided by two.
M_PI_4
Pi divided by four.
M_1_PI
The reciprocal of pi (1/pi)
M_2_PI
Two times the reciprocal of pi.
M_2_SQRTPI
Two times the reciprocal of the square root of pi.
M_SQRT2
The square root of two.
M_SQRT1_2
The reciprocal of the square root of two (also the square root of 1/2).

These constants come from the Unix98 standard and were also available in 4.4BSD; therefore they are only defined if _BSD_SOURCE or _XOPEN_SOURCE=500, or a more general feature select macro, is defined. The default set of features includes these constants. See section Feature Test Macros.

All values are of type double. As an extension, the GNU C library also defines these constants with type long double. The long double macros have a lowercase `l' appended to their names: M_El, M_PIl, and so forth. These are only available if _GNU_SOURCE is defined.

Note: Some programs use a constant named PI which has the same value as M_PI. This constant is not standard; it may have appeared in some old AT&T headers, and is mentioned in Stroustrup's book on C++. It infringes on the user's name space, so the GNU C library does not define it. Fixing programs written to expect it is simple: replace PI with M_PI throughout, or put `-DPI=M_PI' on the compiler command line.

Trigonometric Functions

These are the familiar sin, cos, and tan functions. The arguments to all of these functions are in units of radians; recall that pi radians equals 180 degrees.

The math library normally defines M_PI to a double approximation of pi. If strict ISO and/or POSIX compliance are requested this constant is not defined, but you can easily define it yourself:

#define M_PI 3.14159265358979323846264338327

You can also compute the value of pi with the expression acos (-1.0).

Function: double sin (double x)
Function: float sinf (float x)
Function: long double sinl (long double x)
These functions return the sine of x, where x is given in radians. The return value is in the range -1 to 1.

Function: double cos (double x)
Function: float cosf (float x)
Function: long double cosl (long double x)
These functions return the cosine of x, where x is given in radians. The return value is in the range -1 to 1.

Function: double tan (double x)
Function: float tanf (float x)
Function: long double tanl (long double x)
These functions return the tangent of x, where x is given in radians.

Mathematically, the tangent function has singularities at odd multiples of pi/2. If the argument x is too close to one of these singularities, tan will signal overflow.

In many applications where sin and cos are used, the sine and cosine of the same angle are needed at the same time. It is more efficient to compute them simultaneously, so the library provides a function to do that.

Function: void sincos (double x, double *sinx, double *cosx)
Function: void sincosf (float x, float *sinx, float *cosx)
Function: void sincosl (long double x, long double *sinx, long double *cosx)
These functions return the sine of x in *sinx and the cosine of x in *cos, where x is given in radians. Both values, *sinx and *cosx, are in the range of -1 to 1.

This function is a GNU extension. Portable programs should be prepared to cope with its absence.

ISO C99 defines variants of the trig functions which work on complex numbers. The GNU C library provides these functions, but they are only useful if your compiler supports the new complex types defined by the standard. (As of this writing GCC supports complex numbers, but there are bugs in the implementation.)

Function: complex double csin (complex double z)
Function: complex float csinf (complex float z)
Function: complex long double csinl (complex long double z)
These functions return the complex sine of z. The mathematical definition of the complex sine is

@ifnottex @math{sin (z) = 1/(2*i) * (exp (z*i) - exp (-z*i))}.

Function: complex double ccos (complex double z)
Function: complex float ccosf (complex float z)
Function: complex long double ccosl (complex long double z)
These functions return the complex cosine of z. The mathematical definition of the complex cosine is

@ifnottex @math{cos (z) = 1/2 * (exp (z*i) + exp (-z*i))}

Function: complex double ctan (complex double z)
Function: complex float ctanf (complex float z)
Function: complex long double ctanl (complex long double z)
These functions return the complex tangent of z. The mathematical definition of the complex tangent is

@ifnottex @math{tan (z) = -i * (exp (z*i) - exp (-z*i)) / (exp (z*i) + exp (-z*i))}

The complex tangent has poles at @math{pi/2 + 2n}, where @math{n} is an integer. ctan may signal overflow if z is too close to a pole.

Inverse Trigonometric Functions

These are the usual arc sine, arc cosine and arc tangent functions, which are the inverses of the sine, cosine and tangent functions respectively.

Function: double asin (double x)
Function: float asinf (float x)
Function: long double asinl (long double x)
These functions compute the arc sine of x---that is, the value whose sine is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between -pi/2 and pi/2 (inclusive).

The arc sine function is defined mathematically only over the domain -1 to 1. If x is outside the domain, asin signals a domain error.

Function: double acos (double x)
Function: float acosf (float x)
Function: long double acosl (long double x)
These functions compute the arc cosine of x---that is, the value whose cosine is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between 0 and pi (inclusive).

The arc cosine function is defined mathematically only over the domain -1 to 1. If x is outside the domain, acos signals a domain error.

Function: double atan (double x)
Function: float atanf (float x)
Function: long double atanl (long double x)
These functions compute the arc tangent of x---that is, the value whose tangent is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between -pi/2 and pi/2 (inclusive).

Function: double atan2 (double y, double x)
Function: float atan2f (float y, float x)
Function: long double atan2l (long double y, long double x)
This function computes the arc tangent of y/x, but the signs of both arguments are used to determine the quadrant of the result, and x is permitted to be zero. The return value is given in radians and is in the range -pi to pi, inclusive.

If x and y are coordinates of a point in the plane, atan2 returns the signed angle between the line from the origin to that point and the x-axis. Thus, atan2 is useful for converting Cartesian coordinates to polar coordinates. (To compute the radial coordinate, use hypot; see section Exponentiation and Logarithms.)

If both x and y are zero, atan2 returns zero.

ISO C99 defines complex versions of the inverse trig functions.

Function: complex double casin (complex double z)
Function: complex float casinf (complex float z)
Function: complex long double casinl (complex long double z)
These functions compute the complex arc sine of z---that is, the value whose sine is z. The value returned is in radians.

Unlike the real-valued functions, casin is defined for all values of z.

Function: complex double cacos (complex double z)
Function: complex float cacosf (complex float z)
Function: complex long double cacosl (complex long double z)
These functions compute the complex arc cosine of z---that is, the value whose cosine is z. The value returned is in radians.

Unlike the real-valued functions, cacos is defined for all values of z.

Function: complex double catan (complex double z)
Function: complex float catanf (complex float z)
Function: complex long double catanl (complex long double z)
These functions compute the complex arc tangent of z---that is, the value whose tangent is z. The value is in units of radians.

Exponentiation and Logarithms

Function: double exp (double x)
Function: float expf (float x)
Function: long double expl (long double x)
These functions compute e (the base of natural logarithms) raised to the power x.

If the magnitude of the result is too large to be representable, exp signals overflow.

Function: double exp2 (double x)
Function: float exp2f (float x)
Function: long double exp2l (long double x)
These functions compute 2 raised to the power x. Mathematically, exp2 (x) is the same as exp (x * log (2)).

Function: double exp10 (double x)
Function: float exp10f (float x)
Function: long double exp10l (long double x)
Function: double pow10 (double x)
Function: float pow10f (float x)
Function: long double pow10l (long double x)
These functions compute 10 raised to the power x. Mathematically, exp10 (x) is the same as exp (x * log (10)).

These functions are GNU extensions. The name exp10 is preferred, since it is analogous to exp and exp2.

Function: double log (double x)
Function: float logf (float x)
Function: long double logl (long double x)
These functions compute the natural logarithm of x. exp (log (x)) equals x, exactly in mathematics and approximately in C.

If x is negative, log signals a domain error. If x is zero, it returns negative infinity; if x is too close to zero, it may signal overflow.

Function: double log10 (double x)
Function: float log10f (float x)
Function: long double log10l (long double x)
These functions return the base-10 logarithm of x. log10 (x) equals log (x) / log (10).

Function: double log2 (double x)
Function: float log2f (float x)
Function: long double log2l (long double x)
These functions return the base-2 logarithm of x. log2 (x) equals log (x) / log (2).

Function: double logb (double x)
Function: float logbf (float x)
Function: long double logbl (long double x)
These functions extract the exponent of x and return it as a floating-point value. If FLT_RADIX is two, logb is equal to floor (log2 (x)), except it's probably faster.

If x is de-normalized, logb returns the exponent x would have if it were normalized. If x is infinity (positive or negative), logb returns @math{@infinity{}}. If x is zero, logb returns @math{@infinity{}}. It does not signal.

Function: int ilogb (double x)
Function: int ilogbf (float x)
Function: int ilogbl (long double x)
These functions are equivalent to the corresponding logb functions except that they return signed integer values.

Since integers cannot represent infinity and NaN, ilogb instead returns an integer that can't be the exponent of a normal floating-point number. `math.h' defines constants so you can check for this.

Macro: int FP_ILOGB0
ilogb returns this value if its argument is 0. The numeric value is either INT_MIN or -INT_MAX.

This macro is defined in ISO C99.

Macro: int FP_ILOGBNAN
ilogb returns this value if its argument is NaN. The numeric value is either INT_MIN or INT_MAX.

This macro is defined in ISO C99.

These values are system specific. They might even be the same. The proper way to test the result of ilogb is as follows:

i = ilogb (f);
if (i == FP_ILOGB0 || i == FP_ILOGBNAN)
  {
    if (isnan (f))
      {
        /* Handle NaN.  */
      }
    else if (f  == 0.0)
      {
        /* Handle 0.0.  */
      }
    else
      {
        /* Some other value with large exponent,
           perhaps +Inf.  */
      }
  }

Function: double pow (double base, double power)
Function: float powf (float base, float power)
Function: long double powl (long double base, long double power)
These are general exponentiation functions, returning base raised to power.

Mathematically, pow would return a complex number when base is negative and power is not an integral value. pow can't do that, so instead it signals a domain error. pow may also underflow or overflow the destination type.

Function: double sqrt (double x)
Function: float sqrtf (float x)
Function: long double sqrtl (long double x)
These functions return the nonnegative square root of x.

If x is negative, sqrt signals a domain error. Mathematically, it should return a complex number.

Function: double cbrt (double x)
Function: float cbrtf (float x)
Function: long double cbrtl (long double x)
These functions return the cube root of x. They cannot fail; every representable real value has a representable real cube root.

Function: double hypot (double x, double y)
Function: float hypotf (float x, float y)
Function: long double hypotl (long double x, long double y)
These functions return sqrt (x*x + y*y). This is the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. Using this function instead of the direct formula is wise, since the error is much smaller. See also the function cabs in section Absolute Value.

Function: double expm1 (double x)
Function: float expm1f (float x)
Function: long double expm1l (long double x)
These functions return a value equivalent to exp (x) - 1. They are computed in a way that is accurate even if x is near zero--a case where exp (x) - 1 would be inaccurate owing to subtraction of two numbers that are nearly equal.

Function: double log1p (double x)
Function: float log1pf (float x)
Function: long double log1pl (long double x)
These functions returns a value equivalent to log (1 + x). They are computed in a way that is accurate even if x is near zero.

ISO C99 defines complex variants of some of the exponentiation and logarithm functions.

Function: complex double cexp (complex double z)
Function: complex float cexpf (complex float z)
Function: complex long double cexpl (complex long double z)
These functions return e (the base of natural logarithms) raised to the power of z. Mathematically, this corresponds to the value

@ifnottex @math{exp (z) = exp (creal (z)) * (cos (cimag (z)) + I * sin (cimag (z)))}

Function: complex double clog (complex double z)
Function: complex float clogf (complex float z)
Function: complex long double clogl (complex long double z)
These functions return the natural logarithm of z. Mathematically, this corresponds to the value

@ifnottex @math{log (z) = log (cabs (z)) + I * carg (z)}

clog has a pole at 0, and will signal overflow if z equals or is very close to 0. It is well-defined for all other values of z.

Function: complex double clog10 (complex double z)
Function: complex float clog10f (complex float z)
Function: complex long double clog10l (complex long double z)
These functions return the base 10 logarithm of the complex value z. Mathematically, this corresponds to the value

@ifnottex @math{log (z) = log10 (cabs (z)) + I * carg (z)}

These functions are GNU extensions.

Function: complex double csqrt (complex double z)
Function: complex float csqrtf (complex float z)
Function: complex long double csqrtl (complex long double z)
These functions return the complex square root of the argument z. Unlike the real-valued functions, they are defined for all values of z.

Function: complex double cpow (complex double base, complex double power)
Function: complex float cpowf (complex float base, complex float power)
Function: complex long double cpowl (complex long double base, complex long double power)
These functions return base raised to the power of power. This is equivalent to cexp (y * clog (x))

Hyperbolic Functions

The functions in this section are related to the exponential functions; see section Exponentiation and Logarithms.

Function: double sinh (double x)
Function: float sinhf (float x)
Function: long double sinhl (long double x)
These functions return the hyperbolic sine of x, defined mathematically as (exp (x) - exp (-x)) / 2. They may signal overflow if x is too large.

Function: double cosh (double x)
Function: float coshf (float x)
Function: long double coshl (long double x)
These function return the hyperbolic cosine of x, defined mathematically as (exp (x) + exp (-x)) / 2. They may signal overflow if x is too large.

Function: double tanh (double x)
Function: float tanhf (float x)
Function: long double tanhl (long double x)
These functions return the hyperbolic tangent of x, defined mathematically as sinh (x) / cosh (x). They may signal overflow if x is too large.

There are counterparts for the hyperbolic functions which take complex arguments.

Function: complex double csinh (complex double z)
Function: complex float csinhf (complex float z)
Function: complex long double csinhl (complex long double z)
These functions return the complex hyperbolic sine of z, defined mathematically as (exp (z) - exp (-z)) / 2.

Function: complex double ccosh (complex double z)
Function: complex float ccoshf (complex float z)
Function: complex long double ccoshl (complex long double z)
These functions return the complex hyperbolic cosine of z, defined mathematically as (exp (z) + exp (-z)) / 2.

Function: complex double ctanh (complex double z)
Function: complex float ctanhf (complex float z)
Function: complex long double ctanhl (complex long double z)
These functions return the complex hyperbolic tangent of z, defined mathematically as csinh (z) / ccosh (z).

Function: double asinh (double x)
Function: float asinhf (float x)
Function: long double asinhl (long double x)
These functions return the inverse hyperbolic sine of x---the value whose hyperbolic sine is x.

Function: double acosh (double x)
Function: float acoshf (float x)
Function: long double acoshl (long double x)
These functions return the inverse hyperbolic cosine of x---the value whose hyperbolic cosine is x. If x is less than 1, acosh signals a domain error.

Function: double atanh (double x)
Function: float atanhf (float x)
Function: long double atanhl (long double x)
These functions return the inverse hyperbolic tangent of x---the value whose hyperbolic tangent is x. If the absolute value of x is greater than 1, atanh signals a domain error; if it is equal to 1, atanh returns infinity.

Function: complex double casinh (complex double z)
Function: complex float casinhf (complex float z)
Function: complex long double casinhl (complex long double z)
These functions return the inverse complex hyperbolic sine of z---the value whose complex hyperbolic sine is z.

Function: complex double cacosh (complex double z)
Function: complex float cacoshf (complex float z)
Function: complex long double cacoshl (complex long double z)
These functions return the inverse complex hyperbolic cosine of z---the value whose complex hyperbolic cosine is z. Unlike the real-valued functions, there are no restrictions on the value of z.

Function: complex double catanh (complex double z)
Function: complex float catanhf (complex float z)
Function: complex long double catanhl (complex long double z)
These functions return the inverse complex hyperbolic tangent of z---the value whose complex hyperbolic tangent is z. Unlike the real-valued functions, there are no restrictions on the value of z.

Special Functions

These are some more exotic mathematical functions which are sometimes useful. Currently they only have real-valued versions.

Function: double erf (double x)
Function: float erff (float x)
Function: long double erfl (long double x)
erf returns the error function of x. The error function is defined as @ifnottex
erf (x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt

Function: double erfc (double x)
Function: float erfcf (float x)
Function: long double erfcl (long double x)
erfc returns 1.0 - erf(x), but computed in a fashion that avoids round-off error when x is large.

Function: double lgamma (double x)
Function: float lgammaf (float x)
Function: long double lgammal (long double x)
lgamma returns the natural logarithm of the absolute value of the gamma function of x. The gamma function is defined as @ifnottex
gamma (x) = integral from 0 to @infinity{} of t^(x-1) e^-t dt

The sign of the gamma function is stored in the global variable signgam, which is declared in `math.h'. It is 1 if the intermediate result was positive or zero, or -1 if it was negative.

To compute the real gamma function you can use the tgamma function or you can compute the values as follows:

lgam = lgamma(x);
gam  = signgam*exp(lgam);

The gamma function has singularities at the non-positive integers. lgamma will raise the zero divide exception if evaluated at a singularity.

Function: double lgamma_r (double x, int *signp)
Function: float lgammaf_r (float x, int *signp)
Function: long double lgammal_r (long double x, int *signp)
lgamma_r is just like lgamma, but it stores the sign of the intermediate result in the variable pointed to by signp instead of in the signgam global. This means it is reentrant.

Function: double gamma (double x)
Function: float gammaf (float x)
Function: long double gammal (long double x)
These functions exist for compatibility reasons. They are equivalent to lgamma etc. It is better to use lgamma since for one the name reflects better the actual computation, moreover lgamma is standardized in ISO C99 while gamma is not.

Function: double tgamma (double x)
Function: float tgammaf (float x)
Function: long double tgammal (long double x)
tgamma applies the gamma function to x. The gamma function is defined as @ifnottex
gamma (x) = integral from 0 to @infinity{} of t^(x-1) e^-t dt

This function was introduced in ISO C99.

Function: double j0 (double x)
Function: float j0f (float x)
Function: long double j0l (long double x)
j0 returns the Bessel function of the first kind of order 0 of x. It may signal underflow if x is too large.

Function: double j1 (double x)
Function: float j1f (float x)
Function: long double j1l (long double x)
j1 returns the Bessel function of the first kind of order 1 of x. It may signal underflow if x is too large.

Function: double jn (int n, double x)
Function: float jnf (int n, float x)
Function: long double jnl (int n, long double x)
jn returns the Bessel function of the first kind of order n of x. It may signal underflow if x is too large.

Function: double y0 (double x)
Function: float y0f (float x)
Function: long double y0l (long double x)
y0 returns the Bessel function of the second kind of order 0 of x. It may signal underflow if x is too large. If x is negative, y0 signals a domain error; if it is zero, y0 signals overflow and returns @math{-@infinity}.

Function: double y1 (double x)
Function: float y1f (float x)
Function: long double y1l (long double x)
y1 returns the Bessel function of the second kind of order 1 of x. It may signal underflow if x is too large. If x is negative, y1 signals a domain error; if it is zero, y1 signals overflow and returns @math{-@infinity}.

Function: double yn (int n, double x)
Function: float ynf (int n, float x)
Function: long double ynl (int n, long double x)
yn returns the Bessel function of the second kind of order n of x. It may signal underflow if x is too large. If x is negative, yn signals a domain error; if it is zero, yn signals overflow and returns @math{-@infinity}.

Known Maximum Errors in Math Functions

This section lists the known errors of the functions in the math library. Errors are measured in "units of the last place". This is a measure for the relative error. For a number @math{z} with the representation @math{d.d...d@mul{}2^e} (we assume IEEE floating-point numbers with base 2) the ULP is represented by

@ifnottex

|d.d...d - (z / 2^e)| / 2^(p - 1)

where @math{p} is the number of bits in the mantissa of the floating-point number representation. Ideally the error for all functions is always less than 0.5ulps. Using rounding bits this is also possible and normally implemented for the basic operations. To achieve the same for the complex math functions requires a lot more work and this was not spend so far.

Therefore many of the functions in the math library have errors. The table lists the maximum error for each function which is exposed by one of the existing tests in the test suite. It is tried to cover as much as possible and really list the maximum error (or at least a ballpark figure) but this is often not achieved due to the large search space.

The table lists the ULP values for different architectures. Different architectures have different results since their hardware support for floating-point operations varies and also the existing hardware support is different.

@multitable {nexttowardf} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000} {1000 + i 1000}

  • Function @tab s390/fpu @tab sh/sh4/fpu @tab ia64/fpu @tab sparc/sparc64/fpu @tab sparc/sparc32/fpu @tab powerpc/fpu @tab mips/fpu @tab m68k/fpu @tab ix86 @tab Generic @tab arm @tab alpha/fpu
  • acosf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • acos @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • acosl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab 1 @tab 1150 @tab - @tab - @tab -
  • acoshf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • acosh @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • acoshl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab 1 @tab 1 @tab - @tab - @tab -
  • asinf @tab 2 @tab 2 @tab - @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab - @tab - @tab 2 @tab 2
  • asin @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • asinl @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 1 @tab 1 @tab - @tab - @tab -
  • asinhf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • asinh @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • asinhl @tab - @tab - @tab 656 @tab - @tab - @tab - @tab - @tab 14 @tab 656 @tab - @tab - @tab -
  • atanf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • atan @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • atanl @tab - @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 549 @tab - @tab - @tab -
  • atanhf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • atanh @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • atanhl @tab - @tab - @tab 1605 @tab - @tab - @tab - @tab - @tab - @tab 1605 @tab - @tab - @tab -
  • atan2f @tab 4 @tab 4 @tab - @tab 4.0000 @tab 4.0000 @tab 4 @tab 4 @tab - @tab - @tab - @tab - @tab 4
  • atan2 @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • atan2l @tab - @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 549 @tab - @tab - @tab -
  • cabsf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • cabs @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab - @tab 1 @tab 1
  • cabsl @tab - @tab - @tab 560 @tab - @tab - @tab - @tab - @tab 1 @tab 560 @tab - @tab - @tab -
  • cacosf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 2 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 2 @tab 1 + i 2 @tab - @tab 1 + i 1 @tab 1 + i 1
  • cacos @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab - @tab 1 + i 0 @tab 1 + i 0
  • cacosl @tab - @tab - @tab 151 + i 329 @tab 0 + i 3 @tab - @tab - @tab - @tab 1 + i 1 @tab 151 + i 329 @tab - @tab - @tab -
  • cacoshf @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 3 @tab 7 + i 0 @tab 4 + i 4 @tab - @tab 7 + i 3 @tab 7 + i 3
  • cacosh @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • cacoshl @tab - @tab - @tab 328 + i 151 @tab 5 + i 1 @tab - @tab - @tab - @tab 6 + i 2 @tab 328 + i 151 @tab - @tab - @tab -
  • cargf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • carg @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cargl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • casinf @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 2 @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 2 @tab 2 + i 2 @tab - @tab 2 + i 1 @tab 2 + i 1
  • casin @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab 3 + i 0 @tab - @tab 3 + i 0 @tab 3 + i 0
  • casinl @tab - @tab - @tab 603 + i 329 @tab 1 + i 3 @tab - @tab - @tab - @tab 1 + i 1 @tab 603 + i 329 @tab - @tab - @tab -
  • casinhf @tab 1 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 19 + i 2 @tab 1 + i 6 @tab - @tab 1 + i 6 @tab 1 + i 6
  • casinh @tab 5 + i 3 @tab 5 + i 3 @tab 5 + i 3 @tab 5 + i 3 @tab 5 + i 3 @tab 5 + i 3 @tab 5 + i 3 @tab 6 + i 13 @tab 5 + i 3 @tab - @tab 5 + i 3 @tab 5 + i 3
  • casinhl @tab - @tab - @tab 892 + i 12 @tab 4 + i 2 @tab - @tab - @tab - @tab 6 + i 7 @tab 892 + i 12 @tab - @tab - @tab -
  • catanf @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab - @tab 4 + i 1 @tab 4 + i 1
  • catan @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab - @tab 0 + i 1 @tab 0 + i 1
  • catanl @tab - @tab - @tab 251 + i 474 @tab 0 + i 1 @tab - @tab - @tab - @tab 1 + i 7 @tab 251 + i 474 @tab - @tab - @tab -
  • catanhf @tab 1 + i 6 @tab 1 + i 6 @tab 0 + i 6 @tab 1 + i 6 @tab 1 + i 6 @tab 0 + i 6 @tab 1 + i 6 @tab - @tab 1 + i 0 @tab - @tab 1 + i 6 @tab 1 + i 6
  • catanh @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab 4 + i 1 @tab - @tab 2 + i 0 @tab - @tab 4 + i 1 @tab 4 + i 1
  • catanhl @tab - @tab - @tab 66 + i 447 @tab - @tab - @tab - @tab - @tab 2 + i 2 @tab 66 + i 447 @tab - @tab - @tab -
  • cbrtf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cbrt @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • cbrtl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab 948 @tab 716 @tab - @tab - @tab -
  • ccosf @tab 0 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab - @tab 0 + i 1 @tab 0 + i 1
  • ccos @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • ccosl @tab - @tab - @tab 5 + i 1901 @tab - @tab - @tab - @tab - @tab 0 + i 1 @tab 5 + i 1901 @tab - @tab - @tab -
  • ccoshf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 3 + i 1 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • ccosh @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 0 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • ccoshl @tab - @tab - @tab 1467 + i 1183 @tab - @tab - @tab - @tab - @tab 1 + i 2 @tab 1467 + i 1183 @tab - @tab - @tab -
  • ceilf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • ceil @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • ceill @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cexpf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 3 + i 2 @tab 1 + i 0 @tab - @tab 1 + i 1 @tab 1 + i 1
  • cexp @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab - @tab - @tab - @tab 1 + i 0 @tab 1 + i 0
  • cexpl @tab - @tab - @tab 940 + i 1067 @tab 1 + i 1 @tab - @tab - @tab - @tab 2 + i 0 @tab 940 + i 1067 @tab - @tab - @tab -
  • cimagf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cimag @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cimagl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • clogf @tab 0 + i 3 @tab 0 + i 3 @tab 0 + i 3 @tab 0 + i 3 @tab 0 + i 3 @tab 0 + i 3 @tab 0 + i 3 @tab - @tab - @tab - @tab 0 + i 3 @tab 0 + i 3
  • clog @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab - @tab - @tab - @tab 0 + i 1 @tab 0 + i 1
  • clogl @tab - @tab - @tab 0 + i 1 @tab - @tab - @tab - @tab - @tab 0 + i 1 @tab 0 + i 1 @tab - @tab - @tab -
  • clog10f @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 5 @tab 1 + i 1 @tab 1 + i 1 @tab - @tab 1 + i 5 @tab 1 + i 5
  • clog10 @tab 1 + i 1 @tab 1 + i 1 @tab 2 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 2 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • clog10l @tab - @tab - @tab 1402 + i 186 @tab - @tab - @tab - @tab - @tab 1 + i 3 @tab 1403 + i 186 @tab - @tab - @tab -
  • conjf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • conj @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • conjl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • copysignf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • copysign @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • copysignl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cosf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • cos @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab 2 @tab 2
  • cosl @tab - @tab - @tab 529 @tab 1 @tab - @tab - @tab - @tab 1 @tab 529 @tab - @tab - @tab -
  • coshf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cosh @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • coshl @tab - @tab - @tab 2 @tab - @tab - @tab - @tab - @tab 2 @tab 309 @tab - @tab - @tab -
  • cpowf @tab 4 + i 2 @tab 4 + i 2 @tab 5 + i 2.5333 @tab 4 + i 2 @tab 4 + i 2 @tab 4 + i 2 @tab 4 + i 2 @tab 1 + i 6 @tab 4 + i 2.5333 @tab - @tab 4 + i 2 @tab 4 + i 2
  • cpow @tab 1 + i 1.1031 @tab 1 + i 1.1031 @tab 1 + i 1.104 @tab 1 + i 1.1031 @tab 1 + i 1.1031 @tab 1 + i 2 @tab 1 + i 1.1031 @tab 1 + i 1.103 @tab 1 + i 1.104 @tab - @tab 1 + i 1.1031 @tab 1 + i 1.1031
  • cpowl @tab - @tab - @tab 1 + i 4 @tab 3 + i 0.9006 @tab - @tab - @tab - @tab 5 + i 2 @tab 2 + i 9 @tab - @tab - @tab -
  • cprojf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cproj @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • cprojl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • crealf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • creal @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • creall @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • csinf @tab 0 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab - @tab - @tab 0 + i 1 @tab 0 + i 1
  • csin @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • csinl @tab - @tab - @tab 966 + i 168 @tab - @tab - @tab - @tab - @tab - @tab 966 + i 168 @tab - @tab - @tab -
  • csinhf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • csinh @tab 0 + i 1 @tab 0 + i 1 @tab 1 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab 0 + i 1 @tab - @tab 1 + i 1 @tab - @tab 0 + i 1 @tab 0 + i 1
  • csinhl @tab - @tab - @tab 413 + i 477 @tab - @tab - @tab - @tab - @tab 1 + i 2 @tab 413 + i 477 @tab - @tab - @tab -
  • csqrtf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 2 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 0 @tab - @tab - @tab 1 + i 1 @tab 1 + i 1
  • csqrt @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab 1 + i 0 @tab - @tab 1 + i 0 @tab - @tab 1 + i 0 @tab 1 + i 0
  • csqrtl @tab - @tab - @tab 237 + i 128 @tab 1 + i 1 @tab - @tab - @tab - @tab - @tab 237 + i 128 @tab - @tab - @tab -
  • ctanf @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 0 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • ctan @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 1 @tab 1 + i 0 @tab 1 + i 1 @tab - @tab 1 + i 1 @tab 1 + i 1
  • ctanl @tab - @tab - @tab 690 + i 367 @tab - @tab - @tab - @tab - @tab 439 + i 2 @tab 690 + i 367 @tab - @tab - @tab -
  • ctanhf @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 2 @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 1 @tab 2 + i 1 @tab 1 + i 0 @tab 1 + i 1 @tab - @tab 2 + i 1 @tab 2 + i 1
  • ctanh @tab 2 + i 2 @tab 2 + i 2 @tab 2 + i 2 @tab 2 + i 2 @tab 2 + i 2 @tab 2 + i 2 @tab 2 + i 2 @tab 0 + i 1 @tab 0 + i 1 @tab - @tab 2 + i 2 @tab 2 + i 2
  • ctanhl @tab - @tab - @tab 286 + i 3074 @tab - @tab - @tab - @tab - @tab 2 + i 25 @tab 286 + i 3074 @tab - @tab - @tab -
  • erff @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • erf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • erfl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • erfcf @tab 12 @tab 12 @tab 12 @tab 12 @tab 12 @tab 12 @tab 12 @tab 11 @tab 12 @tab - @tab 12 @tab 12
  • erfc @tab 24 @tab 24 @tab 24 @tab 24 @tab 24 @tab 24 @tab 24 @tab 24 @tab 24 @tab - @tab 24 @tab 24
  • erfcl @tab - @tab - @tab 12 @tab - @tab - @tab - @tab - @tab 12 @tab 36 @tab - @tab - @tab -
  • expf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • exp @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • expl @tab - @tab - @tab 412 @tab - @tab - @tab - @tab - @tab - @tab 412 @tab - @tab - @tab -
  • exp10f @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab - @tab - @tab 2 @tab 2
  • exp10 @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 1 @tab 1 @tab - @tab 6 @tab 6
  • exp10l @tab - @tab - @tab 1182 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1182 @tab - @tab - @tab -
  • exp2f @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • exp2 @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • exp2l @tab - @tab - @tab 462 @tab - @tab - @tab - @tab - @tab - @tab 462 @tab - @tab - @tab -
  • expm1f @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1
  • expm1 @tab - @tab - @tab 1 @tab 1 @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • expm1l @tab - @tab - @tab 825 @tab - @tab - @tab - @tab - @tab 1 @tab 825 @tab - @tab - @tab -
  • fabsf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fabs @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fabsl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fdimf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fdim @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fdiml @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • floorf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • floor @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • floorl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmaf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fma @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmal @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmaxf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmax @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmaxl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fminf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmin @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fminl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • fmodf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • fmod @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab 2 @tab 2
  • fmodl @tab - @tab - @tab 4096 @tab 2 @tab - @tab - @tab - @tab 1 @tab 4096 @tab - @tab - @tab -
  • frexpf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • frexp @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • frexpl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • gammaf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • gamma @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab - @tab 1 @tab - @tab - @tab -
  • gammal @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 1 @tab 1 @tab - @tab - @tab -
  • hypotf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • hypot @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab - @tab 1 @tab 1
  • hypotl @tab - @tab - @tab 560 @tab - @tab - @tab - @tab - @tab 1 @tab 560 @tab - @tab - @tab -
  • ilogbf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • ilogb @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • ilogbl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • j0f @tab 2 @tab 2 @tab 1 @tab 2 @tab 2 @tab 1 @tab 2 @tab 1 @tab 1 @tab - @tab 2 @tab 2
  • j0 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 1 @tab 2 @tab - @tab 2 @tab 2
  • j0l @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • j1f @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 1 @tab - @tab 2 @tab 2
  • j1 @tab 1 @tab 1 @tab 2 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 2 @tab - @tab 1 @tab 1
  • j1l @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab 2 @tab 2 @tab - @tab - @tab -
  • jnf @tab 4 @tab 4 @tab 4 @tab 4 @tab 4 @tab 4 @tab 4 @tab 11 @tab 2 @tab - @tab 4 @tab 4
  • jn @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 6 @tab 4 @tab 4 @tab - @tab 6 @tab 6
  • jnl @tab - @tab - @tab 2 @tab - @tab - @tab - @tab - @tab 2 @tab 2 @tab - @tab - @tab -
  • lgammaf @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab 2 @tab 2
  • lgamma @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • lgammal @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 1 @tab 1 @tab - @tab - @tab -
  • lrintf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • lrint @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • lrintl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llrintf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llrint @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llrintl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • logf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • logl @tab - @tab - @tab 2341 @tab 1 @tab - @tab - @tab - @tab 2 @tab 2341 @tab - @tab - @tab -
  • log10f @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log10 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log10l @tab - @tab - @tab 2033 @tab - @tab - @tab - @tab - @tab 1 @tab 2033 @tab - @tab - @tab -
  • log1pf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log1p @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log1pl @tab - @tab - @tab 585 @tab - @tab - @tab - @tab - @tab 2 @tab 585 @tab - @tab - @tab -
  • log2f @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log2 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • log2l @tab - @tab - @tab 1688 @tab - @tab - @tab - @tab - @tab 1 @tab 1688 @tab - @tab - @tab -
  • logbf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • logb @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • logbl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • lroundf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • lround @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • lroundl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llroundf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llround @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • llroundl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • modff @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • modf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • modfl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nearbyintf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nearbyint @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nearbyintl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nextafterf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nextafter @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nextafterl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nexttowardf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nexttoward @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • nexttowardl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • powf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • pow @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • powl @tab - @tab - @tab 725 @tab - @tab - @tab - @tab - @tab 1 @tab 725 @tab - @tab - @tab -
  • remainderf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • remainder @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • remainderl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • remquof @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • remquo @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • remquol @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • rintf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • rint @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • rintl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • roundf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • round @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • roundl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalb @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbnf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbn @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbnl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalblnf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalbln @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • scalblnl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • sinf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • sin @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • sinl @tab - @tab - @tab 627 @tab - @tab - @tab - @tab - @tab 1 @tab 627 @tab - @tab - @tab -
  • sincosf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • sincos @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • sincosl @tab - @tab - @tab 627 @tab 1 @tab - @tab - @tab - @tab 1 @tab 627 @tab - @tab - @tab -
  • sinhf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • sinh @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1
  • sinhl @tab - @tab - @tab 1029 @tab - @tab - @tab - @tab - @tab - @tab 1029 @tab - @tab - @tab -
  • sqrtf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • sqrt @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • sqrtl @tab - @tab - @tab 489 @tab 1 @tab - @tab - @tab - @tab - @tab 489 @tab - @tab - @tab -
  • tanf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • tan @tab 0.5 @tab 0.5 @tab 0.5 @tab 0.5 @tab 0.5 @tab 1 @tab 0.5 @tab 0.5 @tab 0.5 @tab - @tab 0.5 @tab 0.5
  • tanl @tab - @tab - @tab 1401 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1401 @tab - @tab - @tab -
  • tanhf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1
  • tanh @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab - @tab - @tab 1 @tab 1
  • tanhl @tab - @tab - @tab 521 @tab - @tab - @tab - @tab - @tab - @tab 521 @tab - @tab - @tab -
  • tgammaf @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab - @tab 1 @tab 1
  • tgamma @tab 1 @tab 1 @tab 2 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 2 @tab - @tab 1 @tab 1
  • tgammal @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 1 @tab 2 @tab - @tab - @tab -
  • truncf @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • trunc @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • truncl @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab - @tab -
  • y0f @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 1 @tab 2 @tab 1 @tab - @tab 1 @tab 1
  • y0 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 3 @tab - @tab 2 @tab 2
  • y0l @tab - @tab - @tab 2 @tab - @tab - @tab - @tab - @tab 2 @tab 2 @tab - @tab - @tab -
  • y1f @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab - @tab 2 @tab 2
  • y1 @tab 3 @tab 3 @tab 3 @tab 3 @tab 3 @tab 3 @tab 3 @tab 1 @tab 3 @tab - @tab 3 @tab 3
  • y1l @tab - @tab - @tab 1 @tab - @tab - @tab - @tab - @tab 2 @tab 2 @tab - @tab - @tab -
  • ynf @tab 2 @tab 2 @tab 3 @tab 2 @tab 2 @tab 2 @tab 2 @tab 2 @tab 3 @tab - @tab 2 @tab 2
  • yn @tab 3 @tab 3 @tab 6 @tab 3 @tab 3 @tab 3 @tab 3 @tab 6 @tab 6 @tab - @tab 3 @tab 3
  • ynl @tab - @tab - @tab 7 @tab - @tab - @tab - @tab - @tab 7 @tab 7 @tab - @tab - @tab -

    Pseudo-Random Numbers

    This section describes the GNU facilities for generating a series of pseudo-random numbers. The numbers generated are not truly random; typically, they form a sequence that repeats periodically, with a period so large that you can ignore it for ordinary purposes. The random number generator works by remembering a seed value which it uses to compute the next random number and also to compute a new seed.

    Although the generated numbers look unpredictable within one run of a program, the sequence of numbers is exactly the same from one run to the next. This is because the initial seed is always the same. This is convenient when you are debugging a program, but it is unhelpful if you want the program to behave unpredictably. If you want a different pseudo-random series each time your program runs, you must specify a different seed each time. For ordinary purposes, basing the seed on the current time works well.

    You can obtain repeatable sequences of numbers on a particular machine type by specifying the same initial seed value for the random number generator. There is no standard meaning for a particular seed value; the same seed, used in different C libraries or on different CPU types, will give you different random numbers.

    The GNU library supports the standard ISO C random number functions plus two other sets derived from BSD and SVID. The BSD and ISO C functions provide identical, somewhat limited functionality. If only a small number of random bits are required, we recommend you use the ISO C interface, rand and srand. The SVID functions provide a more flexible interface, which allows better random number generator algorithms, provides more random bits (up to 48) per call, and can provide random floating-point numbers. These functions are required by the XPG standard and therefore will be present in all modern Unix systems.

    ISO C Random Number Functions

    This section describes the random number functions that are part of the ISO C standard.

    To use these facilities, you should include the header file `stdlib.h' in your program.

    Macro: int RAND_MAX
    The value of this macro is an integer constant representing the largest value the rand function can return. In the GNU library, it is 2147483647, which is the largest signed integer representable in 32 bits. In other libraries, it may be as low as 32767.

    Function: int rand (void)
    The rand function returns the next pseudo-random number in the series. The value ranges from 0 to RAND_MAX.

    Function: void srand (unsigned int seed)
    This function establishes seed as the seed for a new series of pseudo-random numbers. If you call rand before a seed has been established with srand, it uses the value 1 as a default seed.

    To produce a different pseudo-random series each time your program is run, do srand (time (0)).

    POSIX.1 extended the C standard functions to support reproducible random numbers in multi-threaded programs. However, the extension is badly designed and unsuitable for serious work.

    Function: int rand_r (unsigned int *seed)
    This function returns a random number in the range 0 to RAND_MAX just as rand does. However, all its state is stored in the seed argument. This means the RNG's state can only have as many bits as the type unsigned int has. This is far too few to provide a good RNG.

    If your program requires a reentrant RNG, we recommend you use the reentrant GNU extensions to the SVID random number generator. The POSIX.1 interface should only be used when the GNU extensions are not available.

    BSD Random Number Functions

    This section describes a set of random number generation functions that are derived from BSD. There is no advantage to using these functions with the GNU C library; we support them for BSD compatibility only.

    The prototypes for these functions are in `stdlib.h'.

    Function: long int random (void)
    This function returns the next pseudo-random number in the sequence. The value returned ranges from 0 to RAND_MAX.

    Note: Temporarily this function was defined to return a int32_t value to indicate that the return value always contains 32 bits even if long int is wider. The standard demands it differently. Users must always be aware of the 32-bit limitation, though.

    Function: void srandom (unsigned int seed)
    The srandom function sets the state of the random number generator based on the integer seed. If you supply a seed value of 1, this will cause random to reproduce the default set of random numbers.

    To produce a different set of pseudo-random numbers each time your program runs, do srandom (time (0)).

    Function: void * initstate (unsigned int seed, void *state, size_t size)
    The initstate function is used to initialize the random number generator state. The argument state is an array of size bytes, used to hold the state information. It is initialized based on seed. The size must be between 8 and 256 bytes, and should be a power of two. The bigger the state array, the better.

    The return value is the previous value of the state information array. You can use this value later as an argument to setstate to restore that state.

    Function: void * setstate (void *state)
    The setstate function restores the random number state information state. The argument must have been the result of a previous call to initstate or setstate.

    The return value is the previous value of the state information array. You can use this value later as an argument to setstate to restore that state.

    If the function fails the return value is NULL.

    The four functions described so far in this section all work on a state which is shared by all threads. The state is not directly accessible to the user and can only be modified by these functions. This makes it hard to deal with situations where each thread should have its own pseudo-random number generator.

    The GNU C library contains four additional functions which contain the state as an explicit parameter and therefore make it possible to handle thread-local PRNGs. Beside this there are no difference. In fact, the four functions already discussed are implemented internally using the following interfaces.

    The `stdlib.h' header contains a definition of the following type:

    Data Type: struct random_data

    Objects of type struct random_data contain the information necessary to represent the state of the PRNG. Although a complete definition of the type is present the type should be treated as opaque.

    The functions modifying the state follow exactly the already described functions.

    Function: int random_r (struct random_data *restrict buf, int32_t *restrict result)
    The random_r function behaves exactly like the random function except that it uses and modifies the state in the object pointed to by the first parameter instead of the global state.

    Function: int srandom_r (unsigned int seed, struct random_data *buf)
    The srandom_r function behaves exactly like the srandom function except that it uses and modifies the state in the object pointed to by the second parameter instead of the global state.

    Function: int initstate_r (unsigned int seed, char *restrict statebuf, size_t statelen, struct random_data *restrict buf)
    The initstate_r function behaves exactly like the initstate function except that it uses and modifies the state in the object pointed to by the fourth parameter instead of the global state.

    Function: int setstate_r (char *restrict statebuf, struct random_data *restrict buf)
    The setstate_r function behaves exactly like the setstate function except that it uses and modifies the state in the object pointed to by the first parameter instead of the global state.

    SVID Random Number Function

    The C library on SVID systems contains yet another kind of random number generator functions. They use a state of 48 bits of data. The user can choose among a collection of functions which return the random bits in different forms.

    Generally there are two kinds of function. The first uses a state of the random number generator which is shared among several functions and by all threads of the process. The second requires the user to handle the state.

    All functions have in common that they use the same congruential formula with the same constants. The formula is

    Y = (a * X + c) mod m
    

    where X is the state of the generator at the beginning and Y the state at the end. a and c are constants determining the way the generator works. By default they are

    a = 0x5DEECE66D = 25214903917
    c = 0xb = 11
    

    but they can also be changed by the user. m is of course 2^48 since the state consists of a 48-bit array.

    The prototypes for these functions are in `stdlib.h'.

    Function: double drand48 (void)
    This function returns a double value in the range of 0.0 to 1.0 (exclusive). The random bits are determined by the global state of the random number generator in the C library.

    Since the double type according to IEEE 754 has a 52-bit mantissa this means 4 bits are not initialized by the random number generator. These are (of course) chosen to be the least significant bits and they are initialized to 0.

    Function: double erand48 (unsigned short int xsubi[3])
    This function returns a double value in the range of 0.0 to 1.0 (exclusive), similarly to drand48. The argument is an array describing the state of the random number generator.

    This function can be called subsequently since it updates the array to guarantee random numbers. The array should have been initialized before initial use to obtain reproducible results.

    Function: long int lrand48 (void)
    The lrand48 function returns an integer value in the range of 0 to 2^31 (exclusive). Even if the size of the long int type can take more than 32 bits, no higher numbers are returned. The random bits are determined by the global state of the random number generator in the C library.

    Function: long int nrand48 (unsigned short int xsubi[3])
    This function is similar to the lrand48 function in that it returns a number in the range of 0 to 2^31 (exclusive) but the state of the random number generator used to produce the random bits is determined by the array provided as the parameter to the function.

    The numbers in the array are updated afterwards so that subsequent calls to this function yield different results (as is expected of a random number generator). The array should have been initialized before the first call to obtain reproducible results.

    Function: long int mrand48 (void)
    The mrand48 function is similar to lrand48. The only difference is that the numbers returned are in the range -2^31 to 2^31 (exclusive).

    Function: long int jrand48 (unsigned short int xsubi[3])
    The jrand48 function is similar to nrand48. The only difference is that the numbers returned are in the range -2^31 to 2^31 (exclusive). For the xsubi parameter the same requirements are necessary.

    The internal state of the random number generator can be initialized in several ways. The methods differ in the completeness of the information provided.

    Function: void srand48 (long int seedval)
    The srand48 function sets the most significant 32 bits of the internal state of the random number generator to the least significant 32 bits of the seedval parameter. The lower 16 bits are initialized to the value 0x330E. Even if the long int type contains more than 32 bits only the lower 32 bits are used.

    Owing to this limitation, initialization of the state of this function is not very useful. But it makes it easy to use a construct like srand48 (time (0)).

    A side-effect of this function is that the values a and c from the internal state, which are used in the congruential formula, are reset to the default values given above. This is of importance once the user has called the lcong48 function (see below).

    Function: unsigned short int * seed48 (unsigned short int seed16v[3])
    The seed48 function initializes all 48 bits of the state of the internal random number generator from the contents of the parameter seed16v. Here the lower 16 bits of the first element of see16v initialize the least significant 16 bits of the internal state, the lower 16 bits of seed16v[1] initialize the mid-order 16 bits of the state and the 16 lower bits of seed16v[2] initialize the most significant 16 bits of the state.

    Unlike srand48 this function lets the user initialize all 48 bits of the state.

    The value returned by seed48 is a pointer to an array containing the values of the internal state before the change. This might be useful to restart the random number generator at a certain state. Otherwise the value can simply be ignored.

    As for srand48, the values a and c from the congruential formula are reset to the default values.

    There is one more function to initialize the random number generator which enables you to specify even more information by allowing you to change the parameters in the congruential formula.

    Function: void lcong48 (unsigned short int param[7])
    The lcong48 function allows the user to change the complete state of the random number generator. Unlike srand48 and seed48, this function also changes the constants in the congruential formula.

    From the seven elements in the array param the least significant 16 bits of the entries param[0] to param[2] determine the initial state, the least significant 16 bits of param[3] to param[5] determine the 48 bit constant a and param[6] determines the 16-bit value c.

    All the above functions have in common that they use the global parameters for the congruential formula. In multi-threaded programs it might sometimes be useful to have different parameters in different threads. For this reason all the above functions have a counterpart which works on a description of the random number generator in the user-supplied buffer instead of the global state.

    Please note that it is no problem if several threads use the global state if all threads use the functions which take a pointer to an array containing the state. The random numbers are computed following the same loop but if the state in the array is different all threads will obtain an individual random number generator.

    The user-supplied buffer must be of type struct drand48_data. This type should be regarded as opaque and not manipulated directly.

    Function: int drand48_r (struct drand48_data *buffer, double *result)
    This function is equivalent to the drand48 function with the difference that it does not modify the global random number generator parameters but instead the parameters in the buffer supplied through the pointer buffer. The random number is returned in the variable pointed to by result.

    The return value of the function indicates whether the call succeeded. If the value is less than 0 an error occurred and errno is set to indicate the problem.

    This function is a GNU extension and should not be used in portable programs.

    Function: int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
    The erand48_r function works like erand48, but in addition it takes an argument buffer which describes the random number generator. The state of the random number generator is taken from the xsubi array, the parameters for the congruential formula from the global random number generator data. The random number is returned in the variable pointed to by result.

    The return value is non-negative if the call succeeded.

    This function is a GNU extension and should not be used in portable programs.

    Function: int lrand48_r (struct drand48_data *buffer, double *result)
    This function is similar to lrand48, but in addition it takes a pointer to a buffer describing the state of the random number generator just like drand48.

    If the return value of the function is non-negative the variable pointed to by result contains the result. Otherwise an error occurred.

    This function is a GNU extension and should not be used in portable programs.

    Function: int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
    The nrand48_r function works like nrand48 in that it produces a random number in the range 0 to 2^31. But instead of using the global parameters for the congruential formula it uses the information from the buffer pointed to by buffer. The state is described by the values in xsubi.

    If the return value is non-negative the variable pointed to by result contains the result.

    This function is a GNU extension and should not be used in portable programs.

    Function: int mrand48_r (struct drand48_data *buffer, double *result)
    This function is similar to mrand48 but like the other reentrant functions it uses the random number generator described by the value in the buffer pointed to by buffer.

    If the return value is non-negative the variable pointed to by result contains the result.

    This function is a GNU extension and should not be used in portable programs.

    Function: int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
    The jrand48_r function is similar to jrand48. Like the other reentrant functions of this function family it uses the congruential formula parameters from the buffer pointed to by buffer.

    If the return value is non-negative the variable pointed to by result contains the result.

    This function is a GNU extension and should not be used in portable programs.

    Before any of the above functions are used the buffer of type struct drand48_data should be initialized. The easiest way to do this is to fill the whole buffer with null bytes, e.g. by

    memset (buffer, '\0', sizeof (struct drand48_data));
    

    Using any of the reentrant functions of this family now will automatically initialize the random number generator to the default values for the state and the parameters of the congruential formula.

    The other possibility is to use any of the functions which explicitly initialize the buffer. Though it might be obvious how to initialize the buffer from looking at the parameter to the function, it is highly recommended to use these functions since the result might not always be what you expect.

    Function: int srand48_r (long int seedval, struct drand48_data *buffer)
    The description of the random number generator represented by the information in buffer is initialized similarly to what the function srand48 does. The state is initialized from the parameter seedval and the parameters for the congruential formula are initialized to their default values.

    If the return value is non-negative the function call succeeded.

    This function is a GNU extension and should not be used in portable programs.

    Function: int seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer)
    This function is similar to srand48_r but like seed48 it initializes all 48 bits of the state from the parameter seed16v.

    If the return value is non-negative the function call succeeded. It does not return a pointer to the previous state of the random number generator like the seed48 function does. If the user wants to preserve the state for a later re-run s/he can copy the whole buffer pointed to by buffer.

    This function is a GNU extension and should not be used in portable programs.

    Function: int lcong48_r (unsigned short int param[7], struct drand48_data *buffer)
    This function initializes all aspects of the random number generator described in buffer with the data in param. Here it is especially true that the function does more than just copying the contents of param and buffer. More work is required and therefore it is important to use this function rather than initializing the random number generator directly.

    If the return value is non-negative the function call succeeded.

    This function is a GNU extension and should not be used in portable programs.

    Is Fast Code or Small Code preferred?

    If an application uses many floating point functions it is often the case that the cost of the function calls themselves is not negligible. Modern processors can often execute the operations themselves very fast, but the function call disrupts the instruction pipeline.

    For this reason the GNU C Library provides optimizations for many of the frequently-used math functions. When GNU CC is used and the user activates the optimizer, several new inline functions and macros are defined. These new functions and macros have the same names as the library functions and so are used instead of the latter. In the case of inline functions the compiler will decide whether it is reasonable to use them, and this decision is usually correct.

    This means that no calls to the library functions may be necessary, and can increase the speed of generated code significantly. The drawback is that code size will increase, and the increase is not always negligible.

    There are two kind of inline functions: Those that give the same result as the library functions and others that might not set errno and might have a reduced precision and/or argument range in comparison with the library functions. The latter inline functions are only available if the flag -ffast-math is given to GNU CC.

    In cases where the inline functions and macros are not wanted the symbol __NO_MATH_INLINES should be defined before any system header is included. This will ensure that only library functions are used. Of course, it can be determined for each file in the project whether giving this option is preferable or not.

    Not all hardware implements the entire IEEE 754 standard, and even if it does there may be a substantial performance penalty for using some of its features. For example, enabling traps on some processors forces the FPU to run un-pipelined, which can more than double calculation time.


    Go to the first, previous, next, last section, table of contents.