[libc-commits] [libc] [libc] Add inf/nan tests for strfrom*() functions (PR #86663)

Vinayak Dev via libc-commits libc-commits at lists.llvm.org
Wed Mar 27 11:25:53 PDT 2024


================
@@ -68,11 +69,27 @@ class StrfromTest : public LIBC_NAMESPACE::testing::Test {
     written = func(buff, 37, "A simple string with no conversions.", 1.0);
     ASSERT_STREQ_LEN(written, buff, "A simple string with no conversions.");
 
-    written =
-        func(buff, 37,
-             "%A simple string with one conversion, should overwrite.", 1.0);
-    ASSERT_STREQ_LEN(written, buff, is_long_double ? "0X8P-3" : "0X1P+0");
-
+    if (is_long_double) {
+      // 64-bit long double values require checking as they will give
+      // a different result
+#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
----------------
vinayakdsci wrote:

@gchatelet I am sorry, I ran some tests on my computer using `libquadmath`, and I found that 64-bit and 128-bit floats give identical outputs, while 80-bits do not. I will update the tests, and re-push.
Thanks for the review!

https://github.com/llvm/llvm-project/pull/86663


More information about the libc-commits mailing list