Boost logo

Boost Users :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2008-06-11 04:25:02


Steven Watanabe wrote:
> Here's one way:
>
> #include "boost/math/special_functions/factorials.hpp"
> int main()
> {
> unsigned int i = 6;
> printf("%d\n",
> static_cast<unsigned>(boost::math::factorial<double>(i)));
> }

Ah, yes I missed that he was formatting the result as an integer: note that
there are *very few* factorials that will fit inside an integer result, so
this isn't really safe :-(

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net