Mercurial > hg > qm-dsp
diff maths/MathUtilities.h @ 135:0fdbb93e92b7
Factorial: return double (int not big enough for many popular values)
author | Chris Cannam |
---|---|
date | Wed, 16 Oct 2013 16:44:14 +0100 |
parents | 5351b5e9ad9f |
children | 0d3b3c66652b |
line wrap: on
line diff
--- a/maths/MathUtilities.h Wed Oct 16 13:29:00 2013 +0100 +++ b/maths/MathUtilities.h Wed Oct 16 16:44:14 2013 +0100 @@ -65,7 +65,7 @@ static int previousPowerOfTwo(int x); // e.g. 1300 -> 1024, 2048 -> 2048 static int nearestPowerOfTwo(int x); // e.g. 1300 -> 1024, 12 -> 16 (not 8) - static int factorial(int x); + static double factorial(int x); // returns double in case it is large static int gcd(int a, int b); };