time-to-botec/squiggle/node_modules/@stdlib/math/base/assert/is-negative-integer/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.2 KiB

isNegativeInteger

Test if a finite double-precision floating-point number is a negative integer.

Usage

var isNegativeInteger = require( '@stdlib/math/base/assert/is-negative-integer' );

isNegativeInteger( x )

Tests if a finite double-precision floating-point number is a negative integer.

var bool = isNegativeInteger( -1.0 );
// returns true

bool = isNegativeInteger( 0.0 );
// returns false

bool = isNegativeInteger( 10.0 );
// returns false

Notes

  • The function assumes a finite number. If provided negative infinity, the function will return true, when, in fact, the result is undefined. If x can be infinite, wrap the implementation as follows:

    function check( x ) {
        return (
            x > -Infinity &&
            isNegativeInteger( x )
        );
    }
    
    var bool = check( -Infinity );
    // returns false
    

Examples

var isNegativeInteger = require( '@stdlib/math/base/assert/is-negative-integer' );

var bool = isNegativeInteger( -5.0 );
// returns true

bool = isNegativeInteger( 0.0 );
// returns false

bool = isNegativeInteger( 1.0 );
// returns false

bool = isNegativeInteger( -3.14 );
// returns false

bool = isNegativeInteger( NaN );
// returns false