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

The // operator is not truncation for negative numbers. #30

Open
VizIT opened this issue Oct 16, 2021 · 0 comments
Open

The // operator is not truncation for negative numbers. #30

VizIT opened this issue Oct 16, 2021 · 0 comments

Comments

@VizIT
Copy link

VizIT commented Oct 16, 2021

In 04-Semantics-Operators.ipynb the // operator is described as
a // b | Floor division | Quotient of a and b, removing fractional parts
and
Floor division is true division with fractional parts truncated
Which works for the examples provided. However, in an active Jupyter notebook with negative numbers we see
-5/2 => -2.5
and
-5//2 => -3
This is what one would expect from floor division, but the text is a bit misleading in this case. From the text one would expect -2 here.

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

1 participant