Skip to content

Modern Math Sign

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › Sign

Sign

Returns -1, 0 or 1 for the sign of a number, always as a Long.

Syntax

Sign( x ) as LONG

Examples

#import "std/numeric"
using numeric

print Sign( 42.0 )           '' 1
print Sign( -42.0 )          '' -1
print Sign( 0.0 )            '' 0

'' Three-valued, so it cannot answer the negative-zero question -- use
'' IsNegative for the sign BIT
print Sign( -0.0 )           '' 0
print IsNegative( -0.0 )     '' true

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword

Clone this wiki locally