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

Fix write_float edge case, which crashes NJOY #306

Closed

Conversation

AnderGray
Copy link

@AnderGray AnderGray commented May 2, 2024

There is a strange edge case in write_float where

sandy.records.write_float(0.99999995) 
' 9.999999-1'

but

sandy.records.write_float(0.99999996) 
' 1.000000e+00'

Likely because the string interpolation f"{x:13.6e}" is rounding up to 1.000000e+00, and it isn't caught as a case in the function.

This was giving an annoying error from NJOY Fortran runtime error: Bad value during floating point read, where these strings end up in generated pendf files, and are unable to be read by NJOY.

@luca-fiorito-11
Copy link
Owner

This was fixed (also in principle tested) by @janmalec in #308 as an answer to issue #307.
The changes were pushed to branch v1.1 because we don't touch develop directly.

I guess a release will be issued for v1.1 within the next few months, and only then it will be merged back into develop.

Btw, thanks for spotting this problem.
I invite you to check if v1.1 works fine for you, or else give feedback!

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