-
Notifications
You must be signed in to change notification settings - Fork 170
Integers do not get casted in operations with complex variables #1524
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
Comments
All the operations work correctly with
|
Thanks, I'll have a look. |
Are you trying this on the It works fine for me: from ltypes import c32
def f():
y: c32
y = complex(5)+c32(100)
print(y)
y = complex(5)*c32(10)
print(y)
f() LPython:
CPython:
|
Yes, I cannot confirm right now but I think the example you are writing worked with the main branch for me as well, it's when you do |
Could you run the exact examples which I have given in the issue and recheck ? I had typed |
That throws some other error: from ltypes import c32
def f():
y: c32
y = complex(5)+100
print(y)
f() Output:
Can you provide the exact snippet you tried and also please make sure you are using |
Sure I'll do that soon . Thankfully the snippet leads to an error only, so raising this issue wasn't a waste ! |
Yes those above results were run on the main branch. I checked now.
And same incompatibility is shown by all binary operators. Can someone confirm this once ? I am using a windows machine |
That is the output we expect. |
Hey @Smit-create
If it is still what is expected I'll close this issue soon. Thanks ! |
Can you please provide the complete python snippet you are trying so that I can reproduce the same results? I am unable to get these results on the |
Uh oh!
There was an error while loading. Please reload this page.
While playing with the complex module I saw certain expressions giving incorrect results .In Python, when an
integer
is operated with objects ofcomplex()
class theinteger
is implicitly casted to a complex variable with0
imaginary value.The text was updated successfully, but these errors were encountered: