Skip to content

Conversation

@islas
Copy link
Contributor

@islas islas commented Jun 12, 2025

All comparisons to glevel1 and glevel2 are against integer values, relying on implicit conversion during the check if done somewhat correctly. When implicit conversion is not done, the floating point to integer .eq. check can easily fail for values that should normally succeed.

Whilst the calculations to generate glevel1 and glevel2 use floating point math, assigning into an integer variable guarantees a float to int conversion is done before the comparison, thus preventing instances where instead of float to int compilers may other arithmetic operations for comparison such as int to float.

All comparisons to glevel1 and glevel2 are against
integer values, relying on implicit conversion
during the check if done somewhat correctly. When
implicit conversion is not done, the floating point
to integer .eq. check can easily fail for values
that should normally succeed.

Whilst the calculations to generate glevel1 and
glevel2 use floating point math, assigning into an
integer variable guarantees a float to int
conversion is done before the comparison, thus
preventing instances where instead of float to int
compilers may other arithmetic operations for
comparison such as int to float.
@islas
Copy link
Contributor Author

islas commented Jun 12, 2025

More details can be found in this thread:
https://forum.mmm.ucar.edu/threads/subsoil-level-not-found-in-ungrib-file.21884/post-53661

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.

1 participant