diff --git a/lib/node_modules/@stdlib/math/base/special/modf/README.md b/lib/node_modules/@stdlib/math/base/special/modf/README.md index bc3ce2d7dc43..52001cae7041 100644 --- a/lib/node_modules/@stdlib/math/base/special/modf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/modf/README.md @@ -105,6 +105,96 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/modf.h" +``` + +#### stdlib_base_modf( x, integral, frac ) + +Decomposes a [double-precision floating-point number][ieee754] into integral and fractional parts, each having the same type and sign as `x`. + +```c +double integral; +double frac; + +stdlib_base_modf( 4.0, &integral, &frac ); +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **frac**: `[out] double*` destination for the integral part. +- **exp**: `[out] double*` destination for the fractional part. + +```c +void stdlib_base_modf( const double x, double *integral, double *frac ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/modf.h" +#include + +int main( void ) { + const double x[] = { 4.0, 0.0, -0.0, 1.0, -1.0, 3.14, -3.14, 1.0e308, -1.0e308, 1.0/0.0, -1.0/0.0, 0.0/0.0 }; + + double integral; + double frac; + int i; + for ( i = 0; i < 12; i++ ) { + stdlib_base_modf( x[ i ], &integral, &frac ); + printf( "x: %lf => integral: %lf, frac: %lf\n", x[ i ], integral, frac ); + } +} +``` + +
+ + + +
+ + +