Skip to content

Commit 642f6a5

Browse files
authored
bench: isolate operation
Signed-off-by: Athan <[email protected]>
1 parent d2599e4 commit 642f6a5

File tree

1 file changed

+3
-5
lines changed
  • lib/node_modules/@stdlib/number/float16/base/exponent/benchmark/c

1 file changed

+3
-5
lines changed

lib/node_modules/@stdlib/number/float16/base/exponent/benchmark/c/benchmark.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,19 @@ static double rand_double( void ) {
9393
* @return elapsed time in seconds
9494
*/
9595
static double benchmark( void ) {
96-
stdlib_float16_t v;
97-
double x[ 100 ];
96+
stdlib_float16_t x[ 100 ];
9897
double elapsed;
9998
int16_t out;
10099
double t;
101100
int i;
102101

103102
for ( i = 0; i < 100; i++ ) {
104-
x[ i ] = ( 1.0e7*rand_double() ) - 5.0e6;
103+
x[ i ] = stdlib_base_float64_to_float16( ( 1.0e7*rand_double() ) - 5.0e6 );
105104
}
106105

107106
t = tic();
108107
for ( i = 0; i < ITERATIONS; i++ ) {
109-
v = stdlib_base_float64_to_float16( x[ i % 100 ] );
110-
out = stdlib_base_float16_exponent( v );
108+
out = stdlib_base_float16_exponent( x[ i%100 ] );
111109
if ( out == 16 ) {
112110
printf( "unexpected result\n" );
113111
break;

0 commit comments

Comments
 (0)