Class JSMath
java.lang.Object
org.fife.rsta.ac.js.ecma.api.ecma3.JSMath
Object Math
- Since:
- Standard ECMA-262 3rd. Edition
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic JSNumberproperty E the constant e, the base of the natural logarithm.static JSNumberproperty LN10 the natural logarithm of 10.static JSNumberproperty LN2 the natural logarithm of 2.static JSNumberproperty LOG10E the base-10 logarithm of e.static JSNumberproperty LOG2E the base-2 logarithm of e.static JSNumberproperty PI The constant PI.static JSNumberproperty SQRT1_2 the number 1 divided by the square root of 2.static JSNumberproperty SQRT2 the square root of 2. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JSNumberfunction abs(x) computes an absolute value.static JSNumberfunction acos(x) compute an arccosinestatic JSNumberfunction asin(x) compute an arcsinestatic JSNumberfunction atan(x) compute an arctangentstatic JSNumberfunction atan2(x,y) compute the angle from the X axis to a point.static JSNumberfunction ceil(x) round a number up.static JSNumberfunction cos(x) compute a cosine.static JSNumberfunction exp(x) compute Ex.static JSNumberfunction floor(x) round a number down.static JSNumberfunction log(x) compute a natural logarithm.static JSNumberfunction max(args) Return the largest argument.static JSNumberfunction min(args) return the smallest argument.static JSNumberfunction pow(x,y) compute Xystatic JSNumberrandom()function random() return a pseudorandom numberstatic JSNumberfunction round(x) round to the nearest integer.static JSNumberfunction sin(x) compute a sine.static JSNumberfunction sqrt(x) compute a square root.static JSNumberfunction tan(x) compute a tangent.
-
Field Details
-
E
property E the constant e, the base of the natural logarithm.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
LN10
property LN10 the natural logarithm of 10.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
LN2
property LN2 the natural logarithm of 2.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
LOG2E
property LOG2E the base-2 logarithm of e.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
LOG10E
property LOG10E the base-10 logarithm of e.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
PI
property PI The constant PI.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
SQRT1_2
property SQRT1_2 the number 1 divided by the square root of 2.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
SQRT2
property SQRT2 the square root of 2.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
-
Constructor Details
-
JSMath
public JSMath()
-
-
Method Details
-
abs
function abs(x) computes an absolute value.- Parameters:
x- any number- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
acos
function acos(x) compute an arccosine- Parameters:
x- a number between -1.0 and 1.0- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
asin
function asin(x) compute an arcsine- Parameters:
x- a number between -1.0 and 1.0- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
atan
function atan(x) compute an arctangent- Parameters:
x- Any number- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
atan2
function atan2(x,y) compute the angle from the X axis to a point.- Parameters:
y- The Y coordinate of the pointx- The X coordinate of the point- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
ceil
function ceil(x) round a number up.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
- Parameters:
x- any number or numeric value.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
cos
function cos(x) compute a cosine.- Parameters:
x- an angle, measured in radians.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
exp
function exp(x) compute Ex.- Parameters:
x- a numeric value or expression.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
floor
function floor(x) round a number down.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
- Parameters:
x- any number or numeric value.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
log
function log(x) compute a natural logarithm.- Parameters:
x- any number or numeric value greater than 0.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
max
function max(args) Return the largest argument.- Parameters:
args- Zero or more values- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
min
function min(args) return the smallest argument.- Parameters:
args- Any number of arguments- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
pow
function pow(x,y) compute Xy- Parameters:
x- The number to be raised to a power.y- The power that x to be raised to.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
random
function random() return a pseudorandom number- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
round
function round(x) round to the nearest integer.- Parameters:
x- Any number.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
sin
function sin(x) compute a sine.- Parameters:
x- An angle, in radians.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
sqrt
function sqrt(x) compute a square root.- Parameters:
x- a numeric value greater than or equal to zero.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
tan
function tan(x) compute a tangent.- Parameters:
x- An angle, in radians.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-