public abstract class JSMath
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static JSNumber |
E
property E the constant e, the base of the natural logarithm.
|
static JSNumber |
LN10
property LN10 the natural logarithm of 10.
|
static JSNumber |
LN2
property LN2 the natural logarithm of 2.
|
static JSNumber |
LOG10E
property LOG10E the base-10 logarithm of e.
|
static JSNumber |
LOG2E
property LOG2E the base-2 logarithm of e.
|
static JSNumber |
PI
property PI The constant PI.
|
static JSNumber |
SQRT1_2
property SQRT1_2 the number 1 divided by the square root of 2.
|
static JSNumber |
SQRT2
property SQRT2 the square root of 2.
|
| Constructor and Description |
|---|
JSMath() |
| Modifier and Type | Method and Description |
|---|---|
static JSNumber |
abs(JSNumber x)
function abs(x) computes an absolute value.
|
static JSNumber |
acos(JSNumber x)
function acos(x) compute an arccosine
|
static JSNumber |
asin(JSNumber x)
function asin(x) compute an arcsine
|
static JSNumber |
atan(JSNumber x)
function atan(x) compute an arctangent
|
static JSNumber |
atan2(JSNumber y,
JSNumber x)
function atan2(x,y) compute the angle from the X axis to a point.
|
static JSNumber |
ceil(JSNumber x)
function ceil(x) round a number up.
|
static JSNumber |
cos(JSNumber x)
function cos(x) compute a cosine.
|
static JSNumber |
exp(JSNumber x)
function exp(x) compute Ex.
|
static JSNumber |
floor(JSNumber x)
function floor(x) round a number down.
|
static JSNumber |
log(JSNumber x)
function log(x) compute a natural logarithm.
|
static JSNumber |
max(JSNumber args)
function max(args) Return the largest argument.
|
static JSNumber |
min(JSNumber args)
function min(args) return the smallest argument.
|
static JSNumber |
pow(JSNumber x,
JSNumber y)
function pow(x,y) compute Xy
|
static JSNumber |
random()
function random() return a pseudorandom number
|
static JSNumber |
round(JSNumber x)
function round(x) round to the nearest integer.
|
static JSNumber |
sin(JSNumber x)
function sin(x) compute a sine.
|
static JSNumber |
sqrt(JSNumber x)
function sqrt(x) compute a square root.
|
static JSNumber |
tan(JSNumber x)
function tan(x) compute a tangent.
|
public static JSNumber E
Numberpublic static JSNumber LN10
Numberpublic static JSNumber LN2
Numberpublic static JSNumber LOG2E
Numberpublic static JSNumber LOG10E
Numberpublic static JSNumber PI
Numberpublic static JSNumber SQRT1_2
Numberpublic static JSNumber abs(JSNumber x)
x - any numberNumberpublic static JSNumber acos(JSNumber x)
x - a number between -1.0 and 1.0Numberpublic static JSNumber asin(JSNumber x)
x - a number between -1.0 and 1.0Numberpublic static JSNumber atan(JSNumber x)
x - Any numberNumberpublic static JSNumber atan2(JSNumber y, JSNumber x)
y - The Y coordinate of the pointx - The X coordinate of the pointNumberpublic static JSNumber ceil(JSNumber x)
Example
a = Math.ceil(1.99); //returns 2.0 b = Math.ceil(1.01); //returns 2.0 c = Math.ceil(1.0) //returns 1.0 d = Math.ceil(-1.99); //returns -1.0
x - any number or numeric value.Numberpublic static JSNumber cos(JSNumber x)
x - an angle, measured in radians.Numberpublic static JSNumber exp(JSNumber x)
x - a numeric value or expression.Numberpublic static JSNumber floor(JSNumber x)
Example
a = Math.floor(1.99); //returns 1.0 b = Math.floor(1.01); //returns 1.0 c = Math.floor(1.0) //returns 1.0 d = Math.floor(-1.99); //returns -2.0
x - any number or numeric value.Numberpublic static JSNumber log(JSNumber x)
x - any number or numeric value greater than 0.Numberpublic static JSNumber max(JSNumber args)
args - Zero or more valuesNumberpublic static JSNumber min(JSNumber args)
args - Any number of argumentsNumberpublic static JSNumber pow(JSNumber x, JSNumber y)
x - The number to be raised to a power.y - The power that x to be raised to.Numberpublic static JSNumber random()
Numberpublic static JSNumber round(JSNumber x)
x - Any number.Numberpublic static JSNumber sin(JSNumber x)
x - An angle, in radians.Numberpublic static JSNumber sqrt(JSNumber x)
x - a numeric value greater than or equal to zero.Number