Revision | 3766d64f351dc7bb47cffa82ec66b9db102c5aa5 (tree) |
---|---|
Time | 2013-01-22 04:26:37 |
Author | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Call boost::math::factorial in MolDS_base::Factorial. #30557
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1237 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -23,6 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<stdexcept> |
25 | 25 | #include<boost/format.hpp> |
26 | +#include<boost/math/special_functions/factorials.hpp> | |
26 | 27 | #include"PrintController.h" |
27 | 28 | #include"MolDSException.h" |
28 | 29 | #include"Uncopyable.h" |
@@ -41,12 +42,7 @@ int Factorial(int n){ | ||
41 | 42 | ss << "Error in base::MathUtility::Factorial: n<0 \n"; |
42 | 43 | throw MolDSException(ss.str()); |
43 | 44 | } |
44 | - else if (n>1){ | |
45 | - return n*Factorial(n-1); | |
46 | - } | |
47 | - else{ | |
48 | - return 1; | |
49 | - } | |
45 | + return static_cast<int>(boost::math::factorial<double>(n)); | |
50 | 46 | } |
51 | 47 | |
52 | 48 | // nCk |