Skip to content

Fix bug where rho=Infinity gave only NaNs in output

Eskil Vik requested to merge bugfix/fix-infinite-rho into master

Small bugfix to ensure an infinite input for rho does not make the outputs NaN only. Basically entails checking if rho is infinite and treating that case separately, for each layer.

This was already a part of roundchamber.cc, so it should have been part of roundchamber.py from the start as well. Think I must have skipped it because I tested dividing a multiprecision float by infinity, and saw that it gave 0 as intended, but forgot to test complex divided by infinity.

With this MR, roundchamber.cc and roundchamber.py give identical results for ./Tests/IW2D_examples/RoundChamberSiO2Input.txt (and other tests).

Another lesson from this bug: The testing suite should be expanded, at least to run the python scripts agains the reference files, like is done for the C++ executables in ./Tests/run_and_check_IW2D.sh. I will make an issue for this.

Merge request reports

Loading