uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
Operators
Product:
Class:
Remarks
Precedence numbers are relative only—higher means tighter binding.
🔢 Integer Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 50 | x + y | {x As Int} + {y As Int} As Int | Integer addition. |
| 50 | x - y | {x As Int} - {y As Int} As Int | Integer subtraction. |
| 60 | x * y | {x As Int} * {y As Int} As Int | Integer multiplication. |
| 60 | x / y | {x As Int} / {y As Int} As Int | Integer division (truncating). |
| 60 | x % y | {x As Int} % {y As Int} As Int | Integer remainder. |
🧮 Double‑Precision Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 50 | x + y | {x} + {y} | Floating‑point addition. |
| 50 | x - y | {x} - {y} | Floating‑point subtraction. |
| 60 | x * y | {x} * {y} | Floating‑point multiplication. |
| 60 | x / y | {x} / {y} | Floating‑point division. |
| 60 | x \\ y | {x} \\ {y} = Trunc(x / y) | Integer‑style division on doubles. |
| 60 | x mod y | {x} mod {y} | Floating‑point modulo. |
| 70 | +x | +{x} | Unary plus. |
| 70 | -x | -{x} | Unary negation. |
| 90 | x! | {x}! | Factorial. |
| 80 | x ^ y | {x} ^ {y As Int} | Exponentiation with integer exponent. |
| 80 | x ^ y | {x} ^ {y} | Exponentiation with floating exponent. |
🔤 String Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 50 | x + y | {ByHandle x As String} + {ByHandle y As AnyType} As String | String concatenation with automatic conversion. |
| 50 | x + y | {ByHandle x As AnyType} + {ByHandle y As String} As String | Concatenation (reverse order). |
| 50 | x + y | {x As String} + {y As String} As String | Pure string concatenation. |
| 30 | x & y | {x As Int} & {y As Int} As Int | Bitwise AND for integers. |
| 30 | x & y | {ByHandle x As AnyType} & {ByHandle y As AnyType} As String | String concatenation operator (VB‑style). |
| 60 | x * y | {x As String} * {y As size_t} As String | String repetition. |
🧭 Pointer Arithmetic
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 50 | ptr + n | {ByHandle x As AnyType Ptr} + {y As Int} As SameTypeAs:0 Ptr | Pointer addition. |
| 50 | ptr - n | {ByHandle x As AnyType Ptr} - {y As Int} As SameTypeAs:0 Ptr | Pointer subtraction. |
🔍 Comparison Operators
(String, Int, Double, and generic overloads)
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 40 | x == y | {x As String} == {y As String} As Bool | String equality. |
| 40 | x <> y | {x As String} <> {y As String} As Bool | String inequality. |
| 40 | <, >, <=, >= | String versions | Lexicographic comparisons. |
| 40 | x == y | {x As Int} == {y As Int} As Bool | Integer equality. |
| 40 | x <> y | {x As Int} <> {y As Int} As Bool | Integer inequality. |
| 40 | <, >, <=, >= | Integer versions | Numeric comparisons. |
| 40 | x == y | {x} == {y} As Bool | Generic equality. |
| 40 | x <> y | {x} <> {y} As Bool | Generic inequality. |
| 40 | <, >, <=, >= | Generic versions | Type‑dependent comparisons. |
🔢 Complex Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 50 | x + y | {x As Complex} + {y As Complex} As Complex | Complex addition. |
| 50 | x - y | {x As Complex} - {y As Complex} As Complex | Complex subtraction. |
| 60 | x * y | {x As Complex} * {y As Complex} As Complex | Complex multiplication. |
| 60 | x / y | {x As Complex} / {y As Complex} As Complex | Complex division. |
| 80 | x == y | {x As Complex} == {y As Complex} As Bool | Complex equality. |
| 80 | x <> y | {x As Complex} <> {y As Complex} As Bool | Complex inequality. |
| 80 | x ^ y | {x As Complex} ^ {y As Complex} As Complex | Complex exponentiation. |
🟦 Boolean Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 35 | !x | ! {x As Bool} As Bool | Logical NOT. |
| 35 | Not x | Not {x As Bool} As Bool | Alternative NOT. |
| 30 | x && y | {x As Bool} && {ByExpr y As Bool} As Bool | Logical AND (short‑circuit). |
| 30 | x And y | {x As Bool} And {ByExpr y As Bool} As Bool | Logical AND (non‑short‑circuit). |
| 30 | x AndAlso y | {x As Bool} AndAlso {ByExpr y As Bool} As Bool | Short‑circuit AND (VB‑style). |
| 20 | x || y | {x As Bool} || {ByExpr y As Bool} As Bool | Logical OR (short‑circuit). |
| 20 | x Or y | {x As Bool} Or {ByExpr y As Bool} As Bool | Logical OR (non‑short‑circuit). |
| 20 | x OrElse y | {x As Bool} OrElse {ByExpr y As Bool} As Bool | Short‑circuit OR (VB‑style). |
🧱 Bitwise Operators
| Prec | Operator | Signature | Description |
|---|---|---|---|
| 35 | ~x | ~ {x As Int} As Int | Bitwise NOT. |
| 35 | Not x | Not {x Int} As Int | Alternative bitwise NOT. |
| 30 | x And y | {x As Int} And {y As Int} As Int | Bitwise AND. |
| 30 | x BitAnd y | {x As Int} BitAnd {y As Int} As Int | Explicit bitwise AND. |
| 20 | x | y | {x As Int} | {y As Int} As Int | Bitwise OR. |
| 20 | x Or y | {x As Int} Or {y As Int} As Int | Bitwise OR (keyword). |
| 20 | x BitOr y | {x As Int} BitOr {y As Int} As Int | Explicit bitwise OR. |
| 20 | x Xor y | {x As Int} Xor {y As Int} As Int | Bitwise XOR. |
| 45 | x << y | {x As Int} << {y As Int} As Int | Left shift. |
| 45 | x >> y | {x As Int} >> {y As Int} As Int | Right shift. |
📝 Assignment Operators
| Prec | Assoc | Operator | Signature | Description |
|---|---|---|---|---|
| 15 | Right‑to‑Left | x = y | {ByRef x As AnyType} = {y As SameTypeAs:0} As SameTypeAs:0 | Generic assignment. |
| 15 | Right‑to‑Left | x = y | {ByRef x As String} = {y As String} As String | String assignment. |
| 15 | Right‑to‑Left | x = y | {ByRef x As Complex} = {y As Complex} As Complex | Complex assignment. |
🔼 Increment / Decrement
| Operator | Description |
|---|---|
++x | Prefix increment. |
x++ | Postfix increment. |
--x | Prefix decrement. |
x-- | Postfix decrement. |
🧩 Miscellaneous Operators
| Operator | Description |
|---|---|
; | Statement separator. |
, | Argument separator (comma operator). |