0.2.2 • Published 4 months ago

@stdlib/assert-is-cube-number v0.2.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

isCubeNumber

NPM version Build Status Coverage Status

Test if a value is a cube number.

A cube number is defined as an integer value which is the cube of an integer.

Installation

npm install @stdlib/assert-is-cube-number

Usage

var isCubeNumber = require( '@stdlib/assert-is-cube-number' );

isCubeNumber( value )

Tests if a value is a cube number.

var Number = require( '@stdlib/number-ctor' );

var bool = isCubeNumber( 8.0 );
// returns true

bool = isCubeNumber( new Number( 8.0 ) );
// returns true

bool = isCubeNumber( 3.14 );
// returns false

bool = isCubeNumber( -5.0 );
// returns false

bool = isCubeNumber( NaN );
// returns false

bool = isCubeNumber( null );
// returns false

isCubeNumber.isPrimitive( value )

Tests if a value is a primitive cube number.

var Number = require( '@stdlib/number-ctor' );

var bool = isCubeNumber.isPrimitive( 8.0 );
// returns true

bool = isCubeNumber.isPrimitive( new Number( 8.0 ) );
// returns false

isCubeNumber.isObject( value )

Tests if a value is a Number object having a value which is a cube number.

var Number = require( '@stdlib/number-ctor' );

var bool = isCubeNumber.isObject( 8.0 );
// returns false

bool = isCubeNumber.isObject( new Number( 8.0 ) );
// returns true

Examples

var Number = require( '@stdlib/number-ctor' );
var isCubeNumber = require( '@stdlib/assert-is-cube-number' );

var bool = isCubeNumber( 8.0 );
// returns true

bool = isCubeNumber( new Number( 8.0 ) );
// returns true

bool = isCubeNumber( 0.0 );
// returns true

bool = isCubeNumber( 1.0 );
// returns true

bool = isCubeNumber( 3.14 );
// returns false

bool = isCubeNumber( -5.0 );
// returns false

bool = isCubeNumber( NaN );
// returns false

bool = isCubeNumber( '0.5' );
// returns false

bool = isCubeNumber( null );
// returns false

See Also


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-2024. The Stdlib Authors.