Fix stdio -NaN tests for riscv64.
riscv64 hates nans. From the spec: "Except when otherwise stated, if the
result of a floating-point operation is NaN, it is the canonical NaN.
The canonical NaN has a positive sign and all significand bits clear
except the MSB, a.k.a. the quiet bit."
This broke our tests here because the float-to-double instruction isn't
one of the "otherwise stated" cases, so it turns -nanf() into +nan().
The sign manipulation instructions are "otherwise stated" cases, though,
so as long as we avoid a conversion we're fine. And we didn't actually
_need_ a float here (pretty much by definition, since varargs means you
always end up with a double anyway), so we can just simplify things and
switch to using doubles directly to fix the tests.
Test: bionic-unit-tests-static
Change-Id: I13aa452dd6cc8708275f7676b37fc772b37a7b32
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 21b3f6c..acc7ccd 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -490,22 +490,22 @@
// NaN.
- snprintf_fn(buf, sizeof(buf), fmt, nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt, nan(""));
EXPECT_STREQ(nan_, buf) << fmt;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt, -nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt, -nan(""));
EXPECT_STREQ(minus_nan, buf) << fmt;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt_plus, nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt_plus, nan(""));
EXPECT_STREQ(plus_nan, buf) << fmt_plus;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt_plus, -nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt_plus, -nan(""));
EXPECT_STREQ(minus_nan, buf) << fmt_plus;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));