mk90.basic.functions

Function ABS

Absolute value in signed 16-bit arithmetic.

Syntax

ABS(expression)

Returns

Absolute integer value, within the 16-bit representation.

Behavior

Negative values are negated; nonnegative values are retained. The exceptional value −32768 has no positive signed 16-bit representation and remains the bit pattern 8000h (displayed as −32768).

Example

10 PRINT ABS(-7)
20 PRINT ABS(-32768)
30 END

Limits and diagnostics

Standard MBC-16 expression limits apply.

Status-code reference.

See also

Expressions and precedence · Runtime