In der Klasse Math sind die wichtigsten mathematischen
Funktionen und Konstanten definiert. Sie werden über ihren Klassennamen angesprochen,
also z.B. als Math.acos.
Funktionen:
|
|
|
Konstanten:
|
| Math.abs(x)
| Betrag
| Math.abs(-5) = 5
|
|
|
| Math.acos(x)
| Arcuscosinus
|
|
| Math.E
|
| Math.asin(x)
| Arcussinus
|
|
| Math.LN10
|
| Math.atan(x)
| Arcustangens
|
|
| Math.LN2
|
| Math.atan2(x, y)
|
|
|
| Math.LOG10E
|
| Math.ceil(x)
| Ceiling
| Math.ceil(5.123) = 6
|
| Math.LOG2E
|
| Math.cos(x)
| Cosinus
| Math.cos(Math.PI) = 1
|
| Math.SQRT2
|
| Math.exp(x)
| Exponentialfkt.
| Math.exp(1) = e
|
| Math.SQRT1_2
|
| Math.floor(x)
| Floor
| Math.floor(5.123) = 5
|
|
|
| Math.log(x)
| Logarithmus
| Math.log(0) = -Infinity
|
|
| Math.max(x, y)
| Maximum
| Math.max(4, 7) = 7
|
|
| Math.min(x, y)
| Minimum
| Math.min(4, 7) = 4
|
|
| Math.pow(x, y)
| Potenz
| Math.pow(2, 8) = 128
|
|
|
| Math.random
| Zufallszahl
|
|
|
|
| Math.round(x)
| Rundung
| Math.round(5.124) = 5
|
|
|
| Math.sin(x)
| Sinus
| Math.sin(Math.PI) = 1
|
|
|
| Math.sqrt(x)
| Quadratwurzel
| Math.sqrt(-4) = NaN
|
|
|
| Math.tan(x)
| Tangens
|
|
|
|