import type { Value } from './values/index.js'; /** Whether a corrupt program reached an operator with tags it cannot take. */ export declare class OperandMismatch extends Error { readonly opcode: string; constructor(opcode: string); } /** * `ADD`: the sum of two numbers, or the concatenation of two strings. * * The only instruction that reads two tags. Any other combination is a program * the checker should have rejected, and an engine treats it as corrupt rather * than inventing a conversion: `language.md` 5.3 has no coercion anywhere, and * an engine that grows one here becomes the only engine that runs that script. */ export declare function add(a: Value, b: Value): Value; export declare function subtract(a: Value, b: Value): Value; export declare function multiply(a: Value, b: Value): Value; /** `DIV`: absent when the divisor is zero, including `0 / 0`. */ export declare function divide(a: Value, b: Value): Value; /** `MOD`: the remainder of truncated division, sign following the left operand. */ export declare function remainder(a: Value, b: Value): Value; export declare function negate(a: Value): Value; /** * The four ordering comparisons, which **propagate absence**. * * An absent operand gives absence rather than `false` (`language.md` 6.4). * Together with `EQ` being total, this is the one place in the language where * absence is treated two ways, and it is deliberate: an operator that can * itself be absent gives a script no way to ask whether a value is absent at * all, so equality is the exception and every other comparison is not. * * **Two strings are ordered by code point** (`language.md` 9.3, `stdlib.md` * section 10), through the one order `sort` uses, and not by the host's own * operator, which orders by sixteen bit unit and puts a symbol outside the * basic plane below the last thousands of the plane. Numbers take the host's * operator, which is the binary64 order every engine shares. */ export declare function compare(opcode: 'LT' | 'LE' | 'GT' | 'GE', a: Value, b: Value): Value; /** `EQ` and `NE` are total: they always produce a boolean. */ export declare function equals(a: Value, b: Value): boolean; /** `NOT`: true becomes false, false becomes true, absent stays absent. */ export declare function not(a: Value): Value; /** * `AND`, the three-valued conjunction of `language.md` 6.6. * * The table holds only the cases the short circuit leaves to it: `AND_SHORT` * has already decided a `false` left operand. A `false` on the right fixes the * answer whatever an absent left operand would have held, which is what makes * the operator commutative. */ export declare function and(a: Value, b: Value): Value; /** `OR`, the disjunction beside it. A `true` on either side fixes the answer. */ export declare function or(a: Value, b: Value): Value; /** * Whether a branch is taken, which is the fifth rule. * * `JUMP_FALSE` treats absence as false. This is the one place absence is * absorbed rather than propagated, and it is unavoidable: execution has to go * somewhere. It serves `if`, `else if`, `while`, the ternary and a `switch` * condition arm, so the rule is written once in one instruction. */ export declare function isFalsey(value: Value): boolean; //# sourceMappingURL=arithmetic.d.ts.map