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

fix floordiv and mod #51

Merged
merged 3 commits into from
May 15, 2024
Merged

fix floordiv and mod #51

merged 3 commits into from
May 15, 2024

Conversation

willow-ahrens
Copy link
Collaborator

Uses the new fld_nothrow and rem_nothrow functions in Finch to do floor division and remainder on sparse arrays with zeros without erroring.

@mtsokol mtsokol self-requested a review May 15, 2024 12:07
Copy link
Collaborator

@mtsokol mtsokol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I enabled tests. I also added __abs__ to __mod__ function because in Python:

In [75]: -10 % 15
Out[75]: 5

where in Julia:

julia> -10 % 15
-10

@willow-ahrens willow-ahrens merged commit bbc924b into main May 15, 2024
5 checks passed
@willow-ahrens willow-ahrens deleted the wma/floordiv2 branch May 15, 2024 15:07
@hameerabbasi
Copy link
Collaborator

Ouch -- __abs__ was a mistake, imho. We should add the divisor instead if the result is negative.

@willow-ahrens
Copy link
Collaborator Author

got it, there's a fix on its way

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

Successfully merging this pull request may close these issues.

3 participants