File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/benchmark/c Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,12 +96,13 @@ static float rand_float( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- float x [ len ] ;
99+ float * x ;
100100 CBLAS_INT n ;
101101 double v ;
102102 double t ;
103103 int i ;
104104
105+ x = (float * ) malloc ( len * sizeof ( float ) );
105106 for ( i = 0 ; i < len ; i ++ ) {
106107 if ( rand_float () < 0.2f ) {
107108 x [ i ] = 0.0f / 0.0f ; // NaN
@@ -124,6 +125,7 @@ static double benchmark1( int iterations, int len ) {
124125 if ( v != v || n < 0 ) {
125126 printf ( "should not return NaN\n" );
126127 }
128+ free ( x );
127129 return elapsed ;
128130}
129131
@@ -136,12 +138,13 @@ static double benchmark1( int iterations, int len ) {
136138*/
137139static double benchmark2 ( int iterations , int len ) {
138140 double elapsed ;
139- float x [ len ] ;
141+ float * x ;
140142 CBLAS_INT n ;
141143 double v ;
142144 double t ;
143145 int i ;
144146
147+ x = (float * ) malloc ( len * sizeof ( float ) );
145148 for ( i = 0 ; i < len ; i ++ ) {
146149 if ( rand_float () < 0.2f ) {
147150 x [ i ] = 0.0f / 0.0f ; // NaN
@@ -164,6 +167,7 @@ static double benchmark2( int iterations, int len ) {
164167 if ( v != v || n < 0 ) {
165168 printf ( "should not return NaN\n" );
166169 }
170+ free ( x );
167171 return elapsed ;
168172}
169173
You can’t perform that action at this time.
0 commit comments