From 2d7739dd1dad1190049e75084a0650bf3a87156c Mon Sep 17 00:00:00 2001 From: tTh Date: Sat, 6 Jan 2024 02:54:06 +0100 Subject: [PATCH] add the "diff_sign" function --- Modules/mathstuff2.f90 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Modules/mathstuff2.f90 b/Modules/mathstuff2.f90 index 2536ae6..afa6c52 100644 --- a/Modules/mathstuff2.f90 +++ b/Modules/mathstuff2.f90 @@ -28,6 +28,25 @@ module mathstuff2 end subroutine + ! ---------------------------------------------------------------- + +logical function diff_sign(a, b) + integer, intent(in) :: a, b + + ! write(0, *) "diff_sign", a, b + if ( (a .lt. 0) .and. (b .ge. 0) ) then + diff_sign = .TRUE. + return + endif + if ( (a .ge. 0) .and. (b .lt. 0) ) then + diff_sign = .TRUE. + return + endif + diff_sign = .FALSE. + +end function + + ! ---------------------------------------------------------------- end module mathstuff2