sgn Function

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

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n
integer, intent(in) :: oldsign
logical, intent(in) :: x

Return Value integer


Contents

Source Code

sgn

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