Skip to content

Commit afb2db8

Browse files
committed
Add modf() in math.py
1 parent 271ea2c commit afb2db8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/runtime/math.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88
# TODO: Change floor used inside functions implemented here to
99
# floordiv operator (//) once the multiple import issue is fixed
10-
@overload
10+
11+
def modf(x: f64) -> tuple[f64, i32]:
12+
"""
13+
Return fractional and integral parts of `x` as a pair.
14+
"""
15+
return (x - int(x), int(x))
16+
1117
def factorial(x: i32) -> i32:
1218
"""
1319
Computes the factorial of `x`.

0 commit comments

Comments
 (0)