Hi everyone, I'm new to boost (and not so new but not very experienced to c++) and I'm having problems with functions defined with a template, as factorial (http://www.boost.org/doc/libs/1_38_0/libs/math/doc/sf_and_dist/html/math_too...). My questions is, how do I call the funtion factorial? Why isn't it enough calling factorial(n) where n is an unsigned integer? Does one need to define the function specifying the result type before? If so, how? Thanks in advance. Greetings, Alberto.
I'm new to boost (and not so new but not very experienced to c++) and I'm having problems with functions defined with a template, as factorial (http://www.boost.org/doc/libs/1_38_0/libs/math/doc/sf_and_dist/html/math_too...). My questions is, how do I call the funtion factorial? Why isn't it enough calling factorial(n) where n is an unsigned integer? Does one need to define the function specifying the result type before? If so, how? Thanks in advance.
You need to tell the function what you want the return type/precision to be: boost::math::factorial<double>(10); For example, HTH, John.
participants (2)
-
agascon@correo.ugr.es
-
John Maddock