4.3.2.5. Numeric functions
The following functions support number operations.
- decimal( n, scale )
Returns a number with the specified scale.
Expand 表4.50 Parameters Parameter Type nnumberscalenumberin the range[−6111..6176]Examples
decimal( 1/3, 2 ) = .33 decimal( 1.5, 0 ) = 2 decimal( 2.5, 0 ) = 2- floor( n )
Returns the greatest integer that is less than or equal to the specified number.
Expand 表4.51 Parameters Parameter Type nnumberExamples
floor( 1.5 ) = 1 floor( -1.5 ) = -2- ceiling( n )
Returns the smallest integer that is greater than or equal to the specified number.
Expand 表4.52 Parameters Parameter Type nnumberExamples
ceiling( 1.5 ) = 2 ceiling( -1.5 ) = -1- abs( n )
Returns the absolute value.
Expand 表4.53 Parameters Parameter Type nnumber,days and time duration, oryears and months durationExamples
abs( 10 ) = 10 abs( -10 ) = 10 abs( @"PT5H" ) = @"PT5H" abs( @"-PT5H" ) = @"PT5H"- modulo( dividend, divisor )
Returns the remainder of the division of the dividend by the divisor. If either the dividend or divisor is negative, the result is of the same sign as the divisor.
注記This function is also expressed as
modulo(dividend, divisor) = dividend - divisor*floor(dividen d/divisor).Expand 表4.54 Parameters Parameter Type dividendnumberdivisornumberExamples
modulo( 12, 5 ) = 2 modulo( -12,5 )= 3 modulo( 12,-5 )= -3 modulo( -12,-5 )= -2 modulo( 10.1, 4.5 )= 1.1 modulo( -10.1, 4.5 )= 3.4 modulo( 10.1, -4.5 )= -3.4 modulo( -10.1, -4.5 )= -1.1- sqrt( number )
Returns the square root of the specified number.
Expand 表4.55 Parameters Parameter Type nnumberExample
sqrt( 16 ) = 4- log( number )
Returns the logarithm of the specified number.
Expand 表4.56 Parameters Parameter Type nnumberExample
decimal( log( 10 ), 2 ) = 2.30- exp( number )
Returns Euler’s number
eraised to the power of the specified number.Expand 表4.57 Parameters Parameter Type nnumberExample
decimal( exp( 5 ), 2 ) = 148.41- odd( number )
Returns
trueif the specified number is odd.Expand 表4.58 Parameters Parameter Type nnumberExamples
odd( 5 ) = true odd( 2 ) = false- even( number )
Returns
trueif the specified number is even.Expand 表4.59 Parameters Parameter Type nnumberExamples
even( 5 ) = false even ( 2 ) = true