[libcxx-commits] [libcxx] [libcxx] [test] Clarify the condition for long double hex formatting (PR #135334)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 24 01:20:30 PDT 2025
================
@@ -1846,11 +1846,26 @@ void test1() {
void test2() {
std::locale lc = std::locale::classic();
std::locale lg(lc, new my_numpunct);
-#if (defined(__APPLE__) || defined(TEST_HAS_GLIBC) || defined(__MINGW32__)) && defined(__x86_64__)
- // This test is failing on FreeBSD, possibly due to different representations
- // of the floating point numbers.
- // This test is failing in MSVC environments, where long double is equal to regular
- // double, and instead of "0x9.32c05a44p+27", this prints "0x1.26580b4880000p+30".
+#if (defined(__APPLE__) || defined(TEST_HAS_GLIBC) || defined(__MINGW32__)) && defined(__x86_64__) && \
+ __LDBL_MANT_DIG__ == 64
----------------
philnik777 wrote:
Can we drop that `defined(__x86_64__)` or is there another platform with `__LDBL_MANT_DIG__ == 64`? Also, would it maybe make sense to put the floating point detection stuff into `test_macros.h`? That way we could check `TEST_LONG_DOUBLE_TYPE == TEST_X86_WHATEVER_IT_IS_CALLED_LONG_DOUBLE_TYPE` here, which would probably make it a lot clearer what we care about (and avoid spreading implementation-defined macros throughout the tests).
https://github.com/llvm/llvm-project/pull/135334
More information about the libcxx-commits
mailing list