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

Align nannou_core::math::fmod with C behavior #984

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bcliden
Copy link

@bcliden bcliden commented Nov 26, 2024

Hi all,

This PR addresses the minor inconsistency that I brought up in issue #983 (see for more context). In short, during the fmod calculation, truncating (moving towards 0) is more accurate to the original fmod function from C.

I do have a few small notes/questions:

  1. I brought in the float_eq crate as a dev dependency in order to assert against the float values. Is that okay or would you prefer a test assertion that doesn't pull in a dependency? I can hand roll a delta check (or similar) if we would prefer that.
  2. I included the unit test with the math.rs file. I didn't see a strong standard elsewhere in the project. Is this okay or would a doctest or a package-level test (nannou_core/tests/* maybe) be preferable?

Thanks for the opportunity to contribute to the project. Please let me know if there's anything I can update in this PR, I'm happy to do so.

@bcliden bcliden changed the title Align nannou_core::math::fmod with C++ behavior Align nannou_core::math::fmod with C behavior Nov 26, 2024
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.

1 participant