Skip to content

Enhancement 1792: Use float64 as the result type for all division operations in the processing pipeline #1794

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

Conversation

alexowens90
Copy link
Collaborator

Reference Issues/PRs

Closes #1792
Fixes #1791

What does this implement or fix?

Previously, dividing integers by integers in the processing pipeline (e.g. with apply) would perform integer division. This is true for all of column/column, column/value, and value/column.
This is not the same as the behaviour of Pandas or Polars. Worse, if the denominator was zero, this would cause a floating point exception on linux, and an integer overflow exception (#1791) on Windows.

This change makes the result a float64 in all cases. If we want the previous behaviour to be accessible again, we should implement the integer division operator // in Python.

@alexowens90 alexowens90 added enhancement New feature or request api break Requires a new major version (SemVer) labels Aug 23, 2024
@alexowens90 alexowens90 self-assigned this Aug 23, 2024
@alexowens90 alexowens90 merged commit 7479c0b into master Sep 2, 2024
116 checks passed
@alexowens90 alexowens90 deleted the enhancement/1792/treat-output-of-division-operations-as-floats branch September 2, 2024 08:39
grusev pushed a commit that referenced this pull request Nov 25, 2024
…rations in the processing pipeline (#1794)

#### Reference Issues/PRs
Closes #1792 
Fixes #1791 

#### What does this implement or fix?
Previously, dividing integers by integers in the processing pipeline
(e.g. with `apply`) would perform integer division. This is true for all
of `column/column`, `column/value`, and `value/column`.
This is not the same as the behaviour of Pandas or Polars. Worse, if the
denominator was zero, this would cause a floating point exception on
linux, and an integer overflow exception (#1791) on Windows.

This change makes the result a `float64` in all cases. If we want the
previous behaviour to be accessible again, we should implement the
integer division operator `//` in Python.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api break Requires a new major version (SemVer) enhancement New feature or request
Projects
None yet
2 participants