Class JSMath
- java.lang.Object
-
- org.fife.rsta.ac.js.ecma.api.ecma3.JSMath
-
public abstract class JSMath extends java.lang.ObjectObject Math- Since:
- Standard ECMA-262 3rd. Edition
-
-
Field Summary
Fields Modifier and Type Field Description static JSNumberEproperty E the constant e, the base of the natural logarithm.static JSNumberLN10property LN10 the natural logarithm of 10.static JSNumberLN2property LN2 the natural logarithm of 2.static JSNumberLOG10Eproperty LOG10E the base-10 logarithm of e.static JSNumberLOG2Eproperty LOG2E the base-2 logarithm of e.static JSNumberPIproperty PI The constant PI.static JSNumberSQRT1_2property SQRT1_2 the number 1 divided by the square root of 2.static JSNumberSQRT2property SQRT2 the square root of 2.
-
Constructor Summary
Constructors Constructor Description JSMath()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JSNumberabs(JSNumber x)function abs(x) computes an absolute value.static JSNumberacos(JSNumber x)function acos(x) compute an arccosinestatic JSNumberasin(JSNumber x)function asin(x) compute an arcsinestatic JSNumberatan(JSNumber x)function atan(x) compute an arctangentstatic JSNumberatan2(JSNumber y, JSNumber x)function atan2(x,y) compute the angle from the X axis to a point.static JSNumberceil(JSNumber x)function ceil(x) round a number up.static JSNumbercos(JSNumber x)function cos(x) compute a cosine.static JSNumberexp(JSNumber x)function exp(x) compute Ex.static JSNumberfloor(JSNumber x)function floor(x) round a number down.static JSNumberlog(JSNumber x)function log(x) compute a natural logarithm.static JSNumbermax(JSNumber args)function max(args) Return the largest argument.static JSNumbermin(JSNumber args)function min(args) return the smallest argument.static JSNumberpow(JSNumber x, JSNumber y)function pow(x,y) compute Xystatic JSNumberrandom()function random() return a pseudorandom numberstatic JSNumberround(JSNumber x)function round(x) round to the nearest integer.static JSNumbersin(JSNumber x)function sin(x) compute a sine.static JSNumbersqrt(JSNumber x)function sqrt(x) compute a square root.static JSNumbertan(JSNumber x)function tan(x) compute a tangent.
-
-
-
Field Detail
-
E
public static JSNumber 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:
Number
-
LN10
public static JSNumber LN10
property LN10 the natural logarithm of 10.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
LN2
public static JSNumber LN2
property LN2 the natural logarithm of 2.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
LOG2E
public static JSNumber LOG2E
property LOG2E the base-2 logarithm of e.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
LOG10E
public static JSNumber LOG10E
property LOG10E the base-10 logarithm of e.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
PI
public static JSNumber PI
property PI The constant PI.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
SQRT1_2
public static JSNumber 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:
Number
-
-
Method Detail
-
abs
public static JSNumber abs(JSNumber x)
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:
Number
-
acos
public static JSNumber acos(JSNumber x)
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:
Number
-
asin
public static JSNumber asin(JSNumber x)
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:
Number
-
atan
public static JSNumber atan(JSNumber x)
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:
Number
-
atan2
public static JSNumber atan2(JSNumber y, JSNumber x)
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:
Number
-
ceil
public static JSNumber ceil(JSNumber x)
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:
Number
-
cos
public static JSNumber cos(JSNumber x)
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:
Number
-
exp
public static JSNumber exp(JSNumber x)
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:
Number
-
floor
public static JSNumber floor(JSNumber x)
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:
Number
-
log
public static JSNumber log(JSNumber x)
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:
Number
-
max
public static JSNumber max(JSNumber args)
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:
Number
-
min
public static JSNumber min(JSNumber args)
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:
Number
-
pow
public static JSNumber pow(JSNumber x, JSNumber y)
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:
Number
-
random
public static JSNumber random()
function random() return a pseudorandom number- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
Number
-
round
public static JSNumber round(JSNumber x)
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:
Number
-
sin
public static JSNumber sin(JSNumber x)
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:
Number
-
sqrt
public static JSNumber sqrt(JSNumber x)
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:
Number
-
-