/*Copyright (C) 1992, 1996 by Thomas Glen Smith. All Rights Reserved.*/
/* ibinom APL2 V1.0.0 **************************************************
* The expression - *
* ifactorl(rite) / (ifactorl(left) * ifactorl(rite - left)) *
* yields the equivalent to the binomial function. For positive *
* arguments ibinom(m,n) yields the number of distinct ways in which *
* m things can be chosen from n things. *
***********************************************************************/
#define INCLUDES 0
#include "includes.h"
int ibinom(m,n)
int m,n;
{
Binomp;
int den,i,j,k,num;
double a,b,r;
if (m == n || m == 0) return(1);
if (n >= 0)
if (m > n || m < 0)
return(0);
else;
else /* n < 0 */
if (m < 0 && m > n)
return(0);
a = m;
b = n;
binomp(&a,&b,&r);
return(r);
}