Skip to content

Commit

Permalink
revise infnan
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Oct 6, 2023
1 parent 17323f5 commit 1c0205f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions infnan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ elemental pure function is_nan_sp(x) result(y)
implicit none
real(SP), intent(in) :: x
logical :: y
!y = (.not. (x <= huge_value(x) .and. x >= -huge_value(x))) .and. (.not. abs(x) > huge_value(x))
!y = ((.not. (x <= huge_value(x) .and. x >= -huge_value(x)))) .and. (.not. abs(x) > huge_value(x))
!y = (.not. is_finite(x) .and. .not. (abs(x) > huge_value(x))) .or. y
y = ((.not. is_finite(x)) .and. (.not. is_inf(x)))
y = (.not. is_inf(x) .and. .not. (x <= huge_value(x) .and. x >= -huge_value(x))) .or. y
y = ((.not. is_inf(x)) .and. (.not. (x <= huge_value(x) .and. x >= -huge_value(x)))) .or. y
end function is_nan_sp

elemental pure function is_nan_dp(x) result(y)
use consts_mod, only : DP
implicit none
real(DP), intent(in) :: x
logical :: y
!y = (.not. (x <= huge_value(x) .and. x >= -huge_value(x))) .and. (.not. abs(x) > huge_value(x))
!y = ((.not. (x <= huge_value(x) .and. x >= -huge_value(x)))) .and. (.not. abs(x) > huge_value(x))
!y = (.not. is_finite(x) .and. .not. (abs(x) > huge_value(x))) .or. y
y = ((.not. is_finite(x)) .and. (.not. is_inf(x)))
y = (.not. is_inf(x) .and. .not. (x <= huge_value(x) .and. x >= -huge_value(x))) .or. y
y = ((.not. is_inf(x)) .and. (.not. (x <= huge_value(x) .and. x >= -huge_value(x)))) .or. y
end function is_nan_dp


Expand Down

0 comments on commit 1c0205f

Please sign in to comment.