single to double conversion

Craig Powers enigma@hal-pc.org
Thu Sep 28 13:43:00 GMT 2006


Brian Barnes wrote:
> On Tue, 26 Sep 2006, Craig Powers wrote:
> 
> 
>>promotion from integer to floating point may occur later than a naive
>>user would expect.
> 
> I believe if promotion from integer to real occured so late in a simple
> calculation that it created a mathematically incorrect result, that should
> be regarded as a bug in gfortran.  It's quite possible that the developers
> disagree with me on this, but I'm just speaking as a chemist who is trying
> to get some work done in Fortran.  I've used g77 for years and not had a
> problem of this sort.  I haven't encountered a problem like that in
> gfortran either, so I hope nothing has changed.

I'm not sure what you mean by "mathematically incorrect".  I was 
referring to something of the nature of,

     REAL bar

     ! ...

     bar = 1/3 + 2.5

where I expect the result of 1/3 will be 0, because promotion to 
floating point will not happen until the addition with 2.5.



More information about the Fortran mailing list