get-nans
v2.0.0
Published
Get an array of all distinct NaN values supported by the engine. There can be only one!
Downloads
54
Maintainers
Readme
get-nans
JavaScript should only have one distinguishable NaN
value. However, some engines violate this, and have at least two.
This module returns an array of all the NaN
s it knows how to detect on the current engine.
Current engines with only one observable NaN
value:
- Edge v14
Current known failures:
node
(v0.6
-v0.12
,v4.0
-v6.3.1
)io.js
(all versions)- Chrome (
v43
-v52
, at least) - Firefox (
v38
-v47
, at least) - Internet Explorer (
v10
-v11
)
Example
var getNaNs = require('get-nans');
var assert = require('assert');
var nans = getNaNs();
assert.deepEqual(nans, [NaN]);
Relevant links
- https://esdiscuss.org/topic/observability-of-nan-distinctions-is-this-a-concern
- https://bugs.webkit.org/show_bug.cgi?id=53598
- https://code.google.com/p/v8/issues/detail?id=1101
- https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type - see "Note"
- https://bugs.ecmascript.org/show_bug.cgi?id=3508
Tests
Simply clone the repo, npm install
, and run npm test