SWTDO Interactive Parametric System: Mathematical Expressions

Atomic operators: (, )
Unary operators: !, not, -, ~ (bitwise NOT)
Exponentiation operator: (the original author omitted this and listed bitwise operators instead: &, |, ^ (XOR), <<, >>)
Multiplicative operators: *, /, %
Additive operators: +, –
Relational operators: =, ==, !=, <>, <, <=, >, >=
Logical operators: or, ||, and, &&

Remember the spelling: use the exact capitalization shown. Function names are case-sensitive.

FunctionDescriptionExampleExample result
AbsReturns the absolute value.Abs(-1)1M
AcosReturns the angle corresponding to a cosine value.Acos(1)0d
Asin––d
Atan––d
CeilingRounds up to the nearest integer.Ceiling(1.5)2d
Cos––d
ExpReturns e raised to the specified power.Exp(0)1d
FloorRounds down to the nearest integer.Floor(1.5)1d
IEEERemainderReturns the remainder defined by IEEE 754. See the IEEE 754 standard for details.IEEERemainder(3, 2)-1d
LogReturns the logarithm using the second argument as the base.Log(1,10)0d
Log10Returns the base-10 logarithm.Log10(1)0d
Max–Max(1,2)2
Min–Min(1,2)1
Pow–Pow(3,2)9d
RoundThe second argument sets the number of decimal places. Round uses round-half-to-even. Midpoint rounding can be configured with EvaluateOption.RoundAwayFromZero when constructing Expression.Round(3.222,2)3.22d
SignReturns the sign.Sign(-10)-1
Sin––d
SqrtReturns the square root.Sqrt(4)2d
Tan––d
TruncateReturns the integer portion.Truncate(1.7)1

Note: In the results, M represents the Decimal type and d represents the Double type.

Other general-purpose functions:

FunctionDescriptionExampleResult
inChecks whether the first element matches any of the values that follow.in(1 + 1, 1, 2, 3)true
ifWorks like expression ? a : b. Returns one of the last two arguments based on the evaluated expression.if(3 % 2 = 1, ‘value is true’, ‘value is false’)‘value is true’
Scroll to Top