Skip to content

Commit 02d4c8a

Browse files
gunjjoshikgryte
andauthored
bench: fix variable dtypes
PR-URL: #2761 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Signed-off-by: Gunj Joshi <[email protected]> Signed-off-by: Athan Reines <[email protected]>
1 parent e9c6d40 commit 02d4c8a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/benchmark.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ static double tic( void ) {
7878
*
7979
* @return random number
8080
*/
81-
static double rand_double( void ) {
81+
static float rand_float( void ) {
8282
int r = rand();
83-
return (double)r / ( (double)RAND_MAX + 1.0 );
83+
return (float)r / ( (float)RAND_MAX + 1.0f );
8484
}
8585

8686
/**
@@ -90,14 +90,14 @@ static double rand_double( void ) {
9090
*/
9191
static double benchmark( void ) {
9292
double elapsed;
93-
double x;
94-
double y;
9593
double t;
94+
float x;
95+
float y;
9696
int i;
9797

9898
t = tic();
9999
for ( i = 0; i < ITERATIONS; i++ ) {
100-
x = ( 1000.0*rand_double() ) - 500.0;
100+
x = ( 1000.0f * rand_float() ) - 500.0f;
101101
y = truncf( x );
102102
if ( y != y ) {
103103
printf( "should not return NaN\n" );

lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/native/benchmark.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ static double tic( void ) {
7979
*
8080
* @return random number
8181
*/
82-
static double rand_double( void ) {
82+
static float rand_float( void ) {
8383
int r = rand();
84-
return (double)r / ( (double)RAND_MAX + 1.0 );
84+
return (float)r / ( (float)RAND_MAX + 1.0f );
8585
}
8686

8787
/**
@@ -91,14 +91,14 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94-
double x;
95-
double y;
9694
double t;
95+
float x;
96+
float y;
9797
int i;
9898

9999
t = tic();
100100
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 1000.0*rand_double() ) - 500.0;
101+
x = ( 1000.0f * rand_float() ) - 500.0f;
102102
y = stdlib_base_truncf( x );
103103
if ( y != y ) {
104104
printf( "should not return NaN\n" );

0 commit comments

Comments
 (0)