sgn Function

public elemental function sgn(n, oldsign, x) result(val)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
integer, intent(in) :: oldsign
logical, intent(in) :: x

Return Value integer


Source Code

   ELEMENTAL FUNCTION sgn(n, oldsign, x) RESULT(val)
      INTEGER, INTENT(IN)                                :: n, oldsign
      LOGICAL, INTENT(IN)                                :: x
      INTEGER                                            :: val

      IF (.NOT. x) THEN
         val = SIGN(n, oldsign)
      ELSE
         val = -SIGN(n, oldsign)
      END IF
   END FUNCTION sgn