[PATCH] D59070: [builtins] Divide shouldn't underflow if rounded result would be normal.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 17:05:40 PDT 2019


efriedma added a comment.

Rereading my question, it isn't really clear; I'll try to explain in more detail.

The current algorithm for computing the "unrounded" result does not attempt to ensure that it is actually between the two nearest floating-point values.  Instead, it only tries to produce a value such that a round-to-even step will result in the correct answer.  This means that the "writtenExponent < 1" check does not reliably compute whether a value is tiny: there are cases where the check fails, but the mathematical result of the division is actually in the normal range.  The most obvious example of this is my testcase: DBL_MIN is normal, so (DBL_MIN * 2) / 2 should also be normal.

Given the intermediate results the code currently, is there some reasonable way to detect this case?


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D59070





More information about the llvm-commits mailing list