1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:37:34 +00:00

LibM: Implement fmin/fmax

This commit is contained in:
Mițca Dumitru 2021-03-15 17:27:13 +02:00 committed by Andreas Kling
parent 987cc904c2
commit 01a49dda85
3 changed files with 81 additions and 0 deletions

View file

@ -247,4 +247,19 @@ TEST_CASE(gamma)
EXPECT_EQ(signgam, -1);
}
TEST_CASE(fmax_and_fmin)
{
EXPECT(fmax(-INFINITY, 0) == 0);
EXPECT(fmax(NAN, 12) == 12);
EXPECT(fmax(5, NAN) == 5);
EXPECT(isnan(fmax(NAN, NAN)));
EXPECT(isinf(fmax(1'000'000, INFINITY)));
EXPECT(isinf(fmin(-INFINITY, 0)));
EXPECT(fmin(0, INFINITY) == 0);
EXPECT(fmin(NAN, 5) == 5);
EXPECT(fmin(0, NAN) == 0);
EXPECT(isnan(fmin(NAN, NAN)));
}
TEST_MAIN(Math)