We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b00cba commit 50471ccCopy full SHA for 50471cc
1 file changed
src/runtime/math.py
@@ -498,9 +498,9 @@ def lcm(a: i32, b: i32) -> i32:
498
a_ = -a_
499
if b_ < 0:
500
b_ = -b_
501
- if a_*b_ == 0:
+ if a_ == 0 or b_ == 0:
502
return 0
503
- return i32((a_*b_)//gcd(a_, b_))
+ return i32((a_ // gcd(a_, b_)) * b_)
504
505
506
def copysign(x: f64, y: f64) -> f64:
@@ -517,7 +517,11 @@ def hypot(x: i32, y: i32) -> f64:
517
"""
518
Returns the hypotenuse of the right triangle with sides `x` and `y`.
519
520
- return sqrt(f64(1.0)*f64(x**2 + y**2))
+ xf: f64
521
+ yf: f64
522
+ xf = f64(x)
523
+ yf = f64(y)
524
+ return sqrt(xf**2.0 + yf**2.0)
525
526
@overload
527
def trunc(x: f64) -> i64:
0 commit comments