diff --git a/lib/node_modules/@stdlib/math/base/special/rempio2/README.md b/lib/node_modules/@stdlib/math/base/special/rempio2/README.md index 32551ba1d644..978033ba6f65 100644 --- a/lib/node_modules/@stdlib/math/base/special/rempio2/README.md +++ b/lib/node_modules/@stdlib/math/base/special/rempio2/README.md @@ -32,7 +32,7 @@ var rempio2 = require( '@stdlib/math/base/special/rempio2' ); #### rempio2( x, y ) -Computes `x - nπ/2 = r`. The function returns `n` and stores the remainder `r` as two numbers in `y`, such that `y[0]+y[1] = r`. +Computes `x - nπ/2 = r`. ```javascript var y = [ 0.0, 0.0 ]; @@ -46,7 +46,7 @@ var y2 = y[ 1 ]; // returns ~3.618e-17 ``` -When `x` is `NaN` or infinite, the function returns zero and sets the elements of `y` to `NaN`. +When `x` is `NaN` or infinite, the function returns `0` and sets the elements of `y` to `NaN`. ```javascript var y = [ 0.0, 0.0 ]; @@ -80,6 +80,7 @@ y2 = y[ 1 ]; ## Notes +- The function returns `n` and stores the remainder `r` as two numbers in `y`, such that `y[0]+y[1] = r`. - For input values larger than `2^20*π/2` in magnitude, the function **only** returns the last three binary digits of `n` and not the full result. @@ -111,6 +112,105 @@ for ( i = 0; i < x.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/rempio2.h" +``` + +#### stdlib_base_rempio2( x, &rem1, &rem2 ) + +Computes `x - nπ/2 = r`. + +```c +#include + +double rem1; +double rem2; + +int32_t n = stdlib_base_rempio2( 4.0, &rem1, &rem2 ); +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **rem1**: `[out] double*` destination for first remainder number. +- **rem2**: `[out] double*` destination for second remainder number. + +```c +int32_t stdlib_base_rempio2( const double x, double *rem1, double *rem2 ); +``` + +
+ + + + + +
+ +### Notes + +- The function returns `n` and stores the remainder `r` as two numbers in `rem1` and `rem2`, respectively, such that `rem1+rem2 = r`. + +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/rempio2.h" +#include +#include +#include + +int main( void ) { + const double x[] = { 0.0, 1.0, 4.0, 128.0 }; + + double rem1; + double rem2; + int32_t n; + int i; + for ( i = 0; i < 4; i++ ) { + n = stdlib_base_rempio2( x[ i ], &rem1, &rem2 ); + printf( "%lf - %"PRId32"π/2 = %lf + %lf\n", x[ i ], n, rem1, rem2 ); + } +} +``` + +
+ + + +
+ + +