diff --git a/lib/node_modules/@stdlib/math/base/special/roundsd/README.md b/lib/node_modules/@stdlib/math/base/special/roundsd/README.md index 67b162fdb58a..f219dc7a20ce 100644 --- a/lib/node_modules/@stdlib/math/base/special/roundsd/README.md +++ b/lib/node_modules/@stdlib/math/base/special/roundsd/README.md @@ -20,7 +20,7 @@ limitations under the License. # roundsd -> Round a numeric value to the nearest number with `n` significant figures. +> Round a double-precision floating-point number to the nearest value with `n` significant figures.
@@ -32,7 +32,7 @@ var roundsd = require( '@stdlib/math/base/special/roundsd' ); #### roundsd( x, n\[, b] ) -Rounds a `numeric` value to the nearest `number` with `n` significant figures. +Rounds a double-precision floating-point number to the nearest value with `n` significant figures. ```javascript var v = roundsd( 3.141592653589793, 3 ); @@ -85,6 +85,93 @@ logEachMap( 'x: %0.4f. y: %d. Rounded: %0.4f.', x, 5, roundsd ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/roundsd.h" +``` + +#### stdlib_base_roundsd( x, n, b ) + +Rounds a double-precision floating-point number to the nearest value with `n` significant figures. + +```c +double v = stdlib_base_roundsd( 3.141592653589793, 3, 10 ); +// returns 3.14 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **n**: `[in] int32_t` number of significant figures. +- **b**: `[in] int32_t` base. + +```c +double stdlib_base_roundsd( const double x, const int32_t n, const int32_t b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/roundsd.h" +#include + +int main( void ) { + const double x[] = { 3.143546, -3.142635, 0.0, 0.0/0.0 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_roundsd( x[ i ], 2, 10 ); + printf( "roundsd(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +