B.4.9 NotInInterval Procedure

The main documentation of the NotInInterval Procedure contains additional explanation of this code listing.

  define([NOT_IN_INTERVAL_ROUTINE],[
    pushdef([TYPE], [$1])
    pushdef([DIM], [$2])
    pushdef([NotInInterval_TYPE_DIM], expand(NotInInterval_TYPE_DIM))

    function NotInInterval_TYPE_DIM (X, Interval) result(NotInInterval)
  
      ! Input variables.
  
      type(TYPE,DIM,np), intent(in) :: X              ! Variable to be checked.
      type(TYPE), dimension(2), intent(in) :: Interval ! Interval to check.
  
      ! Output variable.
  
      type(logical) :: NotInInterval                   ! Result of check.
  
      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
      ! Verify requirements.
  
      VERIFY(Interval(1) <= Interval(2),7)   ! Interval should be well-formed.

      ! NotInInterval is true if X is not in the interval.
  
      NotInInterval = ALL(X < Interval(1) .or. &
                          X > Interval(2))

      ! Verify guarantees -- none.

      return
    end function NotInInterval_TYPE_DIM

    popdef([TYPE])
    popdef([DIM])
    popdef([NotInInterval_TYPE_DIM])
  ])

  forloop([Dim],[0],[7],[
    fortext([Type],[real integer],[
      NOT_IN_INTERVAL_ROUTINE(Type, Dim)
    ])
  ])



Michael L. Hall