Skip to content

fix: swapped modf outputs in circular variable::value()#438

Open
henryiii wants to merge 1 commit into
boostorg:developfrom
henryiii:fix-circular-variable-value
Open

fix: swapped modf outputs in circular variable::value()#438
henryiii wants to merge 1 commit into
boostorg:developfrom
henryiii:fix-circular-variable-value

Conversation

@henryiii

@henryiii henryiii commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

From #437.

🤖 AI text below 🤖

std::modf returns the fractional part and stores the whole part in its output argument. The circular branch of variable::value() used the return value as the bin index k and the whole part as the interpolation weight z — 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, so bin(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.

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
henryiii marked this pull request as ready for review July 23, 2026 18:19
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