vexi.math - Math Library Object

The standard JS Math object, accessible as vexi.math, with the addition of methods ‘isNaN’ and ‘isFinite’, and Number objects ‘NaN’ and ‘Infinity’.

Properties

Property Type Description

E

Number

The constant ‘e’

LN10

Number

The result of ln(10)

LN2

Number

The result of ln(2)

LOG10E

Number

The result of log10(e)

LOG2E

Number

The result of log2(e)

PI

Number

The constant ‘pi’

SQRT1_2

Number

The result of 1 / sqrt(2)

SQRT2

Number

The result of sqrt(2)

NaN

Number

The Number object that represents a non-representable number e.g. 1/0

Infinity

Number

The Number that represents a infinity

Methods

Method Returns Description

abs(num)

Number

Returns the absolute value of ‘num’

acos(num)

Number

Returns the arc cosine of ‘num’ in radians

asin(num)

Number

Returns the arc sine of ‘num’ in radians

atan(num)

Number

Returns the arc tangent of ‘num’ in radians

atan2(x, y)

Number

Converts the rectangular coordinates ‘x, y’ into polar coordinates and returns the angle portion of the polar coordinates

ceil(num)

Number

Returns the smallest integer that is larger than ‘num’

cos(num)

Number

Returns the cosine of num where ‘num’ is in radians

exp(num)

Number

Returns e^num (‘e’ raised to the power ‘num’)

floor(num)

Number

Returns the largest integer that is smaller than lsquo;num’

isFinite(num)

Boolean

Returns true if ‘num’ represents a finite number i.e. is not the vexi.math.Infinity object

isNaN(num)

Boolean

Returns true if ‘num’ is not a number i.e. equals the vexi.math.NaN object

log(num)

Number

Returns the natural logarithm of ‘num’ i.e. ln(num)

max(n1, n2)

Number

Returns the greater of ‘n1’ and ‘n2’

min(n1, n2)

Number

Returns the lesser of ‘n1’ and ‘n2’

pow(num)

Number

Returns num^p (‘num’ raised to the power ‘p’)

random(num)

Number

Returns a random floating-point number between 0 and 1

round(num)

Number

Returns the closest integer to ‘num’

sin(num)

Number

Returns the sine of num where ‘num’ is in radians

sqrt(num)

Number

Returns the square root of ‘num’

tan(num)

Number

Returns the tangent of num where ‘num’ is in radians

 


Copyright © 2011 The Vexi Project (vexi.sourceforge.net)