Skip to content

Commit

Permalink
revise is_nan
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Oct 2, 2023
1 parent 50ead29 commit 8f2b625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions infnan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ elemental pure function is_nan_sp(x) result(y)
logical :: y
y = (.not. (x <= huge_value(x) .and. x >= -huge_value(x))) .and. (.not. abs(x) > huge_value(x)) ! Does not always work
!y = (.not. (x < posinf(x) .and. x >= neginf(x))) .and. (.not. abs(x) >= posinf(x)) ! Does not always work
y = y .or. ((.not. is_finite(x)) .and. (.not. is_inf(x)))
y = ((.not. is_finite(x)) .and. (.not. is_inf(x)))
end function is_nan_sp

elemental pure function is_nan_dp(x) result(y)
Expand All @@ -58,7 +58,7 @@ elemental pure function is_nan_dp(x) result(y)
logical :: y
y = (.not. (x <= huge_value(x) .and. x >= -huge_value(x))) .and. (.not. abs(x) > huge_value(x)) ! Does not always work
!y = (.not. (x < posinf(x) .and. x >= neginf(x))) .and. (.not. abs(x) >= posinf(x)) ! Does not always work
y = y .or. ((.not. is_finite(x)) .and. (.not. is_inf(x)))
y = ((.not. is_finite(x)) .and. (.not. is_inf(x)))
end function is_nan_dp


Expand Down

0 comments on commit 8f2b625

Please sign in to comment.