File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed
lib/node_modules/@stdlib/math/strided/special/sabs2/benchmark/c Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -96,16 +96,11 @@ static float rand_float( void ) {
9696*/
9797static double benchmark ( int iterations , int len ) {
9898 double elapsed ;
99- float * x = ( float * ) malloc ( len * sizeof ( float )) ;
100- float * y = ( float * ) malloc ( len * sizeof ( float )) ;
99+ float x [ len ] ;
100+ float y [ len ] ;
101101 double t ;
102102 int i ;
103103
104- if (x == NULL || y == NULL ) {
105- printf ("Memory allocation failed.\n" );
106- exit (1 );
107- }
108-
109104 for ( i = 0 ; i < len ; i ++ ) {
110105 x [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
111106 y [ i ] = 0.0f ;
@@ -122,11 +117,6 @@ static double benchmark( int iterations, int len ) {
122117 if ( y [ 0 ] != y [ 0 ] ) {
123118 printf ( "should not return NaN\n" );
124119 }
125-
126- // 🧹 Always clean up heap allocations
127- free (x );
128- free (y );
129-
130120 return elapsed ;
131121}
132122
You can’t perform that action at this time.
0 commit comments