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

abs

Category

Math

Arity

Unaryabs <number>.

abs <number>

Description

Returns the absolute (non-negative) value of a number. abs -55, abs 33. Auto-unwraps shared values.

How It Works

Calls Math.Abs(double). Negative input becomes positive; positive input unchanged; zero unchanged.

Usage

abs -5;                        // 5
abs 3.14;                      // 3.14
abs 0;                         // 0

// Distance / magnitude
_delta = abs (_a - _b);

// Error margin
if (abs (_actual - _expected) < 0.001) then {
    systemChat "Values match";
};

Thread Safety

ReadOnly — pure computation. Safe from any scheduler.

See Also

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