[PATCH] D75246: Make IEEEFloat::roundToIntegral more standard conformant

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 08:39:59 PDT 2020


sepavloff added inline comments.


================
Comment at: llvm/lib/Support/APFloat.cpp:2011
+  opStatus IsInexact = static_cast<opStatus>(fs & opInexact);
+  if (fs != opOK && !IsInexact)
     return fs;
----------------
scanon wrote:
> What is this check intended to do? AFAICT from a quick glance, this will never happen.
For signaling NaN `fs` may be `opInvalid`.
Reorganized code so that the respective check is made explicitly.


================
Comment at: llvm/lib/Support/APFloat.cpp:2020
 
-  return fs;
+  return fs == opOK ? IsInexact : fs;
 }
----------------
scanon wrote:
> fs will never be anything other than opOK here, right? By Sterbenz' lemma this subtraction is always exact.
Sterbenz' lemma! Exactly! Thank you very much!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75246





More information about the llvm-commits mailing list