Skip to content

Commit

Permalink
docs: use float instead of double
Browse files Browse the repository at this point in the history
Signed-off-by: Gunj Joshi <[email protected]>
  • Loading branch information
gunjjoshi authored Aug 8, 2024
1 parent 16db19b commit 8c8946e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand All @@ -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" );
Expand Down

0 comments on commit 8c8946e

Please sign in to comment.