File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/dlinspace/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,10 +97,11 @@ static double rand_double( void ) {
9797*/
9898static double benchmark1 ( int iterations , int len ) {
9999 double elapsed ;
100- double x [ len ] ;
100+ double * x ;
101101 double t ;
102102 int i ;
103103
104+ x = (double * ) malloc ( len * sizeof ( double ) );
104105 for ( i = 0 ; i < len ; i ++ ) {
105106 x [ i ] = ( rand_double ()* 200.0 ) - 100.0 ;
106107 }
@@ -116,6 +117,7 @@ static double benchmark1( int iterations, int len ) {
116117 if ( x [ 0 ] != x [ 0 ] ) {
117118 printf ( "should not return NaN\n" );
118119 }
120+ free ( x );
119121 return elapsed ;
120122}
121123
@@ -128,10 +130,11 @@ static double benchmark1( int iterations, int len ) {
128130*/
129131static double benchmark2 ( int iterations , int len ) {
130132 double elapsed ;
131- double x [ len ] ;
133+ double * x ;
132134 double t ;
133135 int i ;
134136
137+ x = (double * ) malloc ( len * sizeof ( double ) );
135138 for ( i = 0 ; i < len ; i ++ ) {
136139 x [ i ] = ( rand_double ()* 200.0 ) - 100.0 ;
137140 }
@@ -147,6 +150,7 @@ static double benchmark2( int iterations, int len ) {
147150 if ( x [ 0 ] != x [ 0 ] ) {
148151 printf ( "should not return NaN\n" );
149152 }
153+ free ( x );
150154 return elapsed ;
151155}
152156
You can’t perform that action at this time.
0 commit comments