Skip to content

Commit 0ea6ddb

Browse files
authored
becnh: update examples
Signed-off-by: Gunj Joshi <[email protected]>
1 parent 78b9ce8 commit 0ea6ddb

File tree

1 file changed

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

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,20 @@ static double rand_double( void ) {
9595
*/
9696
static double benchmark( void ) {
9797
double elapsed;
98-
double x;
99-
double y;
98+
double x[ 100 ];
99+
double y[ 100 ];
100100
double z;
101101
double t;
102102
int i;
103103

104+
for ( i = 0; i < 100; i++ ) {
105+
x[ i ] = ( rand_double() * 20.0 ) - 10.0;
106+
y[ i ] = ( rand_double() * 2048.0 ) - 1024.0;
107+
}
108+
104109
t = tic();
105110
for ( i = 0; i < ITERATIONS; i++ ) {
106-
x = ( rand_double()*20.0 ) - 10.0;
107-
y = ( rand_double()*2048.0 ) - 1024.0;
108-
z = ldexp( x, y );
111+
z = ldexp( x[ i % 100 ], y[ i % 100 ] );
109112
if ( z != z ) {
110113
printf( "should not return NaN\n" );
111114
break;

0 commit comments

Comments
 (0)