Skip to main content

Operators

EngCanvas supports arithmetic, comparison, and assignment operators. All operators are unit-aware — dimensional analysis is enforced automatically.

Arithmetic operators

Addition (+)

Adds two values. Both operands must have the same dimensions.

10 ft + 3 ft         // → 13 ft
10 ft + 36 in // → 13 ft (mixed units, same dimension)
10 ft + 5 kip // ✗ Error: dimension mismatch (L ≠ F)

For dimensionless values:

3 + 4                // → 7

Subtraction (-)

Subtracts two values. Both operands must have the same dimensions.

20 ft - 6 in         // → 19.5 ft
100 kip - 30 kip // → 70 kip

Unary minus negates a value:

-5 kip               // → -5 kip

Multiplication (*)

Multiplies two values. Dimensions add.

10 kip * 3 ft        // → 30 kip·ft (F + L)
4 ft * 6 ft // → 24 ft^2 (L + L = L²)
150 pcf * 2 ft^3 // → 300 lb (F/L³ × L³ = F)

Division (/)

Divides two values. Dimensions subtract.

100 kip / 20 in^2    // → 5 ksi (F - L² = F·L⁻²)
60 mi / 1 hr // → 60 mph (L - T = L·T⁻¹)
30 kip·ft / 15 kip // → 2 ft (F·L - F = L)

Division by zero produces an error.

Exponentiation (^)

Raises a value to a power. Dimensions scale by the exponent. The exponent must be dimensionless.

4 ft ^ 2             // → 16 ft^2 (L × 2 = L²)
2 m ^ 3 // → 8 m^3 (L × 3 = L³)
(10 kip)^2 // → 100 kip^2 (F × 2 = F²)

Exponentiation is right-associative:

2 ^ 3 ^ 2            // → 2^(3^2) = 2^9 = 512

Comparison operators

All comparison operators return a dimensionless result (1 for true, 0 for false). Operands should have compatible dimensions for meaningful comparison.

OperatorMeaningExample
= or ==Equalfb = 30 ksi (assignment) or fb == 30 ksi (comparison)
<Less thanratio < 1
>Greater thanfb > Fb
<=Less than or equaldeflection <= L / 360
>=Greater than or equalphi_Mn >= Mu
<>Not equalstatus <> 0
= as assignment vs. comparison

When = appears at the top level of a formula (e.g., L = 20 ft), it's an assignment. Inside function arguments or after another operator, it acts as a comparison. Use == if you want to be explicit about comparison.

// Assignment
Fy = 50 ksi

// Comparison (inside IF)
IF(fb == Fy, "at yield", "below yield")

// Comparison with units
10 ft > 100 in // → true (10 ft = 120 in > 100 in)

Assignment operator (=)

Assigns a value to a variable name:

L = 20 ft
w = 1.5 kip/ft
Mmax = w * L^2 / 8

The left side must be a valid identifier (letters, digits, underscores, apostrophes).

Operator precedence

From lowest to highest:

LevelOperatorsAssociativityExample
1+, -Lefta + b - c
2*, /Lefta * b / c
3^Righta ^ b ^ c = a^(b^c)
4: (range)Left$A1:$B10
5! (sheet ref)Left'Sheet'!$A1
6[i,j] (index)LeftM[1,2]

Use parentheses to override precedence:

(a + b) * c          // addition before multiplication
w * L^2 / 8 // exponent first, then multiply, then divide

Parentheses

Group sub-expressions to control evaluation order:

Ix = (b * d^3) / 12 - ((b - tw) * (d - 2 * tf)^3) / 12

Next steps