Skip to content

Fixing mod calculation to use fmod path#96

Open
SwayamInSync wants to merge 4 commits into
numpy:mainfrom
SwayamInSync:mod-fix
Open

Fixing mod calculation to use fmod path#96
SwayamInSync wants to merge 4 commits into
numpy:mainfrom
SwayamInSync:mod-fix

Conversation

@SwayamInSync
Copy link
Copy Markdown
Member

closes #94

This PR updates the mod implementation of both quad and longdouble backend to use fmod path for high precision correctness.

Note: mod does not dispatches the "signed" NaN values, as NumPy's fmod implementation using libc and which dispatches platform dependent NaN, whose sign has no relation with the divisor. (This is mention as a comment inside code)

Anyways IEEE does not define any meaning to signed NaN values so we are just dispatching unsigned NaN

@SwayamInSync SwayamInSync requested a review from ngoldbaum May 15, 2026 18:59
Copy link
Copy Markdown
Contributor

@juntyr juntyr left a comment

Choose a reason for hiding this comment

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

LGTM with my nit addressed

Comment thread src/include/ops.hpp Outdated
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.

[BUG] np.mod with output outside the divisor range

2 participants