mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
Tests/LibC: Don't implicitly convert float to double in TestSnprintf
Most RISC-V floating-point operations only generate the canonical NaN, so the sign bit was cleared in this test. The sign injection instruction does keep the NaN payload and sign bit, so doing `-v.f` to get a negative NaN works as expected.
This commit is contained in:
parent
e166003179
commit
39a2356c54
1 changed files with 4 additions and 4 deletions
|
@ -293,15 +293,15 @@ TEST_CASE(float_value_precision)
|
||||||
TEST_CASE(float_value_special)
|
TEST_CASE(float_value_special)
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
float f;
|
double f;
|
||||||
int i;
|
u64 i;
|
||||||
} v;
|
} v;
|
||||||
|
|
||||||
v.i = 0x7fc00000;
|
v.i = 0x7ff8000000000000;
|
||||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| nan|\0") }));
|
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| nan|\0") }));
|
||||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-nan|\0") }));
|
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-nan|\0") }));
|
||||||
|
|
||||||
v.i = 0x7f800000;
|
v.i = 0x7ff0000000000000;
|
||||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| inf|\0") }));
|
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", v.f, 6, LITERAL("| inf|\0") }));
|
||||||
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-inf|\0") }));
|
EXPECT(test_single<double>({ LITERAL("xxxxxxx"), "|%4f|", -v.f, 6, LITERAL("|-inf|\0") }));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue