BERNUM 3CW "11 December 2009" "mathcw-1.00"

Table of contents


NAME

bernum - n-th Bernoulli number

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float bernumf (int n);

extern double bernum (int n);

extern long double bernuml (int n);

extern __float80 bernumw (int n);

extern __float128 bernumq (int n);

extern long_long_double bernumll (int n);

extern decimal_float bernumdf (int n);

extern decimal_double bernumd (int n);

extern decimal_long_double bernumdl (int n);

extern decimal_long_long_double bernumdll (int n);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Determine the n-th Bernoulli number, B[n], by fast table lookup, where n >= 0.

Such numbers appear in Taylor-series expansions of the trigonometric and hyperbolic tangent, log-gamma, and psi functions, and in several other areas, especially number theory.

Except for B[1], Bernoulli numbers of odd index are zero.

Those of even index are rational numbers that alternate in sign and grow rapidly to the floating-point overflow limit. Because of leading digit loss from subtractions in their recurrence relation, their calculation requires high-precision arithmetic, which is why they are precomputed that way and then rounded and stored to machine precision in a compile-time internal table.

In IEEE 754 32-bit arithmetic, the result is plus/minus Infinity for n > 65. The overflow limits in IEEE 754 64-bit, 80-bit, and 128-bit arithmetic are reached for n values above 259, 2313, and 2313 respectively.


RETURN VALUES

Return the n-th Bernoulli number.

ERRORS

If the argument is negative, set errno to EDOM and return a quiet NaN.

SEE ALSO

betnm1(3CW), betnum(3CW), eulnum(3CW), fibnum(3CW), zetnm1(3CW), zetnum(3CW).