Skip to content

Commit

Permalink
Update README.md
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 ed05d9c commit 300cd0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/node_modules/@stdlib/math/base/special/ldexp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ double stdlib_base_ldexp( const double frac, const int32_t exp );
```c
#include "stdlib/math/base/special/ldexp.h"
#include "stdlib/math/base/special/frexp.h"
#include "stdlib/math/base/special/pow.h"
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
Expand All @@ -208,10 +209,11 @@ int main( void ) {
} else {
sign = 1.0;
}
// Generate a random number:
frac = rand_double() * 10.0;
exp = (int32_t)( rand_double()*616.0 ) - 308;
x = sign * frac * pow( 10.0, exp );
exp = (int32_t)( rand_double() * 616.0 ) - 308;
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 300cd0d

Please sign in to comment.