So my question is: what happens when a variable with one precision is multiplied by a double precision variable in fortran? Single precision contributes to double precision, and the operation is performed with double precision.
Is the result double precision if the variable used to store the value is declared double precision? Not necessary. The right side is an expression that does not “know” about the accuracy of the variable on the left side in which it will be stored. If you have Double = SingleA * SingleB (using names to indicate types), the calculation will be performed with only precision, and then converted to double for storage. This will not give additional accuracy for the calculation!
, "D0" ? , , , . , - , , , . , DoubleVar * 3.14159265359 , - DoubleVar * 3.14159, .
, , . Fortran 90 , , , 14 :
integer, parameter :: DoubleReal_K = selected_real_kind (14)
real (DoubleReal_K) :: A
A = 5.0_DoubleReal_K
A = A * 3.14159265359_DoubleReal_K