Socket
Socket
Sign inDemoInstall

@stdlib/math-base-assert-is-positive-integer

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/math-base-assert-is-positive-integer - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

include/stdlib/math/base/assert/is_positive_integer.h

8

package.json
{
"name": "@stdlib/math-base-assert-is-positive-integer",
"version": "0.2.1",
"version": "0.3.0",
"description": "Test if a finite double-precision floating-point number is a positive integer.",

@@ -17,5 +17,8 @@ "license": "Apache-2.0",

"main": "./lib",
"gypfile": false,
"directories": {
"doc": "./docs",
"include": "./include",
"lib": "./lib",
"src": "./src",
"dist": "./dist"

@@ -34,3 +37,4 @@ },

"dependencies": {
"@stdlib/math-base-special-floor": "^0.2.1"
"@stdlib/math-base-special-floor": "^0.2.2",
"@stdlib/utils-library-manifest": "^0.2.2"
},

@@ -37,0 +41,0 @@ "devDependencies": {},

@@ -126,2 +126,93 @@ <!--

<!-- C interface documentation. -->
* * *
<section class="c">
## C APIs
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
<section class="intro">
</section>
<!-- /.intro -->
<!-- C usage documentation. -->
<section class="usage">
### 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 <stdbool.h>
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 );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/math/base/assert/is_positive_integer.h"
#include <stdio.h>
#include <stdbool.h>
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" );
}
}
```
</section>
<!-- /.examples -->
</section>
<!-- /.c -->
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

@@ -183,4 +274,4 @@

[test-image]: https://github.com/stdlib-js/math-base-assert-is-positive-integer/actions/workflows/test.yml/badge.svg?branch=v0.2.1
[test-url]: https://github.com/stdlib-js/math-base-assert-is-positive-integer/actions/workflows/test.yml?query=branch:v0.2.1
[test-image]: https://github.com/stdlib-js/math-base-assert-is-positive-integer/actions/workflows/test.yml/badge.svg?branch=v0.3.0
[test-url]: https://github.com/stdlib-js/math-base-assert-is-positive-integer/actions/workflows/test.yml?query=branch:v0.3.0

@@ -187,0 +278,0 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-assert-is-positive-integer/main.svg

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc