Fix surfit y-bounds, percur zero-pivot, and NaN-safe tests#48
Merged
Conversation
Three bug fixes: 1. surfit: y-values were checked against x-bounds instead of y-bounds, causing spurious "invalid input" errors when x/y ranges differed. 2. fp_rotate_row_2mat / fp_rotate_row_2mat_vec: add zero-pivot guards matching original Netlib fpperi.f. Without these, fpgivs computes 0/0 = NaN when both pivot and target are zero. 3. fitpack_curves new_points: use percur workspace formula nest*(8+5*k) instead of curfit's nest*(7+3*k). 4. Test comparisons: use `.not.(expr <= tol)` instead of `expr > tol` so NaN values are caught (IEEE 754: NaN > x is always false).
4 tasks
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.
Summary
yvalues were validated againstxb/xeinstead ofyb/ye, causing spurious "invalid input" errors when x and y data ranges differedif(piv==0)guard matching original Netlibfpperi.f— without it,fpgivscomputes 0/0 = NaN when both pivot and target are zero, silently corrupting periodic spline fitsnew_pointsused curfit'snest*(7+3*k)but percur needsnest*(8+5*k)expr > tolto.not.(expr <= tol)so NaN values are caught (IEEE 754:NaN > xis always false)Test plan
fpm test— 59/59 tests pass