aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-02-09 22:37:08 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-02-09 22:37:18 +0000
commit51af03328755c9095e94d20858a8d10acfe412ae (patch)
tree6050d587ae2a8cc7116af9e6aee4577e766afb45 /contrib
parent9c6954329a9285547881ddd60e393b7c55ed30c4 (diff)
downloadsrc-51af03328755c9095e94d20858a8d10acfe412ae.tar.gz
src-51af03328755c9095e94d20858a8d10acfe412ae.zip
Add test case for 93fc67896550 (incorrect powf(3) result)
This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it is currently the only place testing pow(3) and friends. MFC after: 1 week
Diffstat (limited to 'contrib')
-rw-r--r--contrib/netbsd-tests/lib/libm/t_pow.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libm/t_pow.c b/contrib/netbsd-tests/lib/libm/t_pow.c
index 7afee9f6dffa..09e72be7311b 100644
--- a/contrib/netbsd-tests/lib/libm/t_pow.c
+++ b/contrib/netbsd-tests/lib/libm/t_pow.c
@@ -637,6 +637,27 @@ ATF_TC_BODY(powf_zero_y, tc)
}
}
+ATF_TC(powf_near_one_x_huge_y);
+ATF_TC_HEAD(powf_near_one_x_huge_y, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test powf(->1, huge) != inf");
+}
+
+ATF_TC_BODY(powf_near_one_x_huge_y, tc)
+{
+ const float x = 0x1.ffffeep-1f; /* 9.999995e-01f */
+ const float y = -0x1.000002p+27f; /* -1.342177e+08f */
+ const float e = 0x1.d53532p+103f; /* 1.858724e+31f */
+ const float ulp = __FLT_EPSILON__;
+ float z;
+
+ z = powf(x, y);
+
+ ATF_CHECK(isinf(z) == 0);
+ ATF_CHECK(fabsf(z - e) <= 2 * ulp);
+}
+
+
ATF_TP_ADD_TCS(tp)
{
@@ -661,6 +682,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, powf_one_pos_x);
ATF_TP_ADD_TC(tp, powf_zero_x);
ATF_TP_ADD_TC(tp, powf_zero_y);
+ ATF_TP_ADD_TC(tp, powf_near_one_x_huge_y);
return atf_no_error();
}