Skip to content

Commit

Permalink
Update example.c
Browse files Browse the repository at this point in the history
Signed-off-by: Gunj Joshi <[email protected]>
  • Loading branch information
gunjjoshi authored Aug 12, 2024
1 parent 300cd0d commit 8b4a8b8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ int main( void ) {
for ( i = 0; i < 100; i++ ) {
if ( rand_double() < 0.5 ) {
sign = -1.0;
} else {
} else {
sign = 1.0;
}

// Generate a random number:
frac = rand_double() * 10.0;
exp = (int32_t)( rand_double()*616.0 ) - 308;
x = sign * frac * stdlib_base_pow( 10.0, exp );
x = sign * frac * stdlib_base_pow( 10.0, (double)exp );

// Break the number into a normalized fraction and an integer power of two:
stdlib_base_frexp( x, &frac, &exp );
Expand Down

0 comments on commit 8b4a8b8

Please sign in to comment.