@stdlib/math-base-assert-is-negative-finite
v0.3.0
Published
Test if a double-precision floating-point numeric value is a negative finite number.
Downloads
30
Readme
isNegativeFinite
Test if a double-precision floating-point numeric value is a negative finite number.
Installation
npm install @stdlib/math-base-assert-is-negative-finite
Usage
var isNegativeFinite = require( '@stdlib/math-base-assert-is-negative-finite' );
isNegativeFinite( x )
Tests if a double-precision floating-point numeric
value is a negative finite number.
var bool = isNegativeFinite( -3.14 );
// returns true
bool = isNegativeFinite( 2.0 );
// returns false
Examples
var isNegativeFinite = require( '@stdlib/math-base-assert-is-negative-finite' );
var bool = isNegativeFinite( -3.14 );
// returns true
bool = isNegativeFinite( 3.14 );
// returns false
bool = isNegativeFinite( 0.0 );
// returns false
bool = isNegativeFinite( -0.0 );
// returns false
bool = isNegativeFinite( NaN );
// returns false
C APIs
Usage
#include "stdlib/math/base/assert/is_negative_finite.h"
stdlib_base_is_negative_finite( x )
Tests if a double-precision floating-point numeric value is a negative finite number.
#include <stdbool.h>
bool out = stdlib_base_is_negative_finite( 1.0 );
// returns false
out = stdlib_base_is_negative_finite( -4.0 );
// returns true
The function accepts the following arguments:
- x:
[in] double
input value.
bool stdlib_base_is_negative_finite( const double x );
Examples
#include "stdlib/math/base/assert/is_negative_finite.h"
#include "stdlib/constants/float64/ninf.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, STDLIB_CONSTANT_FLOAT64_NINF };
bool b;
int i;
for ( i = 0; i < 6; i++ ) {
b = stdlib_base_is_negative_finite( x[ i ] );
printf( "x = %lf, is_negative_finite(x) = %s\n", x[ i ], ( b ) ? "True" : "False" );
}
}
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.