-
Notifications
You must be signed in to change notification settings - Fork 68
/
x15.8.html
1009 lines (1007 loc) · 36.5 KB
/
x15.8.html
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="split chapter"><head><meta charset="utf-8"><title>15.8 The Math Object # Ⓣ Ⓔ ① Ⓐ — Annotated ES5</title><link rel="stylesheet" href="style.css"><link href="x15.7.html" title="15.7 Number Objects " rel="prev">
<link href="spec.html" title="TOC" rel="index">
<link href="x15.9.html" title="15.9 Date Objects " rel="next">
</head><body><div class="head">
<h2 id="top">Annotated ECMAScript 5.1 <span id="timestamp"></span></h2>
<div id="mascot-treehouse">
<img id="mascot" align="left" src="js-mascot.svg" alt=""><img id="bubble" src="bubble.svg" alt=""></div>
<p id="slogan">‟Ex igne vita”</p>
<div id="annotations"></div>
<script src="timestamp.js"></script></div>
<nav>
<a href="x15.7.html">← 15.7 Number Objects </a> –
<a href="spec.html" class="toc-nav">TOC</a> –
<a href="x15.9.html">15.9 Date Objects →</a>
<ol class="toc"><li><ol><li><a href="x15.8.html#x15.8" id="x15.8-toc">15.8 The Math Object</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.8.html#x15.8.1" id="x15.8.1-toc">15.8.1 Value Properties of the Math Object</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.8.html#x15.8.1.1" id="x15.8.1.1-toc">15.8.1.1 E</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.2" id="x15.8.1.2-toc">15.8.1.2 LN10</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.3" id="x15.8.1.3-toc">15.8.1.3 LN2</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.4" id="x15.8.1.4-toc">15.8.1.4 LOG2E</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.5" id="x15.8.1.5-toc">15.8.1.5 LOG10E</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.6" id="x15.8.1.6-toc">15.8.1.6 PI</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.7" id="x15.8.1.7-toc">15.8.1.7 SQRT1_2</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.1.8" id="x15.8.1.8-toc">15.8.1.8 SQRT2</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li><li><a href="x15.8.html#x15.8.2" id="x15.8.2-toc">15.8.2 Function Properties of the Math Object</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.8.html#x15.8.2.1" id="x15.8.2.1-toc">15.8.2.1 abs (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.2" id="x15.8.2.2-toc">15.8.2.2 acos (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.3" id="x15.8.2.3-toc">15.8.2.3 asin (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.4" id="x15.8.2.4-toc">15.8.2.4 atan (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.5" id="x15.8.2.5-toc">15.8.2.5 atan2 (y, x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.6" id="x15.8.2.6-toc">15.8.2.6 ceil (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.7" id="x15.8.2.7-toc">15.8.2.7 cos (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.8" id="x15.8.2.8-toc">15.8.2.8 exp (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.9" id="x15.8.2.9-toc">15.8.2.9 floor (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.10" id="x15.8.2.10-toc">15.8.2.10 log (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.11" id="x15.8.2.11-toc">15.8.2.11 max ( [ value1 [ , value2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.12" id="x15.8.2.12-toc">15.8.2.12 min ( [ value1 [ , value2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.13" id="x15.8.2.13-toc">15.8.2.13 pow (x, y)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.14" id="x15.8.2.14-toc">15.8.2.14 random ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.15" id="x15.8.2.15-toc">15.8.2.15 round (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.16" id="x15.8.2.16-toc">15.8.2.16 sin (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.17" id="x15.8.2.17-toc">15.8.2.17 sqrt (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.8.html#x15.8.2.18" id="x15.8.2.18-toc">15.8.2.18 tan (x)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li></ol></li></ol></li></ol></nav>
<h3 id="x15.8" class="splitme">15.8 The Math Object <a href="#x15.8">#</a> <a href="#x15.8-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h3>
<p>
The
Math object is a single object that has some named properties, some
of which are functions.</p>
<p>
The
value of the [[Prototype]] internal property of the Math object is
the standard built-in Object prototype object (<a href="x15.2.html#x15.2.4">15.2.4</a>). The value of
the [[Class]] internal property of the Math object is <code><b>"Math"</b></code>.</p>
<p>
The
Math object does not have a [[Construct]] internal property; it is
not possible to use the Math object as a constructor with the <code><b>new</b></code>
operator.</p>
<p>
The
Math object does not have a [[Call]] internal property; it is not
possible to invoke the Math object as a function.</p>
<p><b class="note">NOTE</b> In
this specification, the phrase “the Number value for <i>x</i>”
has a technical meaning defined in <a href="x8.html#x8.5">8.5</a>.</p>
<h4 id="x15.8.1">15.8.1 Value Properties of the Math Object <a href="#x15.8.1">#</a> <a href="#x15.8.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<h5 id="x15.8.1.1">15.8.1.1 E <a href="#x15.8.1.1">#</a> <a href="#x15.8.1.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for <i>e</i>,
the base of the natural logarithms, which is approximately
2.7182818284590452354.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h5 id="x15.8.1.2">15.8.1.2 LN10 <a href="#x15.8.1.2">#</a> <a href="#x15.8.1.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the natural logarithm of 10, which is approximately
2.302585092994046.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h5 id="x15.8.1.3">15.8.1.3 LN2 <a href="#x15.8.1.3">#</a> <a href="#x15.8.1.3-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the natural logarithm of 2, which is approximately
0.6931471805599453.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h5 id="x15.8.1.4">15.8.1.4 LOG2E <a href="#x15.8.1.4">#</a> <a href="#x15.8.1.4-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the base-2
logarithm of <i>e</i>,
the base of the natural logarithms; this value is approximately
1.4426950408889634.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<p><b class="note">NOTE</b> The
value of <code><b>Math.LOG2E</b></code>
is approximately the reciprocal of the value of <code><b>Math.LN2</b></code>.</p>
<h5 id="x15.8.1.5">15.8.1.5 LOG10E <a href="#x15.8.1.5">#</a> <a href="#x15.8.1.5-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the base-10
logarithm of <i>e</i>,
the base of the natural logarithms; this value is approximately
0.4342944819032518.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<p><b class="note">NOTE</b> The
value of <code><b>Math.LOG10E</b></code>
is approximately the reciprocal of the value of <code><b>Math.LN10</b></code>.</p>
<h5 id="x15.8.1.6">15.8.1.6 PI <a href="#x15.8.1.6">#</a> <a href="#x15.8.1.6-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for <span class="symbol">π</span>, the ratio of
the circumference of a circle to its diameter, which is
approximately 3.1415926535897932.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h5 id="x15.8.1.7">15.8.1.7 SQRT1_2 <a href="#x15.8.1.7">#</a> <a href="#x15.8.1.7-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the square root of ½,
which is approximately 0.7071067811865476.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<p><b class="note">NOTE</b> The
value of <code><b>Math.SQRT1_2</b></code>
is approximately the reciprocal of the value of <code><b>Math.SQRT2</b></code>.</p>
<h5 id="x15.8.1.8">15.8.1.8 SQRT2 <a href="#x15.8.1.8">#</a> <a href="#x15.8.1.8-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
Number value for the square root of 2,
which is approximately 1.4142135623730951.</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h4 id="x15.8.2">15.8.2 Function Properties of the Math Object <a href="#x15.8.2">#</a> <a href="#x15.8.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<p>
Each
of the following <code><b><a href="#x15.8" class="term-ref">Math</a></b></code> object functions applies the <a href="x9.html#x9.3">ToNumber</a> abstract operator to each of
its arguments (in left-to-right order if there is more than one) and
then performs a computation on the resulting Number value(s).</p>
<p>
In
the function descriptions below, the symbols NaN, <span class="symbol">−</span>0,
+0, <span class="symbol">−∞</span> and +<span class="symbol">∞</span>
refer to the Number values described in <a href="x8.html#x8.5">8.5</a>.</p>
<p><b class="note">NOTE</b> The
behaviour of the functions <code><b>acos</b></code>,
<code><b>asin</b></code>, <code><b>atan</b></code>,
<code><b>atan2</b></code>, <code><b>cos</b></code>,
<code><b>exp</b></code>, <code><b>log</b></code>,
<code><b>pow</b></code>, <code><b>sin</b></code>,
and <code><b>sqrt</b></code> is not
precisely specified here except to require specific results for
certain argument values that represent boundary cases of interest.
For other argument values, these functions are intended to compute
approximations to the results of familiar mathematical functions,
but some latitude is allowed in the choice of approximation
algorithms. The general intent is that an implementer should be able
to use the same mathematical library for ECMAScript on a given
hardware platform that is available to C programmers on that
platform.</p>
<p>
Although
the choice of algorithms is left to the implementation, it is
recommended (but not specified by this standard) that
implementations use the approximation algorithms for IEEE 754
arithmetic contained in <code><b>fdlibm</b></code>,
the freely distributable mathematical library from Sun Microsystems
(<a href="http://www.netlib.org/fdlibm">http://www.netlib.org/fdlibm</a>).
</p>
<h5 id="x15.8.2.1">15.8.2.1 abs (x) <a href="#x15.8.2.1">#</a> <a href="#x15.8.2.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
the absolute value of <i>x</i>;
the result has the same magnitude as <i>x</i>
but has positive sign.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li></ul><h5 id="x15.8.2.2">15.8.2.2 acos (x) <a href="#x15.8.2.2">#</a> <a href="#x15.8.2.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the arc cosine of <i>x</i>.
The result is expressed in radians and ranges from +0
to +<span class="symbol">π</span>.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is greater than 1, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is less than <span class="symbol"><b>−</b></span>1,
the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is exactly 1, the result is +0.</p>
</li></ul><h5 id="x15.8.2.3">15.8.2.3 asin (x) <a href="#x15.8.2.3">#</a> <a href="#x15.8.2.3-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the arc sine of <i>x</i>.
The result is expressed in radians and ranges from <span class="symbol">−π</span>/2
to +<span class="symbol">π</span>/2.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is greater than 1, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is less than –1, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li></ul><h5 id="x15.8.2.4">15.8.2.4 atan (x) <a href="#x15.8.2.4">#</a> <a href="#x15.8.2.4-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the arc tangent of <i>x</i>.
The result is expressed in radians and ranges from <span class="symbol">−π</span>/2
to +<span class="symbol">π</span>/2.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is an implementation-dependent approximation to +<span class="symbol">π</span>/2.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>/2.</p>
</li></ul><h5 id="x15.8.2.5">15.8.2.5 atan2 (y, x) <a href="#x15.8.2.5">#</a> <a href="#x15.8.2.5-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the arc tangent of the
quotient <i>y</i><b>/</b><i>x</i>
of the arguments <i>y</i>
and <i>x</i>, where the
signs of <i>y</i> and <i>x</i>
are used to determine the quadrant of the result. Note that it is
intentional and traditional for the two-argument arc tangent
function that the argument named <i>y</i>
be first and the argument named <i>x</i>
be second. The result is expressed in radians and ranges from <span class="symbol">−π</span>
to +<span class="symbol">π</span>.</p>
<ul><li><p>
If
either <i>x</i>
or <i>y</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>y</i>>0
and <i>x</i>
is +0, the result is an implementation-dependent approximation to
+<span class="symbol">π</span>/2.</p>
</li>
<li><p>
If
<i>y</i>>0
and <i>x</i>
is <span class="symbol">−</span>0,
the result is an implementation-dependent approximation to +<span class="symbol">π</span>/2.</p>
</li>
<li><p>
If
<i>y</i>
is +0 and <i>x</i>>0,
the result is +0.</p>
</li>
<li><p>
If
<i>y</i>
is +0 and <i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>y</i>
is +0 and <i>x</i>
is <span class="symbol">−</span>0,
the result is an implementation-dependent approximation to +<span class="symbol">π</span>.</p>
</li>
<li><p>
If
<i>y</i>
is +0 and <i>x</i><0,
the result is an implementation-dependent approximation to +<span class="symbol">π</span>.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−</span>0
and <i>x</i>>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−</span>0
and <i>x</i>
is +0, the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−</span>0
and <i>x</i>
is <span class="symbol">−</span>0,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−</span>0
and <i>x</i><0,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>.</p>
</li>
<li><p>
If
<i>y</i><0
and <i>x</i>
is +0, the result is an implementation-dependent approximation to
<span class="symbol">−π</span>/2.</p>
</li>
<li><p>
If
<i>y</i><0
and <i>x</i>
is <span class="symbol">−</span>0,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>/2.</p>
</li>
<li><p>
If
<i>y</i>>0
and <i>y</i>
is finite and <i>x</i>
is +<span class="symbol">∞</span>,
the result is +0.</p>
</li>
<li><p>
If
<i>y</i>>0
and <i>y</i>
is finite and <i>x</i>
is <span class="symbol">−∞</span>,
the result if an implementation-dependent approximation to +<span class="symbol">π</span>.</p>
</li>
<li><p>
If
<i>y</i><0
and <i>y</i>
is finite and <i>x</i>
is +<span class="symbol">∞</span>,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>y</i><0
and <i>y</i>
is finite and <i>x</i>
is <span class="symbol">−∞</span>,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>.</p>
</li>
<li><p>
If
<i>y</i>
is +<span class="symbol">∞</span>
and <i>x</i>
is finite, the result is an implementation-dependent approximation
to +<span class="symbol">π</span>/2.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−∞</span>
and <i>x</i>
is finite, the result is an implementation-dependent approximation
to <span class="symbol">−π</span>/2.</p>
</li>
<li><p>
If
<i>y</i>
is +<span class="symbol">∞</span>
and <i>x</i>
is +<span class="symbol">∞</span>,
the result is an implementation-dependent approximation to +<span class="symbol">π</span>/4.</p>
</li>
<li><p>
If
<i>y</i>
is +<span class="symbol">∞</span>
and <i>x</i>
is <span class="symbol">−∞</span>,
the result is an implementation-dependent approximation to +3<span class="symbol">π</span>/4.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−∞</span>
and <i>x</i>
is +<span class="symbol">∞</span>,
the result is an implementation-dependent approximation to <span class="symbol">−π</span>/4.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−∞</span>
and <i>x</i>
is <span class="symbol">−∞</span>,
the result is an implementation-dependent approximation to <span class="symbol">−</span>3<span class="symbol">π</span>/4.</p>
</li></ul><h5 id="x15.8.2.6">15.8.2.6 ceil (x) <a href="#x15.8.2.6">#</a> <a href="#x15.8.2.6-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
the smallest (closest to <span class="symbol"><b>−∞</b></span>)
Number value that is not less than <i>x</i>
and is equal to a mathematical integer. If <i>x</i>
is already an integer, the result is <i>x</i>.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is less than 0 but greater than -1, the result is <span class="symbol">−</span>0.</p>
</li></ul><p>
The
value of <code><b>Math.ceil(x)</b></code>
is the same as the value of <code><b>-Math.floor(-x)</b></code>.</p>
<h5 id="x15.8.2.7">15.8.2.7 cos (x) <a href="#x15.8.2.7">#</a> <a href="#x15.8.2.7-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the cosine of <i>x</i>.
The argument is expressed in radians.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is 1.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is 1.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is NaN.</p>
</li></ul><h5 id="x15.8.2.8">15.8.2.8 exp (x) <a href="#x15.8.2.8">#</a> <a href="#x15.8.2.8-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the exponential
function of <i>x</i> (<i>e</i>
raised to the power of <i>x</i>,
where <i>e</i> is the
base of the natural logarithms).</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is 1.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is 1.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is +0.</p>
</li></ul><h5 id="x15.8.2.9">15.8.2.9 floor (x) <a href="#x15.8.2.9">#</a> <a href="#x15.8.2.9-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
the greatest (closest to <b>+</b><span class="symbol"><b>∞</b></span>)
Number value that is not greater than <i>x</i>
and is equal to a mathematical integer. If <i>x</i>
is already an integer, the result is <i>x</i>.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is greater than 0 but less than 1, the result is +0.</p>
</li></ul><p><b class="note">NOTE</b> The
value of <code><b>Math.floor(x)</b></code>
is the same as the value of <code><b>-Math.ceil(-x)</b></code>.</p>
<h5 id="x15.8.2.10">15.8.2.10 log (x) <a href="#x15.8.2.10">#</a> <a href="#x15.8.2.10-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<ul><li><p>
Returns
an implementation-dependent approximation to the natural logarithm
of <i>x</i>.</p>
</li>
<li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is less than 0, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0 or <span class="symbol">−</span>0,
the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is 1, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li></ul><h5 id="x15.8.2.11">15.8.2.11 max ( [ value1 [ , value2 [ , … ] ] ] ) <a href="#x15.8.2.11">#</a> <a href="#x15.8.2.11-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Given
zero or more arguments, calls <a href="x9.html#x9.3">ToNumber</a> on each of the arguments and
returns the largest of the resulting values.</p>
<ul><li><p>
If
no arguments are given, the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
any value is NaN, the result is NaN.</p>
</li>
<li><p>
The
comparison of values to determine the largest value is done as in
<a href="x11.html#x11.8.5">11.8.5</a> except that +0 is considered to be larger than <span class="symbol">−</span>0.</p>
</li></ul><p>
The
<code><b>length</b></code> property of
the <code><b>max</b></code> method is
<b>2</b>.</p>
<h5 id="x15.8.2.12">15.8.2.12 min ( [ value1 [ , value2 [ , … ] ] ] ) <a href="#x15.8.2.12">#</a> <a href="#x15.8.2.12-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Given
zero or more arguments, calls <a href="x9.html#x9.3">ToNumber</a> on each of the arguments and
returns the smallest of the resulting values.</p>
<ul><li><p>
If
no arguments are given, the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
any value is NaN, the result is NaN.</p>
</li>
<li><p>
The
comparison of values to determine the smallest value is done as in
<a href="x11.html#x11.8.5">11.8.5</a> except that +0 is considered to be larger than <span class="symbol">−</span>0.</p>
</li></ul><p>
The
<code><b>length</b></code> property of
the <code><b>min</b></code> method is
<b>2</b>.</p>
<h5 id="x15.8.2.13">15.8.2.13 pow (x, y) <a href="#x15.8.2.13">#</a> <a href="#x15.8.2.13-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the result of raising <i>x</i>
to the power <i>y</i>.</p>
<ul><li><p>
If
<i>y</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>y</i>
is +0, the result is 1, even if <i>x</i>
is NaN.</p>
</li>
<li><p>
If
<i>y</i>
is <span class="symbol">−</span>0,
the result is 1, even if <i>x</i>
is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is NaN and <i>y</i>
is nonzero, the result is NaN.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)>1
and <i>y</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)>1
and <i>y</i>
is <span class="symbol">−∞</span>,
the result is +0.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)==1
and <i>y</i>
is +<span class="symbol">∞</span>,
the result is NaN.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)==1
and <i>y</i>
is <span class="symbol">−∞</span>,
the result is NaN.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)<1
and <i>y</i>
is +<span class="symbol">∞</span>,
the result is +0.</p>
</li>
<li><p>
If
<a href="x5.html#abs">abs</a>(<i>x</i>)<1
and <i>y</i>
is <span class="symbol">−∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>
and <i>y</i>>0,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>
and <i>y</i><0,
the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>
and <i>y</i>>0
and <i>y</i>
is an odd integer, the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>
and <i>y</i>>0
and <i>y</i>
is not an odd integer, the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>
and <i>y</i><0
and <i>y</i>
is an odd integer, the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>
and <i>y</i><0
and <i>y</i>
is not an odd integer, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is +0 and <i>y</i>>0,
the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is +0 and <i>y</i><0,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0
and <i>y</i>>0
and <i>y</i>
is an odd integer, the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0
and <i>y</i>>0
and <i>y</i>
is not an odd integer, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0
and <i>y</i><0
and <i>y</i>
is an odd integer, the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0
and <i>y</i><0
and <i>y</i>
is not an odd integer, the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i><0
and <i>x</i>
is finite and <i>y</i>
is finite and <i>y</i>
is not an integer, the result is NaN.</p>
</li></ul><h5 id="x15.8.2.14">15.8.2.14 random ( ) <a href="#x15.8.2.14">#</a> <a href="#x15.8.2.14-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
a Number value with positive sign, greater than or equal to 0 but
less than 1, chosen randomly or pseudo randomly with approximately
uniform distribution over that range, using an
implementation-dependent algorithm or strategy. This function takes
no arguments.</p>
<h5 id="x15.8.2.15">15.8.2.15 round (x) <a href="#x15.8.2.15">#</a> <a href="#x15.8.2.15-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
the Number value that is closest to <i>x</i>
and is equal to a mathematical integer. If two integer Number values
are equally close to <i>x</i>,
then the result is the Number value that is closer to +<span class="symbol">∞</span>.
If <i>x</i> is already an
integer, the result is <i>x</i>.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−∞</span>,
the result is <span class="symbol">−∞</span>.</p>
</li>
<li><p>
If
<i>x</i>
is greater than 0 but less than 0.5, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is less than 0 but greater than or equal to -0.5, the result is <span class="symbol">−</span>0.</p>
</li></ul><p class="sp"><b class="note">NOTE 1</b> <code><b>Math.round(3.5)</b></code>
returns 4, but
<code><b>Math.round(–3.5)</b></code>
returns –3.</p>
<p class="sp"><b class="note">NOTE 2</b> The value of <code><b>Math.round(x)</b></code>
is the same as the value of <code><b>Math.floor(x+0.5)</b></code>,
except when <code><b>x</b></code> is
<span class="symbol">−</span>0<b>
</b>or is less than 0
but greater than or equal to -0.5;
for these cases <code><b>Math.round(x)</b></code>
returns <span class="symbol">−</span>0,
but <code><b>Math.floor(x+0.5)</b></code>
returns +0.</p>
<h5 id="x15.8.2.16">15.8.2.16 sin (x) <a href="#x15.8.2.16">#</a> <a href="#x15.8.2.16-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the sine of <i>x</i>.
The argument is expressed in radians.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>
or <span class="symbol">−∞</span>,
the result is NaN.</p>
</li></ul><h5 id="x15.8.2.17">15.8.2.17 sqrt (x) <a href="#x15.8.2.17">#</a> <a href="#x15.8.2.17-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the square root of <i>x</i>.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is less than 0, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,
the result is <span class="symbol">−</span>0.</p>
</li>
<li><p>
If
<i>x</i>
is +<span class="symbol">∞</span>,
the result is +<span class="symbol">∞</span>.</p>
</li></ul><h5 id="x15.8.2.18">15.8.2.18 tan (x) <a href="#x15.8.2.18">#</a> <a href="#x15.8.2.18-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
Returns
an implementation-dependent approximation to the tangent of <i>x</i>.
The argument is expressed in radians.</p>
<ul><li><p>
If
<i>x</i>
is NaN, the result is NaN.</p>
</li>
<li><p>
If
<i>x</i>
is +0, the result is +0.</p>
</li>
<li><p>
If
<i>x</i>
is <span class="symbol">−</span>0,