Xojo.Math.Sign

From Xojo Documentation

Revision as of 21:46, 30 October 2020 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

Xojo.Math.Sign(value As Double) As Double

Supported for all project types and targets.

Returns the sign of the number, -1 if the number is negative, 0 if it is zero and 1 if the number is positive.

Sample Code

Using Xojo.Math

Dim numSign As Integer
numSign = Sign(-55) // numSign = -1
numSign = Sign(42) // numSign = 1
numSign = Sign(0) // numSign = 0