Skip to content

Commit

Permalink
Replace nonstandard isnan() call with value input checks instead (#2061)
Browse files Browse the repository at this point in the history
TYPE: bug fix

KEYWORDS: compilation, nonstandard

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
PR #1944 introduced a nonstandard function call `isnan()` which breaks
compilation for compilers which don't support this extension.

Solution:
A potential alternative is to use the `ieee_is_nan()` call from
`ieee_arithmetic`. As there is conditional compilation of this module
which requires Fortran 2003 standard, an easier alternative is just to
check the input values before calling `acos()`
  • Loading branch information
islas authored Sep 13, 2024
1 parent d672f54 commit 59d1ab1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions phys/module_wind_mav.F
Original file line number Diff line number Diff line change
Expand Up @@ -1230,10 +1230,11 @@ function find_turb(xc, yc, xt, yt, u, v, sr_angle, sr_dis) result(ft)
tmp2 = sign(tmp1,tmp2)
end if

angle = real(acos(tmp1/tmp2), kind = 4)

if (isnan(angle)) then
angle = 0.
tmp1 = tmp1 / tmp2
if (tmp1 < -1.0_8 .or. tmp1 > 1.0_8) then
angle = 0.
else
angle = real(acos(tmp1), kind = 4)
end if

if (abs(angle) <= sr_angle) then
Expand Down

0 comments on commit 59d1ab1

Please sign in to comment.