Siebel Product Administration Guide > Siebel Configurator Rule Assembly Language > About Operators in Rule Assembly Language >

Arithmetic Operators in Rule Assembly Language


Arithmetic operators expect numeric operands and produce a numeric result. They are most frequently used in sub-expressions. The following top-level expression means that the quantity of item C in the solution must be the same as the sum of the quantities of items A and B.

==(+([A],[B]),[C])

Assuming no other constraints on item A, B, or C; if you add A or B to the solution, then C will be added as well to match the sum. If you add a large number of C's, the Siebel Configurator engine will add A and B in arbitrary quantities so that their sum equals the amount of C.

When used in sub-expressions, these operators should return a numeric result. If a sub-expression returns a logical result, true is interpreted as a 1, and false is interpreted as a 0. In the example above, if B is an expression that returns the logical result true, then the expression is equivalent to the following:

==(+([A],1),[C])

Arithmetic operators are shown in Table 32.

Table 32. Arithmetic Operators
Operator
Syntax   
Properties

Addition

+(A, B)

Sum of A and B. A and B can be items or sub-expressions. Result is floating point if A or B is floating point.

Subtraction

-(A, B)

Subtracts B from A. A and B can be items or sub-expressions. Result is floating point if A or B is floating point.

Negation

-(A)

Additive inverse of A. Uses only one operand. A can be an item or expression.

Multiplication

*(A, B)

Product of A and B. Result is floating point if A or B is floating point. A and B can be items or sub-expressions.

Division

/(A, B)

Quotient of A divided by B. Truncates ratio to integer if both A and B are integers. Result is floating point if A or B is floating point. A and B can be items or sub-expressions.

Modulo

%(A, B)

Remainder of A divided by B. For example, %(1900, 72) results in 28. If A or B is floating point, the value is first rounded to the nearest integer; then the remainder is computed as for integers. A and B can be items or sub-expressions.

Minimum

min(A, B)

Result is the smaller of A and B and is floating point if A or B is floating point. A and B can be items or sub-expressions.

Maximum

max(A, B)

Result is the larger of A and B and is floating point if A or B is floating point. A and B can be items or sub-expressions.

The following operators, shown in Table 33, also take numeric arguments and produce numeric results. Use them to control numeric accuracy or change numeric characteristics.

Table 33. Additional Arithmetic Operators
Operator
Syntax
Properties

Quantity

qty(A)

Result is the quantity of A rounded to nearest integer. For example, if A is 6.7, returns 7. If A is 6.3, returns 6. A can be an item or sub-expression. Useful only with resources.

Integer

int(A)

Truncates A down to an integer. For example, if operand is 6.7, returns 6. A can be an item or sub-expression.

Float

flo(A)

Converts A to floating point. Same as multiplying operand by 1.0. A can be a sub-expression. Not useful with resources.

Absolute value

abs(A)

Returns the absolute value of A. A can be an item or sub-expression.

Sign test

sgn(A)

Returns -1 if the quantity of A <0, 0 if A=0, 1 if A>0. A can be a sub-expression.

Siebel Product Administration Guide Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices.