Lines Matching refs:factorial
49 /// Calculates the factorial of a given number.
51 /// \param i The postivie number to calculate the factorial of.
53 /// \return The factorial of i.
55 factorial(const int i)
62 return i * factorial(i - 1);
66 /// A custom factorial function for Lua.
68 /// \pre stack(-1) contains the number to calculate the factorial of.
82 throw std::runtime_error("Argument to factorial must be an integer");
85 throw std::runtime_error("Argument to factorial must be positive");
86 state.push_integer(factorial(i));
110 // Construct a 'module' that contains an entry point to our native factorial
116 module["factorial"] = lua_factorial;
119 // Use a little Lua script to call our native factorial function providing
125 script << "print(native.factorial(" << argv[1] << "))";