DML functions: Mathematics

abs

ceil / floor / round

integerPortion / decimalPortion

exponent

remainder

The following math functions are available:

abs

abs Comment

Description

abs returns the absolute value of an Integer or a Real number. The returned value is always positive regardless of the input value.

Syntax

abs(number_expression)

Return

Returns the same data class as the data class of the parameter. This can be an Integer or a Real number.

Parameter

number_expression
Enter an expression that returns an I>nteger or a
Real number.

Examples

abs(-345) returns the Integer 345.

abs(-345.567) returns the Real number 345.567.

ceil

ceil Comment

Description

ceil rounds Real numbers to Integers by rounding up.

Syntax

ceil(real_number_expression)

Return

Integer

Parameters

real_number_expression
Enter an expression that returns a Real number.

Examples

ceil(2.8) returns 3.

ceil(-2.8) returns -2.

floor

floor Comment

Description

floor rounds Real numbers to Integers by rounding down.

Syntax

floor(real_number_expression)

Return

Integer

Parameters

real_number_expression
Enter an expression that returns a Real number.

Examples

floor(2.8) returns 2.

floor(-2.8) returns -3.

integerPortion

integerPortion Comment

Description

integerPortion truncates the fractional portion of a Real number.

Syntax

integerPortion(real_number_expression)

Return

Integer

Parameters

real_number_expression
Enter an expression that returns a Real number.

Examples

integerPortion(2.8) returns 2.

integerPortion(-2.8) returns -2.

decimalPortion

decimalPortion Comment

Description

decimalPortion returns the decimal portion of a Real number.

Syntax

decimalPortion(real_number_expression)

Return

Real number

Parameters

real_number_expression
Enter an
expression that returns a Real number.

Examples

decimalPortion(2.8) returns 0.8.

decimalPortion(-2.8) returns -0.8.

exponent

exponent Comment

Description

exponent raises a Real number or an Integer to a power.

Syntax

exponent(number_expression, exponent)

Return

Real number, when exponent raises a real number

Integer, when exponent raises an integer

Parameters

number_expression
Enter an expression that returns a Real number or an Integer.

exponent
Enter an Integer that indicates the power of the exponent.

Example

exponent(5,2) returns 25.

round

round Comment

Description

round rounds Real numbers to the number of decimal places that you specify.

Syntax

round(real_number_expression, decimal_places)

Return

Real number

Parameters

real_number_expression
Enter an expression that returns a Real number.

decimal_places
Enter an Integer that indicates the number of decimal places for the return value.

Examples

round( 354.8526, 2 ) returns 354.85.

round(354.8587, 3) returns 354.859.

remainder

remainder Comment

Description

remainder returns the remainder of an Integer or Real division.

Syntax

remainder(dividend, divisor)

Return

Integer or Real

Parameters

dividend
Enter an expression that returns:

  • An Integer
  • A Real number

divisor
Enter an expression that returns an Integer. If divisor is:

  • Negative, remainder returns a negative Integer or Real.
  • Positive, remainder returns a positive Integer or Real.

Real number examples

remainder(5.0,3) returns 2.0.

remainder(5.0,-3) returns -1.0.

remainder(-5.0,3) returns +1.0.

remainder(-5.0,-3) returns -2.0.

Integer examples

remainder(5,3) returns 2.

remainder(5,-3) returns -1.

remainder(-5,3) returns +1.

remainder(-5,-3) returns -2.

 

Related Links