/// <summary>
 /// Compute n!, the <a href="http://mathworld.wolfram.com/Factorial.html">
 /// factorial</a> of <c>n</c> (the product of the numbers 1 to n), as a
 /// <c>double</c>.
 /// The result should be small enough to fit into a <c>double</c>: The
 /// largest <c>n</c> for which <c>n! < Double.MaxValue</c> is 170.
 /// If the computed value exceeds <c>Double.MaxValue</c>,
 /// <c>Double.PositiveInfinity</c> is returned.
 /// </summary>
 /// <param name="n">Argument.</param>
 /// <returns><c>n!</c></returns>
 /// <exception cref="NotPositiveException"> if <c>n < 0</c>.</exception>
 public static double factorialDouble(int n)
 {
     if (n < 0)
     {
         throw new NotPositiveException <Int32>(new LocalizedFormats("FACTORIAL_NEGATIVE_PARAMETER"), n);
     }
     if (n < 21)
     {
         return(FACTORIALS[n]);
     }
     return(FastMath.floor(FastMath.exp(CombinatoricsUtils.factorialLog(n)) + 0.5));
 }
 public static double factorialLog(int n)
 {
     return(CombinatoricsUtils.factorialLog(n));
 }