Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/runtime/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,15 @@ def lcm(a: i32, b: i32) -> i32:
"""
Returns least common multiple of `a` and `b`
"""
a_: i32
b_: i32
a_ = a
b_ = b
a_: i32 = a
b_: i32 = b
if a_ < 0:
a_ = -a_
if b_ < 0:
b_ = -b_
if a_*b_ == 0:
if a_ == 0 or b_ == 0:
return 0
return i32((a_*b_)//gcd(a_, b_))
return i32((a_ // gcd(a_, b_)) * b_)


def copysign(x: f64, y: f64) -> f64:
Expand All @@ -517,7 +515,9 @@ def hypot(x: i32, y: i32) -> f64:
"""
Returns the hypotenuse of the right triangle with sides `x` and `y`.
"""
return sqrt(f64(1.0)*f64(x**2 + y**2))
xf: f64 = f64(x)
yf: f64 = f64(y)
return sqrt(xf**2 + yf**2)

@overload
def trunc(x: f64) -> i64:
Expand Down
Loading