Number.EPSILON
プロパティは、1 と 1 より大きい浮動小数点の最小値の差を表します。
この静的なプロパティにアクセスするために Number
オブジェクトを生成する必要はありません(Number.EPSILON
を使ってください)。
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Number.EPSILON のプロパティ属性 |
|
---|---|
書込可能 | 不可 |
列挙可能 | 不可 |
設定可能 | 不可 |
説明
EPSILON
プロパティは およそ 2.2204460492503130808472633361816E-16
、または 2-52
の値を持っています。
例
同等なことをテストする
x = 0.2; y = 0.3; z = 0.1; equal = (Math.abs(x - y + z) < Number.EPSILON);
Polyfill
if (Number.EPSILON === undefined) { Number.EPSILON = Math.pow(2, -52); }
仕様
仕様 | 状況 | コメント |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Number.EPSILON の定義 |
標準 | 初回定義 |
ECMAScript Latest Draft (ECMA-262) Number.EPSILON の定義 |
ドラフト |
ブラウザー実装状況
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
デスクトップ | モバイル | サーバー | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EPSILON | Chrome 完全対応 34 | Edge 完全対応 12 | Firefox 完全対応 25 | IE 未対応 なし | Opera 完全対応 21 | Safari 完全対応 9 | WebView Android 完全対応 ≤37 | Chrome Android 完全対応 34 | Firefox Android 完全対応 25 | Opera Android 完全対応 21 | Safari iOS 完全対応 9 | Samsung Internet Android 完全対応 2.0 | nodejs 完全対応 0.12 |
凡例
- 完全対応
- 完全対応
- 未対応
- 未対応
関連情報
Number
オブジェクトに属します。