File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
lib/node_modules/@stdlib/math/base/special/ccis/benchmark/c/native Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,8 @@ static double rand_double( void ) {
9292* @return elapsed time in seconds
9393*/
9494static double benchmark ( void ) {
95- double re [ 100 ];
96- double im [ 100 ];
95+ double real_part [ 100 ];
96+ double imag_part [ 100 ];
9797 double elapsed ;
9898 double t ;
9999 int i ;
@@ -102,25 +102,23 @@ static double benchmark( void ) {
102102 stdlib_complex128_t z2 ;
103103
104104 for ( i = 0 ; i < 100 ; i ++ ) {
105- re [ i ] = ( 1000.0 * rand_double () ) - 500.0 ;
106- im [ i ] = ( 1000.0 * rand_double () ) - 500.0 ;
105+ real_part [ i ] = ( 1000.0 * rand_double () ) - 500.0 ;
106+ imag_part [ i ] = ( 1000.0 * rand_double () ) - 500.0 ;
107107 }
108108
109109 t = tic ();
110110 for ( i = 0 ; i < ITERATIONS ; i ++ ) {
111- z1 = stdlib_complex128 ( re [ i %100 ], im [ i %100 ] );
111+ z1 = stdlib_complex128 ( real_part [ i %100 ], imag_part [ i %100 ] );
112112
113113 z2 = stdlib_base_ccis ( z1 );
114- stdlib_complex128_reim ( z2 , & re [ i %100 ], & im [ i %100 ] );
115- if ( re != re ) {
114+ stdlib_complex128_reim ( z2 , & real_part [ i %100 ], & imag_part [ i %100 ] );
115+ if (isnan ( real_part [ i % 100 ]) || isnan ( imag_part [ i % 100 ]) ) {
116116 printf ( "should not return NaN\n" );
117117 break ;
118118 }
119119 }
120120 elapsed = tic () - t ;
121- if ( im != im ) {
122- printf ( "should not return NaN\n" );
123- }
121+
124122 return elapsed ;
125123}
126124
You can’t perform that action at this time.
0 commit comments