File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
lib/node_modules/@stdlib/math/base/special/lcmf/benchmark/c/native Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -91,27 +91,30 @@ static float rand_float( void ) {
91
91
*/
92
92
static double benchmark ( void ) {
93
93
double elapsed ;
94
- float x ;
95
- float y ;
96
- float z ;
94
+ float a [ 100 ];
95
+ float b [ 100 ];
97
96
double t ;
97
+ float y ;
98
98
int i ;
99
99
100
+ for ( i = 0 ; i < 100 ; i ++ ) {
101
+ a [ i ] = roundf ( 500.0f * rand_float () );
102
+ b [ i ] = roundf ( 500.0f * rand_float () );
103
+ }
104
+
100
105
t = tic ();
101
106
for ( i = 0 ; i < ITERATIONS ; i ++ ) {
102
- x = round ( rand_float () * 500.0f );
103
- y = round ( rand_float () * 500.0f );
104
- z = stdlib_base_lcmf ( x , y );
105
- if ( z != z ) {
107
+ y = stdlib_base_lcmf ( a [ i % 100 ], b [ i % 100 ] );
108
+ if ( y != y ) {
106
109
printf ( "should not return NaN\n" );
107
110
break ;
108
111
}
109
112
}
110
113
elapsed = tic () - t ;
111
- if ( z != z ) {
114
+ if ( y != y ) {
112
115
printf ( "should not return NaN\n" );
113
116
}
114
- return elapsed ;
117
+ return elapsed ;
115
118
}
116
119
117
120
/**
You can’t perform that action at this time.
0 commit comments