Skip to content

Commit 6e66531

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

File tree

1 file changed

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

1 file changed

+8
-5
lines changed

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

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

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

0 commit comments

Comments
 (0)