diff --git a/base/assert/is-nonpositive-integer/README.md b/base/assert/is-nonpositive-integer/README.md index 9d7e43b27..69467691c 100644 --- a/base/assert/is-nonpositive-integer/README.md +++ b/base/assert/is-nonpositive-integer/README.md @@ -110,6 +110,97 @@ bool = isNonPositiveInteger( NaN ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/assert/is_nonpositive_integer.h" +``` + +#### stdlib_base_is_nonpositive_integer( x ) + +Tests if a finite double-precision floating-point number is a nonpositive integer. + +```c +#include + +bool out = stdlib_base_is_nonpositive_integer( -5.0 ); +// returns true + +out = stdlib_base_is_nonpositive_integer( 0.0 ); +// returns true +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +bool stdlib_base_is_nonpositive_integer( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/assert/is_nonpositive_integer.h" +#include +#include + +int main( void ) { + const double x[] = { 5.0, -5.0, 3.14, -3.14, 0.0, 0.0/0.0 }; + + bool b; + int i; + for ( i = 0; i < 6; i++ ) { + b = stdlib_base_is_nonpositive_integer( x[ i ] ); + printf( "x = %lf, is_nonpositive_integer(x) = %s\n", x[ i ], ( b ) ? "True" : "False" ); + } +} +``` + +
+ + + +
+ + +