Expected precision of Fortran FE constant evaluation
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Feb 8 18:50:00 GMT 2019
On Fri, Feb 08, 2019 at 07:27:25PM +0100, Jakub Jelinek wrote:
> On Fri, Feb 08, 2019 at 10:21:27AM -0800, Steve Kargl wrote:
> > result = 0
> > result = result + 1.**2 ! result = 1
> > result = result + 2.**2 ! result = 5
> > result = result + huge(1.)**2 ! result = huge**2, same as 1 - epsilon/2 = 1
> > result = sqrt(result) ! result = huge
> >
> > In looking at the code, there is no range_checking for norm2.
>
> Thanks for looking at it. I guess for the PR which wants to set emin/emax
> globally (unless temporarily overridden) the question is, can we throw away
> the failing tests from norm2_3.f90 or replace the huge in there with
> something smaller (I mean smaller than sqrt(huge()), so that **2 is still
> finite) and adding 5 to it is too.
>
Does norm2_1.f90 also fail? It looks like norm2_1.f90
and norm2_3.f90 are identical except norm2_1.f90 is
for REAL(4) and norm2_3.f90 is for REAL(16).
At any rate, yes, I think we can remove or change
the HUGE() testcases.
--
Steve
More information about the Fortran
mailing list