summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-06-06 21:43:33 -0700
committerElliott Hughes <enh@google.com>2014-06-06 21:55:27 -0700
commit18b17e97757a59718a23f8128dfc91c016df08b1 (patch)
tree90922f85d3f49e92b91290a5e97321963ae4e1cc
parent19718f0cd605f55df26823c67b62ceab6fe99a00 (diff)
downloadbionic-18b17e97757a59718a23f8128dfc91c016df08b1.zip
bionic-18b17e97757a59718a23f8128dfc91c016df08b1.tar.gz
bionic-18b17e97757a59718a23f8128dfc91c016df08b1.tar.bz2
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
-rw-r--r--tests/math_test.cpp15
1 files changed, 15 insertions, 0 deletions
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 @@ 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);
+}