B.2.7 VeryClose_Real Procedure

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

  define([VERY_CLOSE_ROUTINE],[
    pushdef([DIM], [$1])
    pushdef([VeryClose_Real_DIM], expand(VeryClose_Real_DIM))

    function VeryClose_Real_DIM (X, Y) result(VeryClose)

      ! Use association for numbers.
  
      use Caesar_Numbers_Module, only: two, ten

      ! Input variables.
  
      type(real,DIM,np), intent(in) :: X, Y         ! Variables to be checked.
  
      ! Output variable.
  
      type(logical) :: VeryClose                    ! Result of check.
  
      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
      ! Verify requirements.
  
      VERIFY(ALL(SHAPE(X)==SHAPE(Y)),5)  ! X and Y are conformable.

      ! VeryClose is true if X and Y are within 10 SPACING's of each other.
  
      VeryClose = ALL(ABS(X - Y) < ten*SPACING((X+Y)/two))
  
      ! Verify guarantees -- none.

      return
    end function VeryClose_Real_DIM

    popdef([DIM])
    popdef([VeryClose_Real_DIM])
  ])

  forloop([Dim],[0],[7],[
    VERY_CLOSE_ROUTINE(Dim)
  ])



Michael L. Hall