Changeset View
Changeset View
Standalone View
Standalone View
lib/msun/tests/ctrig_test.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
* to raise FE_OVERFLOW without raising FE_INEXACT. | * to raise FE_OVERFLOW without raising FE_INEXACT. | ||||
* | * | ||||
* These are macros instead of functions so that assert provides more | * These are macros instead of functions so that assert provides more | ||||
* meaningful error messages. | * meaningful error messages. | ||||
* | * | ||||
* XXX The volatile here is to avoid gcc's bogus constant folding and work | * XXX The volatile here is to avoid gcc's bogus constant folding and work | ||||
* around the lack of support for the FENV_ACCESS pragma. | * around the lack of support for the FENV_ACCESS pragma. | ||||
*/ | */ | ||||
#define test_p(func, z, result, exceptmask, excepts, checksign) do { \ | #define test_p(func, z, result, exceptmask, excepts, checksign) \ | ||||
do { \ | |||||
volatile long double complex _d = z; \ | volatile long double complex _d = z; \ | ||||
debug(" testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func, \ | debug(" testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func, \ | ||||
creall(_d), cimagl(_d), creall(result), cimagl(result)); \ | creall(_d), cimagl(_d), creall(result), cimagl(result)); \ | ||||
ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \ | ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \ | ||||
ATF_CHECK(cfpequal_cs((func)(_d), (result), (checksign))); \ | volatile long double complex _r = (func)(_d); \ | ||||
ATF_CHECK(((void)(func), fetestexcept(exceptmask) == (excepts))); \ | ATF_CHECK_MSG(cfpequal_cs(_r, (result), (checksign)), \ | ||||
"%s (%Lg + %Lg I) != expected (%Lg + %Lg I)", \ | |||||
__XSTRING((func)(_d)), creall(_r), cimagl(_r), \ | |||||
creall(result), cimagl(result)); \ | |||||
volatile int _e = fetestexcept(exceptmask); \ | |||||
ATF_CHECK_MSG(_e == (excepts), \ | |||||
"%s fetestexcept(%s) (%#x) != %#x", __XSTRING(func), \ | |||||
__XSTRING(exceptmask), _e, (excepts)); \ | |||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Test within a given tolerance. The tolerance indicates relative error | * Test within a given tolerance. The tolerance indicates relative error | ||||
* in ulps. If result is 0, however, it measures absolute error in units | * in ulps. If result is 0, however, it measures absolute error in units | ||||
* of <format>_EPSILON. | * of <format>_EPSILON. | ||||
*/ | */ | ||||
#define test_p_tol(func, z, result, tol) do { \ | #define test_p_tol(func, z, result, tol) do { \ | ||||
volatile long double complex _d = z; \ | volatile long double complex _d = z; \ | ||||
▲ Show 20 Lines • Show All 411 Lines • Show Last 20 Lines |