Community
cancel
Showing results for
Did you mean:
Highlighted
Beginner
21 Views

## ddot function returning single precision result

Hi everyone,

I have the following function in a Fortran project (built in the Visual studio 2010 environment + Intel Compiler XE) that uses one of the MKL library functions (the ddot function that computes a vector-vector dot product):

*******************************************************************************************************************************************************

function Calculate_Potential_Energy_From_Clusters(nb_clusters,Tetra_Mol_Array,Cluster_Pot_energy_Array)
use Mod
integer nb_clusters,n
double precision Calculate_Potential_Energy_From_Clusters,Tetra_Mol_Array(nb_clusters),Cluster_Pot_energy_Array(nb_clusters)

Calculate_Potential_Energy_From_Clusters=ddot(nb_clusters,Tetra_Mol_Array,1,Cluster_Pot_energy_Array,1)
...
end

*******************************************************************************************************************************************************

The project is compiled without any error or warning...

However, if I do not specify explicitly the type of the ddot function result, the MKL library return a single precision number (even if I specify the use of ddot, not sdot).

I solved the problem by defining explicitly the type of ddot in my function:

*******************************************************************************************************************************************************

function Calculate_Potential_Energy_From_Clusters(nb_clusters,Tetra_Mol_Array,Cluster_Pot_energy_Array)
use Mod
integer nb_clusters,n
double precision ddot, Calculate_Potential_Energy_From_Clusters,Tetra_Mol_Array(nb_clusters),Cluster_Pot_energy_Array(nb_clusters)

Calculate_Potential_Energy_From_Clusters=ddot(nb_clusters,Tetra_Mol_Array,1,Cluster_Pot_energy_Array,1)
...
end

*******************************************************************************************************************************************************

Is it normal that the intel XE compiler assumes that the result of the ddot function is of single precision when ddot function is not explicitly defined as a double precision number (ddot is supposed to return a double precision result)?

If so, what should I do to avoid this problem?

Thank you very much for your help!