Skip to content

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

Open
bcliden wants to merge 3 commits intonannou-org:masterfrom
bcliden:fix/fmod-use-trunc
Open

Align nannou_core::math::fmod with C behavior#984
bcliden wants to merge 3 commits intonannou-org:masterfrom
bcliden:fix/fmod-use-trunc

Conversation

@bcliden
Copy link
Copy Markdown

@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