[libc-commits] [libc] [libc][math] Integer-only, statically rounded implementation of exp (PR #225803)
via libc-commits
libc-commits at lists.llvm.org
Sun Sep 27 08:03:31 PDT 2026
=?utf-8?q?Hoàng_Minh_Thiên?=,=?utf-8?q?Hoàng_Minh_Thiên?=,
=?utf-8?q?Hoàng_Minh_Thiên?=,=?utf-8?q?Hoàng_Minh_Thiên?=,
=?utf-8?q?Hoàng_Minh_Thiên?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/225803 at github.com>
================
@@ -170,6 +170,16 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
return FPMatcher<T, C>(expectedValue);
}
+template <typename T>
+typename fputil::FPBits<T>::StorageType ulp_distance(T x, T y) {
+ using FPBits = fputil::FPBits<T>;
+ using StorageType = typename FPBits::StorageType;
+
+ StorageType x_bits = FPBits(x).uintval();
+ StorageType y_bits = FPBits(y).uintval();
+ return x_bits > y_bits ? x_bits - y_bits : y_bits - x_bits;
----------------
lntue wrote:
add special case when at least one of them is NaN.
https://github.com/llvm/llvm-project/pull/225803
More information about the libc-commits
mailing list