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_casinh.c
/* $NetBSD: t_casinh.c,v 1.2 2016/09/20 17:19:28 christos Exp $ */ /* * Written by Maya Rashish * Public domain. * * Testing special values of casinh * Values from ISO/IEC 9899:201x G.6.2.2 */ #include <atf-c.h> #include <complex.h> #include <math.h> #define RE(z) (((double *)(&z))[0]) #define IM(z) (((double *)(&z))[1]) static const struct { double input_re; double input_im; double result_re; double result_im; } values[] = { { +0, +0, +0, +0}, { +5.032E3, +INFINITY, +INFINITY, +M_PI/2}, { +INFINITY, +5.023E3, +INFINITY, +0}, { +INFINITY, +INFINITY, +INFINITY, +M_PI/4}, #ifdef __HAVE_NANF { +INFINITY, +NAN, +INFINITY, +NAN}, { +5.032E3, +NAN, +NAN, +NAN}, /* + FE_INVALID optionally raised */ { +NAN, +0, +NAN, +0}, { +NAN, -5.023E3, +NAN, +NAN}, /* + FE_INVALID optionally raised */ { +NAN, +INFINITY, +INFINITY, +NAN}, /* sign of real part of result unspecified */ { +NAN, +NAN, +NAN, +NAN}, #endif }; #ifdef __HAVE_NANF #define both_nan(a,b) (isnan(a) && isnan(b)) #else #define both_nan(a,b) 0 #endif #define crude_equality(a,b) ((a == b) || both_nan(a,b)) #define ATF_COMPLEX_EQUAL(a,b) do { \ complex double ci = casinh(a); \ ATF_CHECK_MSG(crude_equality(creal(ci),creal(b)) && \ crude_equality(cimag(ci), cimag(b)), \ "for casinh([%g,%g]) = [%g,%g] != [%g,%g]", \ creal(a), cimag(a), creal(ci), cimag(ci), creal(b), cimag(b)); \ } while (0/*CONSTCOND*/) ATF_TC(casinh); ATF_TC_HEAD(casinh, tc) { atf_tc_set_md_var(tc, "descr","Check casinh family - special values"); } ATF_TC_BODY(casinh, tc) { complex double input; complex double result; unsigned int i; for (i = 0; i < __arraycount(values); i++) { RE(input) = values[i].input_re; IM(input) = values[i].input_im; RE(result) = values[i].result_re; IM(result) = values[i].result_im; ATF_COMPLEX_EQUAL(input, result); } } ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, casinh); return atf_no_error(); }
Upload File
Create Folder