fix: swapped modf outputs in circular variable::value()#438
Open
henryiii wants to merge 1 commit into
Open
Conversation
std::modf returns the fractional part and stores the whole part in its output argument, but the circular branch of variable::value() used the return value as the bin index and the whole part as the interpolation weight. The error cancels for size-2 axes with integer arguments, which is all the old test covered. Assisted-by: ClaudeCode:claude-fable-5
henryiii
marked this pull request as ready for review
July 23, 2026 18:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From #437.
🤖 AI text below 🤖
std::modfreturns the fractional part and stores the whole part in its output argument. The circular branch ofvariable::value()used the return value as the bin indexkand the whole part as the interpolation weightz— exactly swapped. Every fractional index, and every integer index on a non-equidistant circular axis with more than two bins, returned a point on the line through the first two edges instead of the correct edge, sobin(i).lower()/upper()/center()and the printed representation were wrong.The error cancels for size-2 axes with integer arguments, which is all the existing test covered. Added a size-3 non-equidistant regression test (fails with 5 wrong values before the fix) and fixed the variable use.