Silverfrost Forums

Welcome to our forums

Puzzled by warning

2 Sep 2018 10:24 #22499

The test code

implicit none
real t,ftbl
t=0.5
ftbl = 3.0/(1.0+t) - 2.0*t + 1.0
print *,ftbl
end

causes the 8.30.279 compiler to issue a puzzling warning:

0004) ftbl = 3.0/(1.0+t) - 2.0*t + 1.0
WARNING - A REAL constant has been truncated with possible loss of precision - maybe a KIND is required

Older versions of the FTN95 compiler, such as 8.0 and 7.2, do not issue this warning with the same source code. Moving the '1.0' from the end to the beginning of the right hand side expression makes the warning go away.

3 Sep 2018 6:45 #22501

Thank you for the feedback.

A new warning was recently added for loss of precision when single precision real constants are used in double precision expressions. The warning here means that at least some of the arithmetic is actually being carried out in double precision (or potentially so from the compiler's point of view).

I have made a note that we should try to fix this.

29 Oct 2018 2:43 #22718

This has now been fixed for the next release of FTN95.

Please login to reply.