Skip to content

Commit 300cd0d

Browse files
authored
Update README.md
Signed-off-by: Gunj Joshi <[email protected]>
1 parent ed05d9c commit 300cd0d

File tree

1 file changed

+4
-2
lines changed
  • lib/node_modules/@stdlib/math/base/special/ldexp

1 file changed

+4
-2
lines changed

lib/node_modules/@stdlib/math/base/special/ldexp/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ double stdlib_base_ldexp( const double frac, const int32_t exp );
183183
```c
184184
#include "stdlib/math/base/special/ldexp.h"
185185
#include "stdlib/math/base/special/frexp.h"
186+
#include "stdlib/math/base/special/pow.h"
186187
#include <stdlib.h>
187188
#include <stdint.h>
188189
#include <stdio.h>
@@ -208,10 +209,11 @@ int main( void ) {
208209
} else {
209210
sign = 1.0;
210211
}
212+
211213
// Generate a random number:
212214
frac = rand_double() * 10.0;
213-
exp = (int32_t)( rand_double()*616.0 ) - 308;
214-
x = sign * frac * pow( 10.0, exp );
215+
exp = (int32_t)( rand_double() * 616.0 ) - 308;
216+
x = sign * frac * stdlib_base_pow( 10.0, (double)exp );
215217
216218
// Break the number into a normalized fraction and an integer power of two:
217219
stdlib_base_frexp( x, &frac, &exp );

0 commit comments

Comments
 (0)