In one of the tests from FM905.f, flang and gfortran disagree about how
0.25e-10 should be printed: flang prints 2.5e-11, whereas gfortran
prints 2.50000003E-11 (*). Currently, the reference output contains the
former, and the relative tolerance is low enough that the latter is being
reported as an error. However, both values are reasonable results, so
this patch relaxes the tolerance for the FCVS tests to permit either value
when FCVS_ALLOW_FLEXIBLE_OUTPUT is enabled.
The value is implicitly typed in the source code, so it should use the
default real type (which can be either single or double precision
depending on the compilation flags).
In single precision, the closest representable value to 2.5e-11 is
2.500000033378579900045224349014461040496826171875E-11, which is the
same as the closest representable value for 2.50000003E-11, so both
outputs are valid.
In double precision, the closest value to 2.5e-11 is
2.50000000000000009108049328874435394791386766399909902247600257396697998046875E-11,
whereas the closest value to 2.50000003E-11 is
2.5000000300000001083984497912273228283075443556526806787587702274322509765625E-11.
Since fpcmp treats everything as double precision, it errors out in
gfortran's case because the reference output contains the minimum
number of decimals that would produce the same single precision
value. It also fails for either compiler when -fdefault-real-8 is passed:
test-suite/tools/fpcmp-target:
Compared: 2.500000e-11 and 2.500000e-11
abs. diff = 3.000000e-19 rel.diff = 1.200000e-08
Out of tolerance: rel/abs: 1.000000e-08/0.000000e+00
With the new tolerance, both outputs are considered valid.
(*) These results were obtained on an AArch64 Ubuntu machine.
Could you add a comment saying that this is the relative tolerance? I think that this is key here.