diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-02-10 22:28:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-02-10 22:28:43 +0000 |
commit | d3338f3355a612cf385632291f46c5777bba8d18 (patch) | |
tree | a15a53955218da243ebaefd9bc07b74f07769d09 /contrib | |
parent | a6dc68c0e0f8a24ffaf0b4e78e58141ef7897047 (diff) | |
download | src-d3338f3355a612cf385632291f46c5777bba8d18.tar.gz src-d3338f3355a612cf385632291f46c5777bba8d18.zip |
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/netbsd-tests/lib/libm/t_hypot.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libm/t_hypot.c b/contrib/netbsd-tests/lib/libm/t_hypot.c index deb7e86ad5ac..075c5c83fe14 100644 --- a/contrib/netbsd-tests/lib/libm/t_hypot.c +++ b/contrib/netbsd-tests/lib/libm/t_hypot.c @@ -70,12 +70,32 @@ ATF_TC_BODY(pr50698, tc) ATF_CHECK(!isnan(val)); } +ATF_TC(hypotl_near_underflow); +ATF_TC_HEAD(hypotl_near_underflow, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test hypotl near underflow"); +} + +ATF_TC_BODY(hypotl_near_underflow, tc) +{ + volatile long double a = 0x1.b2933cafa0bb7p-16383L; + volatile long double b = 0x1.fffffffffffffp-16351L; + volatile long double e = 0x1.fffffffffffffp-16351L; + volatile long double ulp = __LDBL_EPSILON__; + + volatile long double val = hypotl(a, b); + + ATF_CHECK(!isinf(val)); + ATF_CHECK(fabsl(val - e) <= 2 * ulp); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, hypot_integer); ATF_TP_ADD_TC(tp, hypotf_integer); ATF_TP_ADD_TC(tp, pr50698); + ATF_TP_ADD_TC(tp, hypotl_near_underflow); return atf_no_error(); } |