[PATCH] D39611: [CodeGen] make cbrt and fma constant (never set errno); document complex calls as always constant

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 18:47:48 PDT 2017


efriedma added a comment.

> In general, because all of these functions are well defined over the entire complex domain, they don't have errors. The "no errors defined" is likely correct.

One, it is not true that all these functions are well-defined over the entire complex domain.  For example, according to the C standard `catanh(1)` raises a divide-by-zero error.

Two, even for the functions which are defined over the entire complex domain, the result can still overflow and/or underflow, and therefore they could set errno to ERANGE.  cabs() can overflow, cexp() can overflow, etc.

Three, even if we only care about the behavior of the current version of glibc, cabs() actually does modify errno. (Try `cabs(1.7e308+I*1.7e308)`).


https://reviews.llvm.org/D39611





More information about the cfe-commits mailing list