BUG: amos/amos.h: fix loop upper bound in buni#93
Open
JaRoSchm wants to merge 1 commit intoscipy:mainfrom
Open
BUG: amos/amos.h: fix loop upper bound in buni#93JaRoSchm wants to merge 1 commit intoscipy:mainfrom
buni#93JaRoSchm wants to merge 1 commit intoscipy:mainfrom
Conversation
Fix the upper bound of the loop in buni, which was incorrectly translated from FORTRAN. This allowed to access the result array out of its bounds.
buni
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.
Hi, I detected this error in the same way as in #92. This time I used
z = 90.0 - 3.0jandn = 30in https://github.com/JaRoSchm/pyamos/blob/main/compare_xsf_zbessel.py for finding the bug. This was simply incorrectly translated from FORTRAN, see https://github.com/scipy/scipy/blob/4edfcaa3ce8a387450b6efce968572def71be089/scipy/special/amos/zbuni.f#L114, where only the lower bound has been shifted by one but not the upper bound. Askis reduced by one for each loop, it will become -1 during the last iteration, such thatyas accessed at -1. Regarding testing the same question/comment from #92 applies.