[PATCH] D128261: [Fortran] Relax relative tolerance for FCVS tests

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 13:20:29 PDT 2022


klausler added a comment.

In D128261#3623367 <https://reviews.llvm.org/D128261#3623367>, @Meinersbur wrote:

> In D128261#3622945 <https://reviews.llvm.org/D128261#3622945>, @klausler wrote:
>
>> See above.  f18's runtime will emit a minimal representation that reads back to the same bit representation (of the same real kind) when Fortran allows it to do so (viz., list-directed and NAMELIST output).
>>
>> The binary-to-decimal conversion algorithm in flang/lib/Decimal is not the whole story.  See the code in flang/runtime/edit-output.cpp to see how the Decimal library is driven for all of Fortran's various output editing modes.
>
> Thanks for this pointing out. I don't pretend to know how it works, but having also looked into the state of the art reference implementation Ryu <https://github.com/ulfjack/ryu>, I expected it to require more code.

The requirements for Fortran's binary-to-decimal and decimal-to-binary conversions are unfortunately weird compared to what Ryu can do; we need rounding to arbitrary fixed precision, kP scaling, rounding modes beyond IEEE754's, and support for at least six distinct formats, including (for cross-compilation) some that may not have host ISA support.  Hence the general conversion engine templates in lib/Decimal, which are used to do conversions in semantics and module file output as well as in the runtime library.


Repository:
  rT test-suite

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

https://reviews.llvm.org/D128261



More information about the llvm-commits mailing list