From 625ef2e8280d5ab1d238c53a7c92b7a4ac9c51ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 14 Mar 2024 02:33:32 +0000 Subject: [PATCH] Auto-generated commit --- base/assert/is-safe-integer/README.md | 91 ++++++++++ .../benchmark/benchmark.native.js | 61 +++++++ .../benchmark/c/native/Makefile | 146 +++++++++++++++ .../benchmark/c/native/benchmark.c | 137 ++++++++++++++ base/assert/is-safe-integer/binding.gyp | 170 ++++++++++++++++++ .../is-safe-integer/examples/c/Makefile | 146 +++++++++++++++ .../is-safe-integer/examples/c/example.c | 32 ++++ base/assert/is-safe-integer/include.gypi | 53 ++++++ .../stdlib/math/base/assert/is_safe_integer.h | 40 +++++ base/assert/is-safe-integer/lib/native.js | 51 ++++++ base/assert/is-safe-integer/manifest.json | 42 +++++ base/assert/is-safe-integer/src/Makefile | 70 ++++++++ base/assert/is-safe-integer/src/addon.c | 90 ++++++++++ base/assert/is-safe-integer/src/main.c | 42 +++++ .../is-safe-integer/test/test.native.js | 113 ++++++++++++ 15 files changed, 1284 insertions(+) create mode 100644 base/assert/is-safe-integer/benchmark/benchmark.native.js create mode 100644 base/assert/is-safe-integer/benchmark/c/native/Makefile create mode 100644 base/assert/is-safe-integer/benchmark/c/native/benchmark.c create mode 100644 base/assert/is-safe-integer/binding.gyp create mode 100644 base/assert/is-safe-integer/examples/c/Makefile create mode 100644 base/assert/is-safe-integer/examples/c/example.c create mode 100644 base/assert/is-safe-integer/include.gypi create mode 100644 base/assert/is-safe-integer/include/stdlib/math/base/assert/is_safe_integer.h create mode 100644 base/assert/is-safe-integer/lib/native.js create mode 100644 base/assert/is-safe-integer/manifest.json create mode 100644 base/assert/is-safe-integer/src/Makefile create mode 100644 base/assert/is-safe-integer/src/addon.c create mode 100644 base/assert/is-safe-integer/src/main.c create mode 100644 base/assert/is-safe-integer/test/test.native.js diff --git a/base/assert/is-safe-integer/README.md b/base/assert/is-safe-integer/README.md index 6c27683bb..b72c9fc68 100644 --- a/base/assert/is-safe-integer/README.md +++ b/base/assert/is-safe-integer/README.md @@ -95,6 +95,97 @@ bool = isSafeInteger( NaN ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/assert/is_safe_integer.h" +``` + +#### stdlib_base_is_safe_integer( x ) + +Test if a finite [double-precision floating-point number][ieee754] is a safe integer. + +```c +#include + +bool out = stdlib_base_is_safe_integer( 3.0 ); +// returns true + +out = stdlib_base_is_safe_integer( 2.0e200 ); +// returns false +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +bool stdlib_base_is_safe_integer( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/assert/is_safe_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_safe_integer( x[ i ] ); + printf( "Value: %lf. Is safe integer? %s.\n", x[ i ], ( b ) ? "True" : "False" ); + } +} +``` + +
+ + + +
+ + +