Skip to content

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

Description

@VizIT

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions