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

Reported on the OpenBSD list, but we already had the fix for one from FreeBSD,
and I think the other only affected ld80 anyway. Worth having tests thuogh.

Change-Id: Ic4bbeb2384fd578a3ef13e4907be83deda50815f
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index b0d541a..b4f5b14 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -1295,3 +1295,18 @@
   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);
+}