!=============================================== ! dotprod.f90 ! dot product using kind to set precision !=============================================== program dotprod implicit none !--------------------------- ! set kind !--------------------------- integer, parameter :: rk = selected_real_kind(12) 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