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

test: add tests for negative values in math/base/special/fmod #2600

Merged
merged 8 commits into from
Jul 15, 2024

Conversation

gunjjoshi
Copy link
Member

@gunjjoshi gunjjoshi commented Jul 14, 2024

Description

What is the purpose of this pull request?

This pull request:

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

  • I have changed the function that we used to generate test fixtures in julia, from mod to rem. This is because, rem handles negative values in a much better way.
  • When I made this change, the behavior of the function in main.c changed, yielding failures in tests. So, I kept it the same.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Jul 14, 2024
@kgryte
Copy link
Member

kgryte commented Jul 14, 2024

rem seems to be the correct function to test against (ref: JuliaLang/julia#47501), as rem is the native Julia equivalent of fmod. The alternative is not to test against Julia and actually just test against the C standard library directly, as fmod was added in C99. Looking at https://github.com/stdlib-js/stdlib/tree/164a96b61fa0cdd442c29d2af3979033acada25e/tools/snippets/test/fixtures, however, and it seems we don't have a fixture generation script for testing against the C standard library.

Signed-off-by: GUNJ JOSHI <gunjjoshi8372@gmail.com>
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @gunjjoshi!

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Jul 15, 2024
@kgryte kgryte merged commit 08dbbe5 into stdlib-js:develop Jul 15, 2024
7 checks passed
@gunjjoshi gunjjoshi deleted the fmodc branch August 21, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Math Issue or pull request specific to math functionality. Tests Pull requests specifically adding tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants