File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn/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 @@ -97,12 +97,13 @@ static double rand_double( void ) {
9797*/
9898static double benchmark1 ( int iterations , int len ) {
9999 double elapsed ;
100- double x [ len ] ;
100+ double * x ;
101101 CBLAS_INT n ;
102102 double v ;
103103 double t ;
104104 int i ;
105105
106+ x = (double * ) malloc ( len * sizeof ( double ) );
106107 for ( i = 0 ; i < len ; i ++ ) {
107108 if ( rand_double () < 0.2 ) {
108109 x [ i ] = 0.0 / 0.0 ; // NaN
@@ -125,6 +126,7 @@ static double benchmark1( int iterations, int len ) {
125126 if ( v != v || n < 0 ) {
126127 printf ( "should not return NaN\n" );
127128 }
129+ free ( x );
128130 return elapsed ;
129131}
130132
@@ -137,12 +139,13 @@ static double benchmark1( int iterations, int len ) {
137139*/
138140static double benchmark2 ( int iterations , int len ) {
139141 double elapsed ;
140- double x [ len ] ;
142+ double * x ;
141143 CBLAS_INT n ;
142144 double v ;
143145 double t ;
144146 int i ;
145147
148+ x = (double * ) malloc ( len * sizeof ( double ) );
146149 for ( i = 0 ; i < len ; i ++ ) {
147150 if ( rand_double () < 0.2 ) {
148151 x [ i ] = 0.0 / 0.0 ; // NaN
@@ -165,6 +168,7 @@ static double benchmark2( int iterations, int len ) {
165168 if ( v != v || n < 0 ) {
166169 printf ( "should not return NaN\n" );
167170 }
171+ free ( x );
168172 return elapsed ;
169173}
170174
You can’t perform that action at this time.
0 commit comments