src/components/sde/tests/Simple/Simple_Lib.c
// Perform some nonsense computation to emulate a possible library behavior.
// Notice that no SDE routines need to be called in the critical path of the library.
Perform some nonsense computation to emulate a possible library behavior.
Notice that no SDE routines need to be called in the critical path of the library.
Perform some nonsense computation to emulate a possible library behavior . Notice that no SDE routines need to be called in the critical path of the library .
double simple_compute(double x){
    double sum = 0.0;
    int lcl_iter = 0;
    while( 1 ){
        double y,tmp;
        lcl_iter++;
        tmp = (2.0+sin(314.0*x)+sin(11.0*x*x));
        tmp = tmp*tmp;
        y = 0.5+sin(3.5*tmp/4.0)/2.0;
        x = y;
        sum += y;
        if( y < 0.1 ){
            low_wtrmrk++;
            continue;
        }
        if( y > 0.9 ){
            high_wtrmrk++;
            continue;
        }
        comp_value += y;
        if( 0.67 < y && y < 0.68 )
            break;
    }
    total_iter_cnt += lcl_iter;
    return sum;
}
double simple_compute ( double x ) { double sum = 0.0 ; int lcl_iter = 0 ; while ( 1 ) { double y , tmp ; lcl_iter ++ ; tmp = ( 2.0 + sin ( 314.0 * x ) + sin ( 11.0 * x * x ) ) ; tmp = tmp * tmp ; y = 0.5 + sin ( 3.5 * tmp / 4.0 ) / 2.0 ; x = y ; sum += y ; if ( y < 0.1 ) { low_wtrmrk ++ ; continue ; } if ( y > 0.9 ) { high_wtrmrk ++ ; continue ; } comp_value += y ; if ( 0.67 < y && y < 0.68 ) break ; } total_iter_cnt += lcl_iter ; return sum ; }
Perform some nonsense computation to emulate a possible library behavior.
Perform some nonsense computation to emulate a possible library behavior .
// Compute a function with range [0:1] so we can iterate  // multiple times without diverging or creating FP exceptions. // Now set the next x to be the current y, so we can iterate again. // Add y to sum unconditionally // Only add y to comp_value if y is between the low and high watermarks. // If some condition is met, terminate the loop