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

docs(python): Explain how Polars floor division differs from Python #16054

Merged
merged 5 commits into from
May 10, 2024

Conversation

bertiewooster
Copy link
Contributor

@bertiewooster bertiewooster commented May 5, 2024

Adds an example explaining how Polars does floating-point division, then does the flooring operation. Fixes #14614.

@orlp is this explanation good?

Polars instead first does the floating-point division, resulting in a floating-point value of 60.0, and then performs the flooring operation using floor

The goal is to explain why Polars' division operation of 6.0 / 0.1 does not also, like Python, give 59.999___ (and then floor it to 59.0) considering that 0.1 is represented in the computer as slightly greater than 0.1.

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels May 5, 2024
@ritchie46 ritchie46 merged commit eabca7a into pola-rs:main May 10, 2024
13 of 14 checks passed
@bertiewooster
Copy link
Contributor Author

Thanks for reviewing and merging! For future reference, the changes are live in the dev docs, and will appear in the default stable docs upon the next release.

@bertiewooster bertiewooster deleted the document-floordiv branch May 17, 2024 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve documentation for floordiv
3 participants