New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modulo(3rd argument) added to pow #876
Conversation
I think you haven't updated reference tests. Please run, |
@Smit-create I just met @Madhav2310. He said that he is facing some issues with overload operator (he received an error saying only 2 arguments are accepted by 3 provided). Can you fetch his branch and try to run the tests on your machine locally? Let me know if you face the same issue. |
Yes, I get the same error as:
Overload is working fine for the following example: @overload
def a(x: i32) -> i32:
return x+1
@overload
def a(x: i32, y:i32) -> i32:
return x+y
def f():
print(a(2), a(5, 6))
f() |
Can you try for three argument example? |
Works fine. Even this diff also works: diff --git a/src/runtime/math.py b/src/runtime/math.py
index ee0bbed29..81a991713 100644
--- a/src/runtime/math.py
+++ b/src/runtime/math.py
@@ -615,3 +615,9 @@ def remainder(x: f64, y: f64) -> f64:
if x - y*q > y*(q + 1) - x:
return x - y*(q + 1)
return x - y*q
+
+def f():
+ r: i32
+ r = pow(102, 3, 121)
+ print(r)
+f() It prints |
Well, then last option to reproduce @Madhav2310 's error is to just fetch his branch and run the tests locally with his code changes. @namannimmo10 and @Smit-create Can you please do that? |
Ahhh, I got that error because I didn't import
|
CPython's math doesn't have 3 args. See: https://docs.python.org/3/library/math.html#math.pow Python 3.10.2 | packaged by conda-forge | (main, Feb 1 2022, 19:30:18) [Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import pow
>>> pow(23, 24, 13)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: pow expected 2 arguments, got 3 |
e25c2b2
to
0ac2797
Compare
I see. The builtin |
0ac2797
to
9d95ebf
Compare
9d95ebf
to
2b2aa9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
No description provided.