aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/javascript/reference/global_objects/number/epsilon/index.html
blob: 09ea32708c2b20ce0170e17dc064d2d1d50f22f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: Number.EPSILON
slug: Web/JavaScript/Reference/Global_Objects/Number/EPSILON
tags:
  - ECMAScript 2015
  - JavaScript
  - Number
  - Właściwość
translation_of: Web/JavaScript/Reference/Global_Objects/Number/EPSILON
original_slug: Web/JavaScript/Referencje/Obiekty/Number/EPSILON
---
<div>{{JSRef}}</div>

<p>Właściwość <strong><code>Number.EPSILON</code></strong> reprezentuje różnicę pomiędzy 1 a najmniejszą liczbą zmiennoprzecinkową większą niż 1.</p>

<p>Jest to właściwość statyczna. Nie musisz tworzyć obiektu {{jsxref("Number")}}, żeby mieć do niej dostęp (użyj <code>Number.EPSILON</code>).</p>

<div>{{EmbedInteractiveExample("pages/js/number-epsilon.html")}}</div>



<div>{{js_property_attributes(0, 0, 0)}}</div>

<h2 id="Opis">Opis</h2>

<p>Wartość właściwości <code>EPSILON</code> to w przybliżeniu  <code>2.2204460492503130808472633361816E-16</code> lub <code>2<sup>-52</sup></code>.</p>

<h2 id="Przykłady">Przykłady</h2>

<h3 id="Testowanie_równości">Testowanie równości</h3>

<pre class="brush: js">x = 0.2;
y = 0.3;
z = 0.1;
equal = (Math.abs(x - y + z) &lt; Number.EPSILON);
</pre>

<h2 id="Polyfill">Polyfill</h2>

<pre class="brush: js">if (Number.EPSILON === undefined) {
    Number.EPSILON = Math.pow(2, -52);
}
</pre>

<h2 id="Specyfikacja">Specyfikacja</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('ES2015', '#sec-number.epsilon', 'Number.EPSILON')}}</td>
   <td>{{Spec2('ES2015')}}</td>
   <td>Initial definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-number.epsilon', 'Number.EPSILON')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Kompatybilność">Kompatybilność</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("javascript.builtins.Number.EPSILON")}}</p>

<h2 id="Zobacz_również">Zobacz również</h2>

<ul>
 <li>{{jsxref("Number")}} obiekt, do którego należy ta właściwość.</li>
</ul>