Skip to content

Commit 54b63f0

Browse files
chore: updated benchmark.c
Signed-off-by: Dhruv/ <[email protected]>
1 parent 09378ea commit 54b63f0

File tree

1 file changed

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

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,23 @@ static float rand_float( void ) {
9292
* @return elapsed time in seconds
9393
*/
9494
static double benchmark( void ) {
95+
stdlib_complex64_t x[ ITERATIONS ];
96+
stdlib_complex64_t y;
9597
double elapsed;
9698
double t;
9799
float re;
98100
float im;
99101
float v;
100102
int i;
101103

102-
stdlib_complex64_t x;
103-
stdlib_complex64_t y;
104+
for( i = 0; i < ITERATIONS; i++ ){
105+
v = ( 1000.0f*rand_float() ) - 500.0f;
106+
x[ i ] = stdlib_complex64( v, v );
107+
}
104108

105109
t = tic();
106110
for ( i = 0; i < ITERATIONS; i++ ) {
107-
v = ( 1000.0f*rand_float() ) - 500.0f;
108-
x = stdlib_complex64( v, v );
109-
y = stdlib_base_cidentityf( x );
111+
y = stdlib_base_cidentityf( x[ i ] );
110112
stdlib_complex64_reim( y, &re, &im );
111113
if ( re != re ) {
112114
printf( "unexpected result\n" );

0 commit comments

Comments
 (0)