diff --git a/lib/node_modules/@stdlib/math/base/special/ldexp/README.md b/lib/node_modules/@stdlib/math/base/special/ldexp/README.md index 208c832d2063..65ff3ade6e2a 100644 --- a/lib/node_modules/@stdlib/math/base/special/ldexp/README.md +++ b/lib/node_modules/@stdlib/math/base/special/ldexp/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2022 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -118,6 +118,98 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/ldexp.h" +``` + +#### stdlib_base_ldexp( frac, exp ) + +Multiplies a [double-precision floating-point number][ieee754] by an integer power of two (i.e., `x = frac * 2^exp`). + +```c +double x = stdlib_base_ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8 +// returns 4.0 +``` + +The function accepts the following arguments: + +- **frac**: `[in] double` input value. +- **exp**: `[in] int32_t` integer power of two. + +```c +double stdlib_base_ldexp( const double frac, const int32_t exp ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/ldexp.h" +#include +#include +#include +#include + +int main() { + double frac; + int32_t exp; + double out; + int i; + + for ( i = 0; i < 100; i++ ) { + frac = (double) rand() / (double) RAND_MAX; + exp = (int32_t) rand() - (int32_t) (RAND_MAX/2); + out = stdlib_base_ldexp( frac, exp ); + printf( "frac: %lf, exp: %" PRId32 ", out: %lf\n", frac, exp, out ); + } +} +``` + +
+ + + +
+ + +