Skip to content
ffredyk edited this page Jul 23, 2026 · 1 revision

/ (Division)

Category

Arithmetic

Arity

Binary — left operand / right operand.

<number> / <number>

Description

Divides the left operand by the right operand. Returns the quotient as a floating-point number. Auto-unwraps shared values before operating.

Division by zero throws SqTypeError.

How It Works

Performs double floating-point division. The host checks for zero divisor and throws an error if detected. The result is always a double — integer division is not a separate operation.

Usage

Basic division

_result = 10 / 3;             // 3.333...
_half = _value / 2;
_ratio = _current / _max;

Safe division (guard against zero)

_safe = if (_divisor != 0) then {
    _value / _divisor
} else {
    0
};

With shared values

shared _total = 100;
_avg = get _total / _count;

Errors

  • SqTypeError — thrown when divisor is 0 (or 0.0).

Thread Safety

Not atomic. Regular division on primitives is thread-safe.

See Also

  • * — multiplication
  • % — modulo
  • floor — round down (for integer division)
  • ceil — round up

SQ# Wiki

Home

Engine Docs

Migration

Commands

Value Constructors

Arithmetic

Comparison

Logic

Array

String

Math

Random

Type & Introspection

HashMap

Code Execution

Concurrency

Scheduler

Thread Safety

Error

Output

Time

Multiplayer

Compiler

Clone this wiki locally