Mercurial > hg > qm-dsp
diff maths/MathUtilities.cpp @ 360:a694700f71d8
Factorial: return double (int not big enough for many popular values)
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 16 Oct 2013 16:44:14 +0100 |
parents | a067c2eeb13c |
children | 7e8d1f26b098 |
line wrap: on
line diff
--- a/maths/MathUtilities.cpp Wed Oct 16 13:29:00 2013 +0100 +++ b/maths/MathUtilities.cpp Wed Oct 16 16:44:14 2013 +0100 @@ -379,11 +379,11 @@ else return n1; } -int +double MathUtilities::factorial(int x) { if (x < 0) return 0; - int f = 1; + double f = 1; for (int i = 1; i <= x; ++i) { f = f * i; }