Math Functions

Desigo CC Scripts feature supports the following basic and advanced math and trigonometric functions.

Math Object

The Math object is a single object that has some named properties, some of which are functions.

This function is part of the standard built-in ECMAScript objects.

For more details, see http://www.ecma-international.org/ecma-262/5.1/#sec-15.8.

 

Internal Properties of the Math Object

[[Prototype]]

[[Class]]

Value Properties of the Math Object

E

LN10

LN2

LOG2E

LOG10E

PI

SQRT1_2

SQRT2

Function Properties of the Math Object

abs (x)

acos (x)

asin (x)

atan (x)

atan2 (y, x)

ceil (x)

cos (x)

exp (x)

floor (x)

log (x)

max ( [ value1 [ , value2 [ , … ] ] ] )

min ( [ value1 [ , value2 [ , … ] ] ] )

pow (x, y)

random ( )

round (x)

sin (x)

sqrt (x)

tan (x)

Math.average

In addition to the function properties of the ECMAScript Math object, the scripting feature also supports the Math.average function which allows calculating the arithmetic average of the parameters passed to the function.

Function Properties

average ( [ value1 [ , value2 [ , … ] ] ] )

Example of Use

 

var avg = Math.average(1, 17, 45, 0, 12, 4, 3, 1);

 

The method returns 10.375.