Skip to content

Commit

Permalink
Revert setting return type to int
Browse files Browse the repository at this point in the history
  • Loading branch information
kmr-srbh authored Mar 12, 2024
1 parent 6445496 commit 1478355
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def modf(x: f64) -> tuple[f64, f64]:
return (x - f64(int(x)), float(int(x)))


def factorial(n: i32) -> int:
def factorial(n: i32) -> i64:
"""Computes the factorial of `n`."""
MAX_LOOKUP_VALUE: i32 = 20
FACTORIAL_LOOKUP_TABLE: list[i64] = [
Expand Down Expand Up @@ -93,11 +93,11 @@ def factorial(n: i32) -> int:
idx: i32
for idx in range(f_size - 1, -1, -1):
result += str(f[idx])
return int(result)
return i64(0)


@overload
def factorial(n: i64) -> int:
def factorial(n: i64) -> i64:
"""Computes the factorial of `n`."""
MAX_LOOKUP_VALUE: i64 = i64(20)
FACTORIAL_LOOKUP_TABLE: list[i64] = [
Expand Down Expand Up @@ -174,7 +174,7 @@ def factorial(n: i64) -> int:
idx: i32
for idx in range(f_size - 1, -1, -1):
result += str(f[idx])
return int(result)
return i64(0)


@overload
Expand Down

0 comments on commit 1478355

Please sign in to comment.