Skip to main content



Math

OperatorCompatible typesDescription
+Integer, Decimal, TextFor numerics, adds the lhs and rhs values and returns the result. For text values, concatenates lhs with rhs and returns the result: var x = 45 + 3.3; var y = 'hello' + ' world';
-Integer, DecimalSubtracts rhs from lhs and returns the result: var x = 4.04 - 3;
*Integer, DecimalMultiplies lhs and rhs and returns the result: var x = 34 * 0.993;
/Integer, DecimalDivides lhs by rhs and returns the result: var x = 33 / 9.9; Note that like C#, irScript uses integer division; this means that division of two integers always results in an integer return value. However, unlike C#, irScript supports division of integers by non-integers, and vice versa; in these cases,normal irScript type conversion rules apply (see below).
%Integer, DecimalDivides lhs by rhs and returns the remainder: var x = 100 / 5.3;

Note that irScript performs data type conversions during math operations, for integral numeric types. Note also that any floating-point representations later accessible outside irScript (in the InRule rule engine proper) are converted to System.Decimal.

LHS typeRHS typeResult type
Int64Int16, Int32, Int64, UInt16, UInt32 Int64 UInt64, Single, Double, Decimal <RHS type> Null Null
Int32Int16, UInt16, Int32 Int32 Int64, UInt32, UInt64, Single, Double, Decimal <RHS type> Null Null
Int16Int16 Int16 Int32, Int64, UInt16, UInt32, UInt64, Single, Double, Decimal <RHS type> Null Null
UInt64Int16, Int32, Int64, UInt16, UInt32, UInt64 UInt64 Single, Double, Decimal <RHS type> Null Null
UInt32Int16, UInt16, Int32, UInt32 UInt32 Int64, UInt64, Single, Double, Decimal <RHS type> Null Null
UInt16Int16, UInt16 UInt16 Int32, Int64, UInt32, UInt64, Single, Double, Decimal <RHS type> Null Null
DecimalInt16, Int32, Int64, UInt16, UInt32, UInt64, Decimal, Single, Double Decimal Null Null
SingleInt16, Int32, Int64, UInt16, UInt32, UInt64, Single Single Double, Decimal <RHS type> Null Null
DoubleInt16, Int32, Int64, UInt16, UInt32, UInt64, Double, Single Double Decimal <RHS type> Null Null