diff --git a/is-negative-finite/README.md b/is-negative-finite/README.md
index 92d1d604..85787a3c 100644
--- a/is-negative-finite/README.md
+++ b/is-negative-finite/README.md
@@ -32,7 +32,7 @@ var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' );
#### isNegativeFinite( value )
-Tests if a `value` is a `number` having a finite negative value.
+Tests if a value is a number having a finite negative value.
@@ -54,13 +54,13 @@ bool = isNegativeFinite( 5.0 );
bool = isNegativeFinite( null );
// returns false
-bool = isNegativeFinite( Number.NEGATIVE_INFINITY );
+bool = isNegativeFinite( -1.0/0.0 );
// returns false
```
#### isNegativeFinite.isPrimitive( value )
-Tests if a `value` is a primitive `number` having a finite negative value.
+Tests if a value is a primitive number having a finite negative value.
@@ -76,7 +76,7 @@ bool = isNegativeFinite.isPrimitive( new Number( -3.0 ) );
#### isNegativeFinite.isObject( value )
-Tests if a `value` is a `Number` object having a finite negative value.
+Tests if a value is a `Number` object having a finite negative value.
@@ -126,6 +126,12 @@ bool = isNegativeFinite( '-5' );
bool = isNegativeFinite( null );
// returns false
+
+bool = isNegativeFinite( -1.0/0.0 );
+// returns false
+
+bool = isNegativeFinite( new Number( -1.0/0.0 ) );
+// returns false
```
@@ -136,12 +142,6 @@ bool = isNegativeFinite( null );
@@ -150,12 +150,6 @@ bool = isNegativeFinite( null );
-
-
-[@stdlib/assert/is-number]: https://github.com/stdlib-js/assert/tree/main/is-number
-
-
-
diff --git a/is-negative-finite/benchmark/benchmark.js b/is-negative-finite/benchmark/benchmark.js
index be0d390b..b340bfcf 100644
--- a/is-negative-finite/benchmark/benchmark.js
+++ b/is-negative-finite/benchmark/benchmark.js
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-/* eslint-disable no-undefined, no-empty-function */
+/* eslint-disable no-empty-function */
'use strict';
@@ -43,12 +43,12 @@ bench( pkg+'::primitives', function benchmark( b ) {
3.14,
-5.0,
-4.0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
NaN,
true,
false,
null,
- undefined
+ void 0
];
b.tic();
@@ -78,7 +78,7 @@ bench( pkg+'::objects', function benchmark( b ) {
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 ),
- new Number( Number.NEGATIVE_INFINITY )
+ new Number( -1.0/0.0 )
];
b.tic();
@@ -108,12 +108,12 @@ bench( pkg+'::primitives:isPrimitive', function benchmark( b ) {
3.14,
-5.0,
-4.0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
NaN,
true,
false,
null,
- undefined
+ void 0
];
b.tic();
@@ -143,7 +143,7 @@ bench( pkg+'::objects:isPrimitive', function benchmark( b ) {
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 ),
- new Number( Number.NEGATIVE_INFINITY )
+ new Number( -1.0/0.0 )
];
b.tic();
@@ -173,12 +173,12 @@ bench( pkg+'::primitives:isObject', function benchmark( b ) {
3.14,
-5.0,
-4.0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
NaN,
true,
false,
null,
- undefined
+ void 0
];
b.tic();
@@ -208,7 +208,7 @@ bench( pkg+'::objects:isObject', function benchmark( b ) {
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 ),
- new Number( Number.NEGATIVE_INFINITY )
+ new Number( -1.0/0.0 )
];
b.tic();
diff --git a/is-negative-finite/docs/repl.txt b/is-negative-finite/docs/repl.txt
index 3d7241b9..648844b2 100644
--- a/is-negative-finite/docs/repl.txt
+++ b/is-negative-finite/docs/repl.txt
@@ -10,7 +10,7 @@
Returns
-------
bool: boolean
- Boolean indicating whether value is a finite negative number.
+ Boolean indicating whether a value is a finite negative number.
Examples
--------
@@ -24,9 +24,9 @@
false
> bool = {{alias}}( null )
false
- > bool = {{alias}}( Number.NEGATIVE_INFINITY )
+ > bool = {{alias}}( -1.0/0.0 )
false
- > bool = {{alias}}( new Number( Number.NEGATIVE_INFINITY ) )
+ > bool = {{alias}}( new Number( -1.0/0.0 ) )
false
@@ -41,7 +41,7 @@
Returns
-------
bool: boolean
- Boolean indicating whether value is a number primitive having a finite
+ Boolean indicating whether a value is a number primitive having a finite
negative value.
Examples
@@ -50,9 +50,9 @@
true
> bool = {{alias}}.isPrimitive( new Number( -3.0 ) )
false
- > var bool = {{alias}}.isPrimitive( Number.NEGATIVE_INFINITY )
+ > var bool = {{alias}}.isPrimitive( -1.0/0.0 )
false
- > bool = {{alias}}.isPrimitive( new Number( Number.NEGATIVE_INFINITY ) )
+ > bool = {{alias}}.isPrimitive( new Number( -1.0/0.0 ) )
false
@@ -67,7 +67,7 @@
Returns
-------
bool: boolean
- Boolean indicating whether value is a number object having a finite
+ Boolean indicating whether a value is a number object having a finite
negative value.
Examples
@@ -76,9 +76,9 @@
false
> bool = {{alias}}.isObject( new Number( -3.0 ) )
true
- > bool = {{alias}}.isObject( Number.NEGATIVE_INFINITY )
+ > bool = {{alias}}.isObject( -1.0/0.0 )
false
- > bool = {{alias}}.isObject( new Number( Number.NEGATIVE_INFINITY ) )
+ > bool = {{alias}}.isObject( new Number( -1.0/0.0 ) )
false
See Also
diff --git a/is-negative-finite/docs/types/index.d.ts b/is-negative-finite/docs/types/index.d.ts
index e0fef096..2bc21dd5 100644
--- a/is-negative-finite/docs/types/index.d.ts
+++ b/is-negative-finite/docs/types/index.d.ts
@@ -49,7 +49,7 @@ interface isNegativeFinite {
* // returns false
*
* @example
- * var bool = isNegativeFinite( Number.NEGATIVE_INFINITY );
+ * var bool = isNegativeFinite( -1.0/0.0 );
* // returns false
*/
( value: number | Number ): value is number | Number;
@@ -74,7 +74,7 @@ interface isNegativeFinite {
* Tests if a value is a number object having a negative value.
*
* @param value - value to test
- * @returns boolean indicating if a value is a number object having a negative value
+ * @returns boolean indicating if a value is a number object having a finite negative value
*
* @example
* var bool = isNegativeFinite.isObject( -3.0 );
@@ -91,7 +91,7 @@ interface isNegativeFinite {
* Tests if a value is a negative number.
*
* @param value - value to test
-* @returns boolean indicating whether value is a negative number
+* @returns boolean indicating whether value is a finite negative number
*
* @example
* var bool = isNegativeFinite( -5.0 );
@@ -122,11 +122,11 @@ interface isNegativeFinite {
* // returns true
*
* @example
-* var bool = isNegativeFinite.isPrimitive( Number.NEGATIVE_INFINITY );
+* var bool = isNegativeFinite.isPrimitive( -1.0/0.0 );
* // returns false
*
* @example
-* var bool = isNegativeFinite.isObject( new Number( Number.NEGATIVE_INFINITY ) );
+* var bool = isNegativeFinite.isObject( new Number( -1.0/0.0 ) );
* // returns false
*/
declare var isNegativeFinite: isNegativeFinite;
diff --git a/is-negative-finite/examples/index.js b/is-negative-finite/examples/index.js
index f9b71118..961876ca 100644
--- a/is-negative-finite/examples/index.js
+++ b/is-negative-finite/examples/index.js
@@ -42,8 +42,8 @@ console.log( isNegativeFinite( '-5' ) );
console.log( isNegativeFinite( null ) );
// => false
-console.log( isNegativeFinite( Number.NEGATIVE_INFINITY ) );
+console.log( isNegativeFinite( -1.0/0.0 ) );
// => false
-console.log( isNegativeFinite( new Number(Number.NEGATIVE_INFINITY) ) );
+console.log( isNegativeFinite( new Number( -1.0/0.0 ) ) );
// => false
diff --git a/is-negative-finite/lib/index.js b/is-negative-finite/lib/index.js
index f2d432df..1e7516c9 100644
--- a/is-negative-finite/lib/index.js
+++ b/is-negative-finite/lib/index.js
@@ -19,7 +19,7 @@
'use strict';
/**
-* Test if a value is a negative finite number.
+* Test if a value is a finite negative number.
*
* @module @stdlib/assert/is-negative-finite
*
@@ -41,11 +41,10 @@
* bool = isNegativeFinite( null );
* // returns false
*
-* bool = isNegativeFinite( Number.NEGATIVE_INFINITY );
+* bool = isNegativeFinite( -1.0/0.0 );
* // returns false
*
* @example
-* // Use interface to check for finite negative number primitives...
* var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ).isPrimitive;
*
* var bool = isNegativeFinite( -3.0 );
@@ -54,11 +53,10 @@
* bool = isNegativeFinite( new Number( -3.0 ) );
* // returns false
*
-* bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) );
+* bool = isNegativeFinite( new Number( -1.0/0.0 ) );
* // returns false
*
* @example
-* // Use interface to check for negative number objects...
* var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ).isObject;
*
* var bool = isNegativeFinite( -3.0 );
@@ -67,7 +65,7 @@
* bool = isNegativeFinite( new Number( -3.0 ) );
* // returns true
*
-* bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) );
+* bool = isNegativeFinite( new Number( -1.0/0.0 ) );
* // returns false
*/
diff --git a/is-negative-finite/lib/object.js b/is-negative-finite/lib/object.js
index af7e662f..7d6fa4a9 100644
--- a/is-negative-finite/lib/object.js
+++ b/is-negative-finite/lib/object.js
@@ -21,7 +21,7 @@
// MODULES //
var isNumber = require( './../../is-number' ).isObject;
-var isFinite = require( './../../is-finite' ).isObject; // eslint-disable-line stdlib/no-redeclare
+var NINF = require( '@stdlib/constants/float64/ninf' );
// MAIN //
@@ -51,7 +51,8 @@ var isFinite = require( './../../is-finite' ).isObject; // eslint-disable-line s
function isNegativeFinite( value ) {
return (
isNumber( value ) &&
- value.valueOf() < 0.0 && isFinite(value)
+ value.valueOf() < 0.0 &&
+ value.valueOf() > NINF
);
}
diff --git a/is-negative-finite/lib/primitive.js b/is-negative-finite/lib/primitive.js
index dd566115..2df18f44 100644
--- a/is-negative-finite/lib/primitive.js
+++ b/is-negative-finite/lib/primitive.js
@@ -21,13 +21,13 @@
// MODULES //
var isNumber = require( './../../is-number' ).isPrimitive;
-var isFinite = require( './../../is-finite' ).isPrimitive; // eslint-disable-line stdlib/no-redeclare
+var NINF = require( '@stdlib/constants/float64/ninf' );
// MAIN //
/**
-* Tests if a value is a number primitive having finite a negative value.
+* Tests if a value is a number primitive having a finite negative value.
*
* @param {*} value - value to test
* @returns {boolean} boolean indicating if a value is a number primitive having a finite negative value
@@ -37,7 +37,7 @@ var isFinite = require( './../../is-finite' ).isPrimitive; // eslint-disable-lin
* // returns true
*
* @example
-* var bool = isNegativeFinite( Number.NEGATIVE_INFINITY );
+* var bool = isNegativeFinite( -1.0/0.0 );
* // returns false
*
* @example
@@ -45,13 +45,14 @@ var isFinite = require( './../../is-finite' ).isPrimitive; // eslint-disable-lin
* // returns false
*
* @example
-* var bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) );
+* var bool = isNegativeFinite( new Number( -1.0/0.0 ) );
* // returns false
*/
function isNegativeFinite( value ) {
return (
isNumber( value ) &&
- value < 0.0 && isFinite(value)
+ value < 0.0 &&
+ value > NINF
);
}
diff --git a/is-negative-finite/package.json b/is-negative-finite/package.json
index 2baaeae6..b0cd88a3 100644
--- a/is-negative-finite/package.json
+++ b/is-negative-finite/package.json
@@ -1,7 +1,7 @@
{
- "name": "@stdlib/assert/is-negative-number",
+ "name": "@stdlib/assert/is-negative-finite",
"version": "0.0.0",
- "description": "Test if a value is a number having a negative value.",
+ "description": "Test if a value is a number having a finite negative value.",
"license": "Apache-2.0",
"author": {
"name": "The Stdlib Authors",
@@ -63,6 +63,8 @@
"is",
"isnumber",
"isnumeric",
+ "finite",
+ "isfinite",
"type",
"check",
"primitive",
diff --git a/is-negative-finite/test/test.main.js b/is-negative-finite/test/test.main.js
index f708c771..a128aced 100644
--- a/is-negative-finite/test/test.main.js
+++ b/is-negative-finite/test/test.main.js
@@ -48,7 +48,7 @@ tape( 'the function returns `false` if not provided a number having a finite neg
3.14,
1.0,
0.0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
null,
true,
void 0,
diff --git a/is-negative-finite/test/test.object.js b/is-negative-finite/test/test.object.js
index bd6743f7..420404cc 100644
--- a/is-negative-finite/test/test.object.js
+++ b/is-negative-finite/test/test.object.js
@@ -55,7 +55,8 @@ tape( 'the function returns `false` if not provided a finite negative number', f
null,
true,
void 0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
+ new Number( -1.0/0.0 ),
[],
{},
new Date(),
diff --git a/is-negative-finite/test/test.primitive.js b/is-negative-finite/test/test.primitive.js
index 57a8d300..8a7ec3a4 100644
--- a/is-negative-finite/test/test.primitive.js
+++ b/is-negative-finite/test/test.primitive.js
@@ -55,7 +55,7 @@ tape( 'the function returns `false` if not provided a finite negative number', f
null,
true,
void 0,
- Number.NEGATIVE_INFINITY,
+ -1.0/0.0,
[],
{},
function noop() {}
diff --git a/is-nonnegative-finite/lib/object.js b/is-nonnegative-finite/lib/object.js
index 30ae1157..0dc49193 100644
--- a/is-nonnegative-finite/lib/object.js
+++ b/is-nonnegative-finite/lib/object.js
@@ -51,7 +51,7 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
function isNonNegativeFinite( value ) {
return (
isNonNegativeNumber( value ) &&
- value < PINF
+ value.valueOf() < PINF
);
}