"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-fp-error.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-fp-error.c  (stress-ng-0.12.09.tar.xz):stress-fp-error.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 119 skipping to change at line 119
/* /*
* stress_fp_error() * stress_fp_error()
* stress floating point error handling * stress floating point error handling
*/ */
static int stress_fp_error(const stress_args_t *args) static int stress_fp_error(const stress_args_t *args)
{ {
stress_set_proc_state(args->name, STRESS_STATE_RUN); stress_set_proc_state(args->name, STRESS_STATE_RUN);
do { do {
#if defined(FE_INEXACT)
volatile double d1, d2; volatile double d1, d2;
#endif
#if defined(EDOM) #if defined(EDOM) && defined(FE_INVALID)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "log(-1.0)", log(-1.0), (double)NAN, stress_fp_check(args, "log(-1.0)", log(-1.0), (double)NAN,
true, false, EDOM, FE_INVALID); true, false, EDOM, FE_INVALID);
#endif #endif
#if defined(ERANGE) #if defined(ERANGE) && defined(FE_DIVBYZERO)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "log(0.0)", log(0.0), -HUGE_VAL, stress_fp_check(args, "log(0.0)", log(0.0), -HUGE_VAL,
false, false, ERANGE, FE_DIVBYZERO); false, false, ERANGE, FE_DIVBYZERO);
#endif #endif
#if defined(EDOM) #if defined(EDOM) && defined(FE_INVALID)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "log2(-1.0)", log2(-1.0), (double)NAN, stress_fp_check(args, "log2(-1.0)", log2(-1.0), (double)NAN,
true, false, EDOM, FE_INVALID); true, false, EDOM, FE_INVALID);
#endif #endif
#if defined(ERANGE) #if defined(ERANGE) && defined(FE_DIVBYZERO)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "log2(0.0)", log2(0.0), -HUGE_VAL, stress_fp_check(args, "log2(0.0)", log2(0.0), -HUGE_VAL,
false, false, ERANGE, FE_DIVBYZERO); false, false, ERANGE, FE_DIVBYZERO);
#endif #endif
#if defined(EDOM) #if defined(EDOM) && defined(FE_INVALID)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN, stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN,
true, false, EDOM, FE_INVALID); true, false, EDOM, FE_INVALID);
#endif #endif
#if defined(EDOM) #if defined(EDOM) && defined(FE_INVALID)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN, stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN,
true, false, EDOM, FE_INVALID); true, false, EDOM, FE_INVALID);
#endif #endif
#if defined(FE_INEXACT)
/* /*
* Use volatiles to force compiler to generate code * Use volatiles to force compiler to generate code
* to perform run time computation of 1.0 / M_PI * to perform run time computation of 1.0 / M_PI
*/ */
stress_fp_clear_error(); stress_fp_clear_error();
SET_VOLATILE(d1, 1.0); SET_VOLATILE(d1, 1.0);
SET_VOLATILE(d2, M_PI); SET_VOLATILE(d2, M_PI);
stress_fp_check(args, "1.0 / M_PI", d1 / d2, d1 / d2, stress_fp_check(args, "1.0 / M_PI", d1 / d2, d1 / d2,
false, false, 0, FE_INEXACT); false, false, 0, FE_INEXACT);
/* /*
* Use volatiles to force compiler to generate code * Use volatiles to force compiler to generate code
* to perform run time overflow computation * to perform run time overflow computation
*/ */
stress_fp_clear_error(); stress_fp_clear_error();
SET_VOLATILE(d1, DBL_MAX); SET_VOLATILE(d1, DBL_MAX);
SET_VOLATILE(d2, DBL_MAX / 2.0); SET_VOLATILE(d2, DBL_MAX / 2.0);
stress_fp_check(args, "DBL_MAX + DBL_MAX / 2.0", stress_fp_check(args, "DBL_MAX + DBL_MAX / 2.0",
DBL_MAX + DBL_MAX / 2.0, (double)INFINITY, DBL_MAX + DBL_MAX / 2.0, (double)INFINITY,
false, true, 0, FE_OVERFLOW | FE_INEXACT); false, true, 0, FE_OVERFLOW | FE_INEXACT);
#endif
#if defined(ERANGE) #if defined(ERANGE) && defined(FE_UNDERFLOW)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "exp(-1000000.0)", exp(-1000000.0), 0.0, stress_fp_check(args, "exp(-1000000.0)", exp(-1000000.0), 0.0,
false, false, ERANGE, FE_UNDERFLOW); false, false, ERANGE, FE_UNDERFLOW);
#endif #endif
#if defined(ERANGE) #if defined(ERANGE) && defined(FE_OVERFLOW)
stress_fp_clear_error(); stress_fp_clear_error();
stress_fp_check(args, "exp(DBL_MAX)", exp(DBL_MAX), HUGE_VAL, stress_fp_check(args, "exp(DBL_MAX)", exp(DBL_MAX), HUGE_VAL,
false, false, ERANGE, FE_OVERFLOW); false, false, ERANGE, FE_OVERFLOW);
#endif #endif
/* /*
* Some implementations of fegetrount return * Some implementations of fegetrount return
* long long unsigned int, so cast the return * long long unsigned int, so cast the return
* to int so we can check for -1 without any * to int so we can check for -1 without any
* warnings. * warnings.
 End of changes. 12 change blocks. 
8 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)