Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arithmetic error in calculating refraction #49

Open
ajm143 opened this issue Mar 2, 2022 · 2 comments
Open

Arithmetic error in calculating refraction #49

ajm143 opened this issue Mar 2, 2022 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@ajm143
Copy link
Contributor

ajm143 commented Mar 2, 2022

Describe the bug
Arithmetic error in calculating refraction for a metal

To Reproduce
Use NAG compiler on testopt_optics_drude without -ieee=full flag

Expected behavior
Unclear. I'd like to check what sort of error it is, NaN or Infinity, and check that that's expected behaviour.

Screenshots

Runtime Error: *** Arithmetic exception: Floating invalid operation - aborting
optics.f90, line 778: Error occurred in OD_OPTICS:CALC_REFRACT
optics.f90, line 135: Called by OD_OPTICS:OPTICS_CALCULATE
optados.f90, line 191: Called by OPTADOS
Aborted

Desktop (please complete the following information):

  • NAG compiler
  • Unclear if ifort/gfortran are also unhappy -- would have to check.
@ajm143 ajm143 self-assigned this Mar 2, 2022
@ajm143 ajm143 added the question Further information is requested label Mar 2, 2022
@jryates
Copy link
Member

jryates commented Mar 2, 2022

From a quick look at the line in the code, I can see that there are possibilities for an arithmetic error - it could be divide by zero, or root of a negative numbers (signed zero?). Do we have a view on the intrinsic sqrt vs **0.5_dp. I would have assumed the intrinsic would be faster (although a optimising compiler might replace the power with the intrinsic). But I was wondering if the error message from the intrinsic might be nicer?

@ajm143
Copy link
Contributor Author

ajm143 commented Mar 2, 2022

I think the intrinsic would be nicer.

I flagged it because, when I get a minute, I also want to check the maths/algorithm behind it i.e. should the function go to Infinity / NaN etc... Sure I can make the code compile and run by setting the -ieee flag, but I'd like to check that's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants