next up previous

3.3 Numeric Polymorphism     continued...

INTERFACE SMOOTH                      ! SMOOTH is the generic name

 INTEGER FUNCTION SMOOTH_INT(AA)      ! for procedures   SMOOTH_INT
  INTEGER :: AA(:,:)                  !    SMOOTH_SINGLE
 END FUNCTION SMOOTH_INT              !  SMOOTH_DOUBLE
                                      !   SMOOTH_RATIONAL
 INTEGER FUNCTION SMOOTH_SINGLE(AA)
  REAL(SINGLE) :: AA(:,:)             ! AA is an assumed shape two-
 END FUNCTION SMOOTH_SINGLE           ! dimensional array in each case.

 INTEGER FUNCTION SMOOTH_DOUBLE(AA)
  REAL(DOUBLE) :: AA(:,:)
 END FUNCTION SMOOTH_DOUBLE

 INTEGER FUNCTION SMOOTH_RATIONAL(AA)
  TYPE(RATIONAL) :: AA(:,:)
 END FUNCTION SMOOTH_RATIONAL

END INTERFACE

INTERFACE COS                        ! Extends the generic properties
 FUNCTION RATIONAL_COS(X)            !  of COS to return results of
  TYPE(RATIONAL) :: RATIONAL_COS     !  type RATIONAL, assuming the
  TYPE(RATIONAL) :: X                !  argument is of type RATIONAL.
 END FUNCTION RATIONAL_COS 
END INTERFACE