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
ParameterType

n

number

scale

number in 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
ParameterType

n

number

Examples

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
ParameterType

n

number

Examples

ceiling( 1.5 ) = 2
ceiling( -1.5 ) = -1

abs( n )

Returns the absolute value.

Expand
表4.53 Parameters
ParameterType

n

number, days and time duration, or years and months duration

Examples

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
ParameterType

dividend

number

divisor

number

Examples

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
ParameterType

n

number

Example

sqrt( 16 ) = 4

log( number )

Returns the logarithm of the specified number.

Expand
表4.56 Parameters
ParameterType

n

number

Example

decimal( log( 10 ), 2 ) = 2.30

exp( number )

Returns Euler’s number e raised to the power of the specified number.

Expand
表4.57 Parameters
ParameterType

n

number

Example

decimal( exp( 5 ), 2 ) = 148.41

odd( number )

Returns true if the specified number is odd.

Expand
表4.58 Parameters
ParameterType

n

number

Examples

odd( 5 ) = true
odd( 2 ) = false

even( number )

Returns true if the specified number is even.

Expand
表4.59 Parameters
ParameterType

n

number

Examples

even( 5 ) = false
even ( 2 ) = true

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る