Skip to content

Commit 5d794cb

Browse files
authored
bench: update benchmarks
Signed-off-by: Gunj Joshi <[email protected]>
1 parent 6e66531 commit 5d794cb

File tree

1 file changed

+8
-5
lines changed
  • lib/node_modules/@stdlib/math/base/special/ldexp/benchmark/c

1 file changed

+8
-5
lines changed

lib/node_modules/@stdlib/math/base/special/ldexp/benchmark/c/benchmark.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,20 @@ static double rand_double( void ) {
9090
*/
9191
static double benchmark( void ) {
9292
double elapsed;
93-
double x;
94-
double y;
93+
double x[ 100 ];
94+
double y[ 100 ];
9595
double z;
9696
double t;
9797
int i;
9898

99+
for ( i = 0; i < 100; i++ ) {
100+
x[ i ] = ( rand_double() * 20.0 ) - 10.0;
101+
y[ i ] = ( rand_double() * 2048.0 ) - 1024.0;
102+
}
103+
99104
t = tic();
100105
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( rand_double()*20.0 ) - 10.0;
102-
y = ( rand_double()*2048.0 ) - 1024.0;
103-
z = ldexp( x, y );
106+
z = ldexp( x[ i % 100 ], y[ i % 100 ] );
104107
if ( z != z ) {
105108
printf( "should not return NaN\n" );
106109
break;

0 commit comments

Comments
 (0)