Skip to content

Commit fc55de5

Browse files
bench: update benchmark to use dynamic memory allocation
Signed-off-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
1 parent 1969fd5 commit fc55de5

File tree

1 file changed

+3
-1
lines changed
  • lib/node_modules/@stdlib/math/base/special/fast/acoshf/benchmark/c/native

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ static float random_uniform( const float min, const float max ) {
9292
* @return elapsed time in seconds
9393
*/
9494
static double benchmark( void ) {
95-
float x[ 100 ];
95+
float *x;
9696
double elapsed;
9797
double t;
9898
float y;
9999
int i;
100100

101+
x = (float *) malloc( len * sizeof( float ) );
101102
for ( i = 0; i < 100; i++ ) {
102103
x[ i ] = random_uniform( 0.0f, 100.0f );
103104
}
@@ -114,6 +115,7 @@ static double benchmark( void ) {
114115
if ( y != y ) {
115116
printf( "should not return NaN\n" );
116117
}
118+
free( x );
117119
return elapsed;
118120
}
119121

0 commit comments

Comments
 (0)