003 File Manager
Current Path:
/usr/src/contrib/netbsd-tests/lib/libm
usr
/
src
/
contrib
/
netbsd-tests
/
lib
/
libm
/
📁
..
📄
t_acos.c
(3.13 KB)
📄
t_asin.c
(6.45 KB)
📄
t_atan.c
(2.94 KB)
📄
t_casinh.c
(1.9 KB)
📄
t_cbrt.c
(8.09 KB)
📄
t_ceil.c
(18.79 KB)
📄
t_cos.c
(5.85 KB)
📄
t_cosh.c
(5.86 KB)
📄
t_erf.c
(6.21 KB)
📄
t_exp.c
(12.97 KB)
📄
t_fe_round.c
(2.69 KB)
📄
t_fenv.c
(5.29 KB)
📄
t_fmod.c
(2.4 KB)
📄
t_hypot.c
(2.38 KB)
📄
t_ilogb.c
(3.74 KB)
📄
t_infinity.c
(3.12 KB)
📄
t_ldexp.c
(12.38 KB)
📄
t_libm.h
(2.11 KB)
📄
t_log.c
(16.04 KB)
📄
t_modf.c
(2.26 KB)
📄
t_pow.c
(14.61 KB)
📄
t_precision.c
(2.42 KB)
📄
t_round.c
(2.45 KB)
📄
t_scalbn.c
(11.64 KB)
📄
t_sin.c
(5.85 KB)
📄
t_sinh.c
(5.98 KB)
📄
t_sqrt.c
(7.8 KB)
📄
t_tan.c
(5.69 KB)
📄
t_tanh.c
(4.6 KB)
Editing: t_libm.h
/* $NetBSD: t_libm.h,v 1.6 2014/03/25 17:30:14 joerg Exp $ */ /* * Check result of fn(arg) is correct within the bounds. * Should be ok to do the checks using 'double' for 'float' functions. * On i386 float and double values are returned on the x87 stack and might * be out of range for the function - so save and print as 'long double'. * (otherwise you can get 'inf != inf' reported!) */ #define T_LIBM_CHECK(subtest, fn, arg, expect_, epsilon_) do { \ long double epsilon = epsilon_; \ long double expect = expect_; \ long double r = fn(arg); \ long double e = fabsl(r - expect); \ if (r != expect && e > epsilon) \ atf_tc_fail_nonfatal( \ "subtest %u: " #fn "(%g) is %Lg (%.14La) " \ "not %Lg (%.13La), error %Lg (%.6La) > %Lg", \ subtest, arg, r, r, expect, expect, e, e, epsilon); \ } while (0) /* Check that the result of fn(arg) is NaN */ #ifndef __vax__ #define T_LIBM_CHECK_NAN(subtest, fn, arg) do { \ double r = fn(arg); \ if (!isnan(r)) \ atf_tc_fail_nonfatal("subtest %u: " #fn "(%g) is %g not NaN", \ subtest, arg, r); \ } while (0) #else /* vax doesn't support NaN */ #define T_LIBM_CHECK_NAN(subtest, fn, arg) (void)(arg) #endif /* Check that the result of fn(arg) is +0.0 */ #define T_LIBM_CHECK_PLUS_ZERO(subtest, fn, arg) do { \ double r = fn(arg); \ if (fabs(r) > 0.0 || signbit(r) != 0) \ atf_tc_fail_nonfatal("subtest %u: " #fn "(%g) is %g not +0.0", \ subtest, arg, r); \ } while (0) /* Check that the result of fn(arg) is -0.0 */ #define T_LIBM_CHECK_MINUS_ZERO(subtest, fn, arg) do { \ double r = fn(arg); \ if (fabs(r) > 0.0 || signbit(r) == 0) \ atf_tc_fail_nonfatal("subtest %u: " #fn "(%g) is %g not -0.0", \ subtest, arg, r); \ } while (0) /* Some useful constants (for test vectors) */ #ifndef __vax__ /* no NAN nor +/- INF on vax */ #define T_LIBM_NAN (0.0 / 0.0) #define T_LIBM_PLUS_INF (+1.0 / 0.0) #define T_LIBM_MINUS_INF (-1.0 / 0.0) #endif /* One line definition of a simple test */ #define ATF_LIBM_TEST(name, description) \ ATF_TC(name); \ ATF_TC_HEAD(name, tc) { atf_tc_set_md_var(tc, "descr", description); } \ ATF_TC_BODY(name, tc)
Upload File
Create Folder