next up previous index
Next: B101 Arc Tangent Up: CERNLIB Previous: A105 Multiple-Precision Floating-Point

B100 Binomial Coefficient

Routine ID: B100
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 15.02.1989
Language: FortranRevised: 15.03.1993

Function subprograms BINOM and DBINOM calculate the binomial coefficient

x k =
x(x-1)...(x-k+1)/k! (k>0)

1 (k=0)

0 (k<0)

.

for real x and integer k. Function subprogram KBINOM calculates the binomial coefficient only for integer x=n.

On CDC and Cray computers, the double-precision version DBINOM is not available.

Structure:

FUNCTION subprograms
User Entry Names: BINOM, DBINOM, KBINOM
Files Referenced: Unit 6

Usage:

In any arithmetic expression, BINOM(X,K), DBINOM(X,K) or KBINOM(N,K)

has the value of the binomial coefficient. BINOM is of type REAL, DBINOM is of type DOUBLE PRECISION and X has the same type as the function name. KBINOM, N and K are of type INTEGER.

Restrictions:

Function subprogram KBINOM can compute only binomial coefficients which lie in the integer range of the machine.

Accuracy:

Full machine accuracy.

Error handling:

If the result of KBINOM would lie outside the integer range of the machine, KBINOM is set equal to zero and an error message is printed.

B101


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995