Operators & logic
Full precedence, arithmetic, comparisons, boolean logic (true short-circuit rules) and the exact Int64 bitwise lane.
Every expression in Numlex is evaluated by one strict operator grammar:
a single precedence ladder for arithmetic and logic, real boolean values
(never 1/0 coercion), and a separate exact-integer lane for bitwise work.
This page is the complete operator reference: precedence from if/then/
else down to postfix operators, what each operator means, exactly where the
language short-circuits (&& with a false left side — and nowhere else), and
the Int64 lane’s own precedence table, checked shifts and overflow behavior.
Precedence
From lowest to highest:
if … then … else … (right-associative)
or / ||
and / &&
not / !
== !=
< <= > >=
+ − (left)
* × / ÷ (left; `of` after a percent or multiplier is this level)
^ (power, right)
unary + / −
primary (literals, parentheses, calls, % and x postfixes)
Operators
| Operator | Meaning | Notes |
|---|---|---|
+ − | addition / subtraction | in an additive context a right-hand “pure” percent is a share of the accumulated left side: 100 + 10% = 110 |
* × / ÷ | multiplication / division | 200 × 10% = 20, 200 / 10% = 2000 |
^ | power | never XOR (XOR is the word xor on the integer lane) |
% (postfix) | p% = p/100 | semantic “percent” in an additive context |
x (postfix) | 1.5x = multiplier 1.5 | recognized only when no variable x is active |
of (infix, * level) | 15% of 490 = 73.5 | the left side must be a percent or a multiplier (1.5x): 1.5x of 20 = 30, chains 10% of 20% of 50 = 1; 3 of 4 is an error. In percent lines the basis of N% of E is the rest of the line: 15% of 490 + 5 = 74.25 |
< <= > >= | comparisons | numeric; the result is boolean |
== != | equality / inequality | boolean result |
and && | conjunction | && short-circuits only on a false left side: false && (1/0 > 0) = false; true && … and the word and always evaluate the right operand |
or || | disjunction | does not short-circuit: both operands are evaluated — false or (1/0 > 0) and false || (1/0 > 0) are division-by-zero errors |
not ! | negation | prefix |
if a then b else c | conditional | lowest precedence; the branches are full expressions; else is required |
More on the percent and multiplier forms is in Percentages.
Booleans are a real type
true and false are never coerced to 1/0. Mixing a boolean and a
number in one operator is an error.
Glyphs versus words
- The glyphs
&and|are always bitwise: used with boolean operands they are an error (false | (1/0 > 0)→ “Invalid expression”). - Only the words
and/orare contextual: two integers make them bitwise, two booleans make them logical.
The integer lane (exact Int64)
The lane is activated by:
- Strong: literals
0x…/0b…/0o…, the callsint(bin(oct(hex(, the phrases… as|in <base>/… to base N, the bitwise glyphs&|<<>>, and the wordxor. Glyphs only count when the line has mathematical content —fish & chipsstays prose. - Weak: the word
and/orwith “mathematical” neighbours.
Lane precedence, from lowest to highest:
if/then/else → || → && → | / or → xor → & / and
→ comparisons == != < <= > >= → shifts << >> → + - → * / % → ^
→ unary → primaries
| Operator | Meaning | Notes |
|---|---|---|
& | bitwise AND | |
| | bitwise OR | the glyph is always bitwise: boolean operands are an error (false | (1/0 > 0)) |
xor | bitwise XOR (word) | 6 xor 3 = 5 |
<< | left shift | shift 0…63; overflow is an error (checked) |
>> | right shift | shift 0…63; arithmetic for negative values |
/ | integer division | leaves the lattice for Double when there is a remainder |
% | remainder | |
^ | power | exponent is checked; a negative exponent produces a Double |
All lane values are exact Int64: 0x7FFFFFFFFFFFFFFF = 9223372036854775807.
Overflow is a visible error — never wraparound, never a silent Double.
Division with a remainder, a negative exponent, and non-integer values all
“leave” the lattice into Double, so use explicit parentheses at the
boundaries between lanes.
The literal forms, base names and verified examples live in Numbers & integer bases.
Related
- Numbers & integer bases — hex/binary/octal literals and phrases.
- Built-in functions —
powshares the^contract. - Percentages — the strict phrase patterns built on these operators.