!=============================================== ! dotprod.f90 ! dot product using module to set precision !=============================================== program dotprod !------------------------------------------- ! use module containing precision parameter !------------------------------------------- use prec_mod, only: rk implicit none integer :: i real(rk) :: c real(rk), dimension(3) :: a, b !---------------------------- ! input vectors !---------------------------- print*,'Enter first vector' read*, a print*,'Enter second vector' read*, b !---------------------------- ! calculate dot product !---------------------------- call dp(a,b,c) !---------------------------- ! check magnitude !---------------------------- if(abs(c) < 1.0e-6) then print*,'---------------------------------------------------' print*,'Warning: magnitude of dot product is less than 1e-6' print*,'---------------------------------------------------' endif !---------------------------- ! print result !---------------------------- print*,' ' print*,'dot product = ', c end program dotprod