Mathematical functions

Read(587) Label: mathematical function,

This section introduces mathematical functions used for report making by listing their descriptions, syntax, parameters, return values and options, and giving related examples.

abs()

Description:

Compute absolute value of the specified data.

Syntax:

abs(numberExp)

Parameter:

numberExp

Data for which you want to compute the absolute value

Return value:

Numeric type

Example:

Example 1: abs(-3245.54)  Return 3245.54

Example 2: abs(-987)  Return 987

acos()

Description:

Compute arc cosine value of the specified data, which is a real number in the range of -1~1.

Related functions:

asin()  Compute arc sine value of the specified data.

atan()  Compute arc tangent value of the specified data.

Syntax:

acos(number)

Parameter:

number

The real number for which you want to compute the arc cosine

Return value:

Arc cosine value

Example:

Example 1: acos(-1)  Return 3.141592653589793

Example 2: acos(cos(pi()/2))  Return 1.5707963267948966

Example 3: acos(cos(0))  Return 0.0

asin()

Description:

Compute arc sine value of the specified data, which is a real number in the range of -1~1.

Related functions:

acos()  Compute arc cosine value of the specified data.

atan()  Compute arc tangent value of the specified data.

Syntax:

asin(number)

Parameter:

number

The real number for which you want to compute the arc sine value

Return value:

Arc sine value

Example:

Example 1: asin(-1)  Return -1.5707963267948966

Example 2: asin(sin(pi()/2))  Return 1.5707963267948966

Example 3: asin(sin(0))  Return 0.0

atan()

Description:

Compute arc tangent value of the specified data, which is a real number.

Related functions:

asin()  Compute arc sine value of the specified data.

acos()  Compute arc cosine value of the specified data.

Syntax:

atan(number)

Parameter:

number

The real number for which you want to compute the arc tangent

Return value:

Arc tangent value

Example:

Example 1: atan(1)  Return 0.7853981633974483

Example 2: atan(tan(pi()/2))  Return 1.5707963267948966

Example 3: atan(tan(0))  Return 0.0

ceil()

Description:

Truncate data at the specified position and carry the remaining part if any.

Related functions:

floor: Truncate data at the specified position and reject all the remaining part if any.

round: Truncate data at the specified position and round off the remaining part.

Syntax:

ceil(numberExp, {nExp})

Parameter:

numberExp

Data to be truncated

nExp

An integer specifying the truncate position; taken as 0 when it is omitted

>0: Move the decimal point to the right for nExp places

<0: Move the decimal point to the left for nExp places

=0: Indicate the current decimal place

Return value:

Numeric type

Example:

Example 1: ceil(3450001.004,0)  Return 3450002.0

Example 2: ceil(3450001.004,-1)  Return 3450010.0

Example 3: ceil(3450001.004,-2)  Return 3450100.0

Example 4: ceil(3450001.004,1)  Return 3450001.1

Example 5: ceil(3450001.004,2)  Return 3450001.01

cos()

Description:

Compute cosine value of the specified data measured in radians.

Related functions:

sin()  Compute sine value of the specified data.

tan()  Compute tangent value of the specified data.

Syntax:

cos(numberExp)

Parameter:

numberExp

The radian of the cosine to be computed

Return value:

Float type

Example:

Example 1: cos(pi())  Return -1

Example 2: cos(pi(2))  Return 1

exp()

Description:

Compute e to the nExpth power.

Syntax:

exp(nExp)

Parameter:

nExp

The exponent

Return value:

Numeric type

Example:

Example 1: exp(4.3)  Return 73.69979369959579

fact()

Description:

Compute factorial of the specified data

Syntax:

fact(nExp)

Parameter:

nExp

Data for which you want to compute the factorial

Return value:

Long integer (64 bit)

Example:

Example 1: fact(10)  Return 3628800

floor()

Description:

Truncate data at the specified position and reject all the remaining part if any.

Related functions:

ceil: Truncate data at the specified position and carry the remaining part if any.

round: Truncate data at the specified position and round off the remaining part.

Syntax:

floor(numberExp, {nExp})

Parameter:

numberExp

Data to be truncated

nExp

An integer specifying the position from which data is to be truncated

>0: Move the decimal point to the right for nExp places

<0: Move the decimal point to the left for nExp places

=0: Indicate the current decimal place

Return value:

Numeric type

Example:

Example 1: floor(3451231.234,0)  Return 3451231.0

Example 2: floor(3451231.234,-1)  Return 3451230.0

Example 3: floor(3451231.234,-2)  Return 3451200.0

Example 4: floor(3451231.234,1)  Return 3451231.2

Example 5: floor(3451231.234,2)  Return 3451231.23

ln()

Description:

Compute the natural logarithm of the specified data.

Syntax:

ln(numberExp)

Parameter:

numberExp

Data for which you want to compute the natural logarithm

Return value:

Numeric type

Example:

Example 1: ln(54)  Return 3.9889840465642745

lg()

Description:

Compute the logarithm to base 10.

Syntax:

lg (numberExp)

Parameter:

numberExp

Data for which you want to compute the logarithm to base 10

Return value:

Numeric type

Example:

Example 1: lg(54)  Return 1.7323937598229684

pi()

Description:

Compute the circumference-to-diameter ratio or its multiple.

Syntax:

pi(numberExp)

Parameter:

numberExp

The multiple; the function returns circumference ratio when the parameter is absent

Return value:

Circumference ratio or its multiple

Example:

Example 1: pi()  Return 3.141592653589793

Example 2: pi(2)  Return 6.283185307179586

power()

Description:

Compute number xExp raised to the nExpth power, or takes an nExpth root of xExp; use reciprocal (1/nExp), to find the root.

Syntax:

power(xExp, nExp)

Parameter:

xExp

Base

nExp

Power, whose default is 2; find the root when it is the reciprocal

Return value:

Numeric type

Example:

Example 1: power(2,4)  Return 16.0

Example 2: power(16,1/4)  Return 2.0

Example 3: power(5)   Return 25

rand()

Description:

Get a random number.

Syntax:

rand(n)

Parameter:

n

An integer; without it the function returns a random float number between 0 and 1.0

Return value:

Numeric type

Option:

@s

Set the seed value for generating a random number

Example:

Example 1: rand()  Get a random number in the range of [0, 1.0)

Example 2: rand()*100  Get a random float number in the range of [0, 100)

Example 3: int(rand()*100)  Get a random integer in the range of [0, 100)

Example 4: The seed value for generating a random number

 

A

 

1

=to(1,5)

Horizontal expansion

2

=rand@s(5)

 

3

=rand()

 

4

=rand@s(5)

 

5

=rand()

The 5 random numbers generated in A5 and A3 are identical

rgb()

Description:

Convert the red, green, blue, and transparency values respectively to the corresponding color value.

Syntax:

rgb( redIntExp, greenIntExp, blueIntExp{, alphaIntExp} )

Parameter:

redIntExp

The integer expression indicating the red, whose value is between 0-255

greenIntExp

The integer expression indicating the green, whose value is between 0-255

blueIntExp

The integer expression indicating the blue, whose value is between 0-255

alphaIntExp

The integer expression indicating the transparency, whose value is between 0-255; 0 represents total transparency and 255 indicates total opaqueness; the other values represent various levels of transparency respectively; Default value is 255

Return value:

A 64-bit long integer

Example:

Example 1: rgb(123,123,123)  Return -8684677

Example 2: rgb(123,123,123,123)  Return 2071690107

Example 3: rgb(123,123,123,255)  Return -8684677

Example 4: rgb(123,123,123,0)  Return 8092539

round()

Description:

Truncate data at the specified position and round off the remaining part.

Related functions:

ceil: Truncate data at the specified position and carry the remaining part if any.

floor: Truncate data at the specified position and reject all the remaining part if any.

Syntax:

round(numberExp, {nExp})

Parameter:

numberExp

Data to be truncated

nExp

An integer specifying the position at which data is truncated

>0: Truncate data at nExp decimal place(s) to the right of the decimal point

<0: Truncate data at nExp decimal place(s) to the left of the decimal point

=0: Truncate data at the current decimal place

Return value:

Numeric type

Example:

Example 1: round(3451251.274,0)  Return 3451251.0

Example 2: round(3451251.274,-1)  Return 3451250.0

Example 3: round(3451251.274,-2)  Return 3451300.0

Example 4: round(3451251.274,1)  Return 3451251.3

Example 5: round(3451251.274,2)  Return 3451251.27

sign()

Description:

Judge whether the specified data is a positive number, a negative number or 0; return 1 for a positive number, -1 for a negative number or 0 for 0.

Syntax:

sign(number)

Parameter:

number

Data for which you want to judge whether it is positive or negative

Return value:

Integer type

Example:

Example 1: sign(-10)  Return -1

Example 2: sign(30)  Return 1

Example 3: sign(0)  Return 0

sin()

Description:

Compute the sine value of the specified data measured in radians.

Related functions:

cos()  Compute the cosine value of the specified data.

tan()  Compute the tangent value of the specified data.

Syntax:

sin(number)

Parameter:

number

The radian for which you want to compute the sine value

Return value:

Float type

Example:

Example 1: sin(pi())  Return 1.2246467991473532E-16

Example 2: sin(pi(2))  Return -2.4492935982947064E-16

Example 3: sin(pi()/2)  Return 1.0

sqrt()

Description:

Find the square root of a number through number1/nExp. When nExp is omitted, the function gets the square root of the number through √number.

Syntax:

sqrt(number,nExp)

Parameter:

number

Data for which you want to find the square root

nExp

The power

Return value:

Numeric type

Example:

Example 1: sqrt(100)  Return 10.0

Example 2: sqrt(99)  Return 9.9498743710662

Example 3: sqrt(16,4)  Return 2.0

tan()

Description:

Compute the tangent value of the specified data measured in radians.

Related functions

sin()  Compute the sine value of the specified data.

cos()  Compute the cosine value of the specified data.

Syntax:

tan(number)

Parameter:

number

The radian for which you want to compute the tangent value

Return value:

Float type

Example:

Example 1: tan(pi()/2)  Return 1.633123935319537E16

Example 2: tan(pi(2))  Return -2.4492935982947064E-16