File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
lib/node_modules/@stdlib/math/base/special/cfloorf Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -184,10 +184,10 @@ stdlib_complex64_t stdlib_base_cfloorf( const stdlib_complex64_t z );
184184
185185int main( void ) {
186186 const stdlib_complex64_t x[] = {
187- stdlib_complex128 ( 3.14f, 1.5f ),
188- stdlib_complex128 ( -3.14f, -1.5f ),
189- stdlib_complex128 ( 0.0f, 0.0f ),
190- stdlib_complex128 ( 0.0f / 0.0f, 0.0f / 0.0f )
187+ stdlib_complex64 ( 3.14f, 1.5f ),
188+ stdlib_complex64 ( -3.14f, -1.5f ),
189+ stdlib_complex64 ( 0.0f, 0.0f ),
190+ stdlib_complex64 ( 0.0f / 0.0f, 0.0f / 0.0f )
191191 };
192192
193193 stdlib_complex64_t v;
Original file line number Diff line number Diff line change 2121#include <math.h>
2222#include <complex.h>
2323#include <sys/time.h>
24+ #include "stdlib/complex/float32/reim.h"
25+ #include "stdlib/complex/float32/ctor.h"
26+ #include "stdlib/math/base/special/cfloorf.h"
2427
2528#define NAME "cfloorf"
2629#define ITERATIONS 1000000
@@ -95,22 +98,25 @@ static double benchmark( void ) {
9598 double t ;
9699 int i ;
97100
98- float complex z ;
99- float complex y ;
101+ stdlib_complex64_t z ;
102+ stdlib_complex64_t y ;
103+ float a ;
104+ float b ;
100105
101106 t = tic ();
102107 for ( i = 0 ; i < ITERATIONS ; i ++ ) {
103108 re = ( 1000.0f * rand_float () ) - 500.0f ;
104109 im = ( 1000.0f * rand_float () ) - 500.0f ;
105- z = re + im * I ;
106- y = floorf ( crealf ( z ) ) + floorf ( cimagf ( z ) )* I ;
107- if ( y != y ) {
110+ z = stdlib_complex64 ( re , im );
111+ y = stdlib_base_cfloorf ( z );
112+ stdlib_complex64_reim ( y , & a , & b );
113+ if ( a != a || b != b ) {
108114 printf ( "should not return NaN\n" );
109115 break ;
110116 }
111117 }
112118 elapsed = tic () - t ;
113- if ( y != y ) {
119+ if ( a != a || b != b ) {
114120 printf ( "should not return NaN\n" );
115121 }
116122 return elapsed ;
You can’t perform that action at this time.
0 commit comments