Built-in Functions

37 阅读1分钟

Math

NameDescription
Abs(​Decimal)Returns the absolute value (unsigned magnitude) of the decimal number 'n'.
Mod(​Decimal, Decimal)Returns the remainder of decimal division of 'n' by 'm'.
Power(​Decimal, Decimal)Returns 'n' raised to the power of 'm'.
Round(​Decimal, Integer)Returns the Decimal number 'n' rounded to a specific number of 'fractional digits'. The round method applied depends on where the function is used: - In expressions in client-side and server-side logic, applies the method round half to even (rounds to the nearest integer, 0.5 rounds to the nearest even integer). - In aggregates that query SQL Server or Oracle databases, applies the method round half away from 0 (rounds to the nearest integer, 0.5 rounds the number further away from 0). - In aggregates that query iDB2 databases, applies the method round half up (rounds to the nearest integer, 0.5 rounds up).
Sqrt(​Decimal)Returns the square root of the Decimal number 'n'.
Trunc(​Decimal)Returns the Decimal number 'n' truncated to integer removing the decimal part of 'n'.

Abs

绝对值

Abs(-10.89) = 10.89

Mod

整除余数

Mod(10, 3) = 1
Mod(4, 3.5) = 0.5

Power

Power(N, M)返回N的M次方

Power(100, 2) = 10000
Power(-10.89, 2.3) = 0
Power(-10.89, -5) = -6.52920946044017E-06

Round

四舍五入

When used in expressions in client-side and server-side logic:
Round(-10.89) = -11
Round(-5.5) = -6
Round(9.3) = 9
Round(2.5) = 2
Round(3.5) = 4
Round(9.123456789, 5) = 9.12346

When used in aggregates that query SQL Server or Oracle database:
Round(-10.89) = -11
Round(-5.5) = -6
Round(9.3) = 9
Round(2.5) = 3
Round(3.5) = 4

When used in aggregates that query iDB2 database:
Round(-10.89) = -11
Round(-5.5) = -5
Round(9.3) = 9
Round(2.5) = 3
Round(3.5) = 4

Sqrt

返回十进制数字“n”的平方根

Sqrt(2.3) = 1.51657508881031

Trunc

返回十进制数字'n',该数字被截断为整数,删除'n'的小数部分

Trunc(-10.89) = -10
Trunc(7.51) = 7