0.2.2 • Published 5 months ago
@stdlib/assert-is-cube-number v0.2.2
isCubeNumber
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
@stdlib/assert-is-integer
: test if a value is a number having an integer value.@stdlib/assert-is-number
: test if a value is a number.@stdlib/assert-is-square-number
: test if a value is a square number.
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.