[flang-commits] [PATCH] D128261: [Fortran] Relax tolerance for FCVS tests

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 21 11:04:39 PDT 2022


klausler added a comment.

What you call the "true value" of 2.5E-11 cannot be represented exactly as a binary floating-point number.  The closest real(4) value is exactly 2.500000033378579900045224349014461040496826171875E-11 and the closest real(8) value is 2.50000000000000009108049328874435394791386766399909902247600257396697998046875E-11.

The closest real(4) value of 2.50000003E-11 is the same as the closest real(4) value of 2.5E-11, but the closest real(8) value of 2.50000003E-11 is 2.5000000300000001083984497912273228283075443556526806787587702274322509765625E-11, which is not the same as the closest real(8) value of 2.5E-11.

For E0/D0/G0, list-directed, and NAMELIST output editing, f18 emits minimal digit sequences that, if read back into a real variable of the same kind, will reproduce the output value.  Perhaps that is affecting this test.  "2.5E-11" would be valid E0/list-directed output for the real(4) value closest to 2.5E-11, but not the real(8) value.

I suspect that your fpcmp tool is reading 2.5E-11 and 2.50000003E-11 in as double-precision values, and is rightfully complaining about their difference, which would indeed indicate an error if this output were of double precision values.  Please verify that this is the case.


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128261/new/

https://reviews.llvm.org/D128261



More information about the flang-commits mailing list