diff --git a/base/assert/is-positive-integer/README.md b/base/assert/is-positive-integer/README.md index a704dc515..779a8dc4b 100644 --- a/base/assert/is-positive-integer/README.md +++ b/base/assert/is-positive-integer/README.md @@ -100,6 +100,97 @@ bool = isPositiveInteger( NaN ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/assert/is_positive_integer.h" +``` + +#### stdlib_base_is_positive_integer( x ) + +Tests if a finite [double-precision floating-point number][ieee754] is a positive integer. + +```c +#include + +bool out = stdlib_base_is_positive_integer( 3.0 ); +// returns true + +out = stdlib_base_is_positive_integer( -4.0 ); +// returns false +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +bool stdlib_base_is_positive_integer( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/assert/is_positive_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_positive_integer( x[ i ] ); + printf( "Value: %lf. Is positive integer? %s.\n", x[ i ], ( b ) ? "True" : "False" ); + } +} +``` + +
+ + + +
+ + +