Merge "Add a regression test for two libm bugs we didn't have."

This commit is contained in:
Elliott Hughes 2014-06-09 23:18:35 +00:00 committed by Gerrit Code Review
commit e7baf46b86

View file

@ -1295,3 +1295,18 @@ TEST(math, frexpf_public_bug_6697) {
float fr = frexpf(14.1f, &exp);
ASSERT_FLOAT_EQ(14.1f, scalbnf(fr, exp));
}
TEST(math, exp2_STRICT_ALIGN_OpenBSD_bug) {
// OpenBSD/x86's libm had a bug here, but it was already fixed in FreeBSD:
// http://svnweb.FreeBSD.org/base/head/lib/msun/src/math_private.h?revision=240827&view=markup
ASSERT_DOUBLE_EQ(5.0, exp2(log2(5)));
ASSERT_FLOAT_EQ(5.0f, exp2f(log2f(5)));
ASSERT_DOUBLE_EQ(5.0L, exp2l(log2l(5)));
}
TEST(math, nextafterl_OpenBSD_bug) {
// OpenBSD/x86's libm had a bug here.
ASSERT_TRUE(nextafter(1.0, 0.0) - 1.0 < 0.0);
ASSERT_TRUE(nextafterf(1.0f, 0.0f) - 1.0f < 0.0f);
ASSERT_TRUE(nextafterl(1.0L, 0.0L) - 1.0L < 0.0L);
}