Der Math Object ist ein eingebauter Java Indexgegenstand, der Mathekonstanten und -funktionen einschlie�t. Du brauchst nicht, einen Math Object im Java Index zu verursachen; er besteht automatisch in jedem m�glichem Java Indexprogramm. Die Eigenschaften des Math Object's stellen mathematische Konstanten dar, und seine Methoden sind mathematische Funktionen.
Mathematische Werte
In JavaScript there are eight mathematical values (constants) that can be accessed from the Math object. These are: E, PI, square root of 2, square root of 1/2, natural log of 2, natural log of 10, base-2 log of E, and base-10 log of E.
Properties
Properties
Description
E
The constant of E, the base of natural logarithms.
LN2
The natural logarithm of 2.
LN10
The natural logarithm of 10.
LOG2E
Base 2 logarithm of E.
LOG10E
Base 10 logarithm of E.
PI
Returns PI.
SQRT1_2
Square root of 1/2.
SQRT2
Square root of 2.
Methods
Methods
Description
abs(x)
Returns absolute value of x.
acos(x)
Returns arc cosine of x in radians.
asin(x)
Returns arc sine of x in radians.
atan(x)
Returns arc tan of x in radians.
atan2(y, x)
Counterclockwise angle between x axis and point
(x,y).
ceil(x)
Returns the smallest integer greater than or
equal to x. (round up).
cos(x)
Returns cosine of x, where x is in radians.
exp(x)
Returns ex
floor(x)
Returns the largest
integer less than or equal to x. (round down)
log(x)
Returns the natural
logarithm (base E) of x.
max(a, b)
Returns the larger of a and b.
min(a, b)
Returns the lesser of a and b.
pow(x, y)
Returns Xy
random()
Returns a pseudorandom number between 0 and 1.
round(x)
Rounds x up or down to the nearest integer. It
rounds .5 up.