@stdlib/assert-is-negative-zero
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.5 • Public • Published

    isNegativeZero

    NPM version Build Status Coverage Status dependencies

    Test if a value is a number equal to negative zero.

    Installation

    npm install @stdlib/assert-is-negative-zero

    Usage

    var isNegativeZero = require( '@stdlib/assert-is-negative-zero' );

    isNegativeZero( value )

    Tests if a value is a number having a value equal to negative zero.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isNegativeZero( -0.0 );
    // returns true
    
    bool = isNegativeZero( new Number( -0.0 ) );
    // returns true
    
    bool = isNegativeZero( -3.14 );
    // returns false
    
    bool = isNegativeZero( 0.0 );
    // returns false
    
    bool = isNegativeZero( null );
    // returns false

    isNegativeZero.isPrimitive( value )

    Tests if a value is a primitive number equal to negative zero.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isNegativeZero.isPrimitive( -0.0 );
    // returns true
    
    bool = isNegativeZero.isPrimitive( new Number( -0.0 ) );
    // returns false

    isNegativeZero.isObject( value )

    Tests if a value is a Number object having a value equal to negative zero.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isNegativeZero.isObject( -0.0 );
    // returns false
    
    bool = isNegativeZero.isObject( new Number( -0.0 ) );
    // returns true

    Examples

    var Number = require( '@stdlib/number-ctor' );
    var isNegativeZero = require( '@stdlib/assert-is-negative-zero' );
    
    var bool = isNegativeZero( -0.0 );
    // returns true
    
    bool = isNegativeZero( new Number( -0.0 ) );
    // returns true
    
    bool = isNegativeZero( -3.14 );
    // returns false
    
    bool = isNegativeZero( 0.0 );
    // returns false
    
    bool = isNegativeZero( 5.0 );
    // returns false
    
    bool = isNegativeZero( '-0' );
    // returns false
    
    bool = isNegativeZero( null );
    // returns 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

    Chat


    License

    See LICENSE.

    Copyright

    Copyright © 2016-2021. The Stdlib Authors.

    Install

    npm i @stdlib/assert-is-negative-zero

    DownloadsWeekly Downloads

    7

    Version

    0.0.5

    License

    Apache-2.0

    Unpacked Size

    43.7 kB

    Total Files

    12

    Homepage

    stdlib.io

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar