npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
binomialCoefficient.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_BINOMIALCOEFFICIENT_HH_
2 #define NPSTAT_BINOMIALCOEFFICIENT_HH_
3 
4 /*!
5 // \file binomialCoefficient.hh
6 //
7 // \brief Calculate binomial coefficients avoiding overflows
8 //
9 // Author: I. Volobouev
10 //
11 // February 2012
12 */
13 
14 namespace npstat {
15  /**
16  // This code calculates the binomial coefficient C(N, M) trying to avoid
17  // overflows. Throws either std::overflow_error or std::invalid_argument
18  // if things go wrong.
19  */
20  unsigned long binomialCoefficient(unsigned N, unsigned M);
21 
22  /**
23  // Binomial coefficient as a long double. Has much larger dynamic range
24  // than the version which returns unsigned long.
25  */
26  long double ldBinomialCoefficient(unsigned N, unsigned M);
27 }
28 
29 #endif // NPSTAT_BINOMIALCOEFFICIENT_HH_
Definition: AbsArrayProjector.hh:14
long double ldBinomialCoefficient(unsigned N, unsigned M)
unsigned long binomialCoefficient(unsigned N, unsigned M)