dprod(3f) - [FORTRAN:INTRINSIC:NUMERIC] Double product function
result = dprod(x, y)
DPROD(X,Y) produces a higher DOUBLEPRECISION product of default REAL numbers X and Y.The result has a value equal to a processor-dependent approximation to the product of X and Y. It is recommended that the processor compute the product in double precision, rather than in single precision and then converted to double precision.
The setting of compiler options specifying REAL size can affect this function.
X shall be default real. Y shall be default real.
X Must be of default REAL(kind=kind(0.0)) type Y Must have the same type and kind parameters as X
The return value is of type real(kind=kind(0.0d0)).
Sample program:
program demo_dprod use, intrinsic :: iso_fortran_env, only : real_kinds, & & real32, real64, real128 implicit none integer,parameter :: dp=kind(0.0d0) real :: x = 5.2 real :: y = 2.3 real(kind=dp) :: dd dd = dprod(x,y) print *, dd, x*y, kind(x), kind(dd), kind(dprod(x,y)) ! interesting comparisons print *, 52*23 print *, 52*23/100.0 print *, 52*23/100.0d0!! common extension is to take doubleprecision arguments !! and return higher precision bigger: block doubleprecision :: xx = 5.2d0 doubleprecision :: yy = 2.3d0 real(kind=real128) :: ddd !ddd = dprod(xx,yy) !print *, ddd, xx*yy, kind(xx), kind(ddd), kind(dprod(xx,yy)) endblock bigger
end program demo_dprod
[[FORTRAN 77]] and later
[[Elemental procedure|Elemental function]]
dprod (3) | March 11, 2021 |