Skip to content

BUG: amos/amos.h: fix translation bugs in binu and rati#138

Open
JaRoSchm wants to merge 1 commit intoscipy:mainfrom
JaRoSchm:amos_binu_rati_fixes
Open

BUG: amos/amos.h: fix translation bugs in binu and rati#138
JaRoSchm wants to merge 1 commit intoscipy:mainfrom
JaRoSchm:amos_binu_rati_fixes

Conversation

@JaRoSchm
Copy link
Copy Markdown

@JaRoSchm JaRoSchm commented May 6, 2026

Reference issue

What does this implement/fix?

Hi, I detected these errors in the same way as in #92. This time I used besj with z = 70.26595687262548 - 0.7026595687262548j and n = 50 in https://github.com/JaRoSchm/pyamos/blob/main/compare_xsf_zbessel.py for finding the bugs. This was simply incorrectly translated from FORTRAN, see https://github.com/scipy/scipy/blob/4edfcaa3ce8a387450b6efce968572def71be089/scipy/special/amos/. Regarding testing the same question/comment from #92 applies.

Additional information

AI Generation Disclosure

No AI tools used

@dschmitz89
Copy link
Copy Markdown
Contributor

Thanks for digging so deep into this difficult code.

Tests should go into this folder. You could mimic the approach from the other tests in that folder. With a little help from the LLM of your choice, it should hopefully not be too difficult (at least that was my experience as someone who never used ctest before). Do you have any specific questions?

Comment thread include/xsf/amos/amos.h
Comment on lines 2790 to +2795
if (nw > 0) {
return -1;
nz = -1;
if (nw == -2) {
nz = -2;
}
return nz;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if condition in 2792 is unreachable as first we check for nw>0 and then for nw==-2. Was this in the original Fortran source?

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.

2 participants