From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

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