From 02d4c8a5104c324ff3e4b55c6889601e9fd81844 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 8 Aug 2024 13:25:05 +0530 Subject: [PATCH] bench: fix variable dtypes PR-URL: https://github.com/stdlib-js/stdlib/pull/2761 Co-authored-by: Athan Reines Reviewed-by: Athan Reines Signed-off-by: Gunj Joshi Signed-off-by: Athan Reines --- .../math/base/special/truncf/benchmark/c/benchmark.c | 10 +++++----- .../base/special/truncf/benchmark/c/native/benchmark.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/benchmark.c index 4f8fd799d47..246f021e6c3 100644 --- a/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/benchmark.c @@ -78,9 +78,9 @@ static double tic( void ) { * * @return random number */ -static double rand_double( void ) { +static float rand_float( void ) { int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); + return (float)r / ( (float)RAND_MAX + 1.0f ); } /** @@ -90,14 +90,14 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; double t; + float x; + float y; int i; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; + x = ( 1000.0f * rand_float() ) - 500.0f; y = truncf( x ); if ( y != y ) { printf( "should not return NaN\n" ); diff --git a/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/native/benchmark.c index 42b5cae36d1..43e484efa6c 100644 --- a/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/truncf/benchmark/c/native/benchmark.c @@ -79,9 +79,9 @@ static double tic( void ) { * * @return random number */ -static double rand_double( void ) { +static float rand_float( void ) { int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); + return (float)r / ( (float)RAND_MAX + 1.0f ); } /** @@ -91,14 +91,14 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; double t; + float x; + float y; int i; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; + x = ( 1000.0f * rand_float() ) - 500.0f; y = stdlib_base_truncf( x ); if ( y != y ) { printf( "should not return NaN\n" );