jcranmer-intel added inline comments.

================
Comment at: clang/lib/AST/Interp/Interp.cpp:503
+  //   If during the evaluation of an expression, the result is not
+  //   mathematically defined [...], the behavior is undefined.
+  // FIXME: C++ rules require us to not conform to IEEE 754 here.
----------------
tbaeder wrote:
> @jcranmer-intel Doesn't this comment (which I've coped from 
> `ExprConstant.cpp`) contradict what you said about not checking the result?
Immediately following that in the specification is this:
> [Note 3: Treatment of division by zero, forming a remainder using a zero 
> divisor, and all floating-point exceptions varies among machines, and is 
> sometimes adjustable by a library function. — end note]

The current C++ specification is rather clear about its unclarity on 
floating-point. Also note that IEEE 754 defines floating-point data as 
consisting of {-inf, ..., -0} union {+0, ..., +inf} union {NaN}. So NaN is 
arguable to be a well-defined mathematical result, if you consider that 
floating-point types don't model real numbers but an approximation of real 
numbers (just as unsigned integers model not integers but integers mod 2^N).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156506

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to