File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/snansumors/benchmark/c Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,12 @@ static float rand_float( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- float x [ len ] ;
99+ float * x ;
100100 float v ;
101101 double t ;
102102 int i ;
103103
104+ x = (float * ) malloc ( len * sizeof ( float ) );
104105 for ( i = 0 ; i < len ; i ++ ) {
105106 if ( rand_float () < 0.2f ) {
106107 x [ i ] = 0.0f / 0.0f ; // NaN
@@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) {
122123 if ( v != v ) {
123124 printf ( "should not return NaN\n" );
124125 }
126+ free ( x );
125127 return elapsed ;
126128}
127129
@@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) {
134136*/
135137static double benchmark2 ( int iterations , int len ) {
136138 double elapsed ;
137- float x [ len ] ;
139+ float * x ;
138140 float v ;
139141 double t ;
140142 int i ;
141143
144+ x = (float * ) malloc ( len * sizeof ( float ) );
142145 for ( i = 0 ; i < len ; i ++ ) {
143146 if ( rand_float () < 0.2f ) {
144147 x [ i ] = 0.0f / 0.0f ; // NaN
@@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) {
160163 if ( v != v ) {
161164 printf ( "should not return NaN\n" );
162165 }
166+ free ( x );
163167 return elapsed ;
164168}
165169
You can’t perform that action at this time.
0 commit comments