[libcxx-commits] [PATCH] D61014: Implement std::midpoint for floating point types

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 24 13:28:41 PDT 2019


EricWF added a comment.

This LGTM.



================
Comment at: libcxx/include/numeric:568
+{
+    return isnormal(__a) && isnormal(__b) 
+       && ((__sign(__a) != __sign(__b)) || ((numeric_limits<_Fp>::max() - abs(__a)) < abs(__b)))
----------------
I'm not sure it matters, but I would prefer if the calls to `abs` and `isnormal` were qualified.


================
Comment at: libcxx/test/support/fp_compare.h:40
+	if (percent == zero) return val == expected;
+	T eps = (percent / 100.0) * std::max(std::abs(val), std::abs(expected));
+
----------------
Should `100.0` be cast to `T` to avoid promotion?


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

https://reviews.llvm.org/D61014





More information about the libcxx-commits mailing list