modify return type from Int64 to UInt64

This commit is contained in:
taiyang-li 2022-11-15 09:46:24 +08:00
parent 8a7c7bfb3d
commit 5eba20e119
2 changed files with 3 additions and 3 deletions

View File

@ -553,7 +553,7 @@ Result:
## factorial(n)
Computes the factorial of an integer value. It works with any native integer type including UInt(8|16|32|64) and Int(8|16|32|64). The return type is Int64.
Computes the factorial of an integer value. It works with any native integer type including UInt(8|16|32|64) and Int(8|16|32|64). The return type is UInt64.
The factorial of 0 is 1. Likewise, the factorial() function returns 1 for any negative value. The maximum positive value for the input argument is 20, a value of 21 or greater overflows the range for Int64 and will cause exception throw.

View File

@ -15,7 +15,7 @@ namespace ErrorCodes
template <typename A>
struct FactorialImpl
{
using ResultType = Int64;
using ResultType = UInt64;
static const constexpr bool allow_decimal = false;
static const constexpr bool allow_fixed_string = false;
static const constexpr bool allow_string_integer = false;
@ -101,7 +101,7 @@ REGISTER_FUNCTION(Factorial)
factory.registerFunction<FunctionFactorial>(
{
R"(
Computes the factorial of an integer value. It works with any native integer type including UInt(8|16|32|64) and Int(8|16|32|64). The return type is Int64.
Computes the factorial of an integer value. It works with any native integer type including UInt(8|16|32|64) and Int(8|16|32|64). The return type is UInt64.
The factorial of 0 is 1. Likewise, the factorial() function returns 1 for any negative value. The maximum positive value for the input argument is 20, a value of 21 or greater overflows the range for Int64 and will cause exception throw.
)",