Skip to content
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

Python integers division should give a C# result of float/double type #16

Open
BrunoGagnon-Eaton opened this issue Feb 27, 2018 · 2 comments

Comments

@BrunoGagnon-Eaton
Copy link

Currently, the code is just forwarded ‘as is’ during conversion and gives a C# result of type integer. The problem appy to Python (3.x and more).

Example:

Py: b=3; r= 1/b # r = 0.3333333333333
C#: int b=3; var r= 1/b; // r = 0 !!!
C# (expected example): int b=3; var r= 1/(float)(b); // r = 0.3333333333333

@uxmal
Copy link
Owner

uxmal commented Feb 27, 2018

Should be easy enough to fix

@uxmal
Copy link
Owner

uxmal commented Mar 6, 2018

On second thought, I will leave this open until Python type inference is completed. I don't want to sprinkle unnecessary casts in the code if pytocs can prove a variable is a numeric type that will be promoted to floating point by the C# compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants