Math.Sign(Value)

.Sign() method determines if the Value is positive or negative. If the Value is positive it will return 1, and if it is negative it will return -1.

Applies To

Math

Properties and Methods

None

Available

The .Sign(Value) method is available in:

  • 15.03.016
  • All newer builds

Type

Int32

Syntax

Math.Sign(Value);

Parameters

Parameter

Required

Description

Value

Yes

Any data that can be evaluated as a number.

If the value cannot be evaluated as a number, then DEACOM will throw a scripting error.

Example

Event.Form.MessageBox('Math.Sign(7): ' + Math.Sign(7) +

'\nMath.Sign(-3): ' + Math.Sign(-3) +

'\nMath.Sign(0): ' + Math.Sign(0) +

'\nMath.Sign(\'-3\'): ' + Math.Sign('-3') +

'\nMath.Sign(true): ' + Math.Sign(true));

 

/* Expected System Response:

Math.Sign(7): 1

Math.Sign(-3): -1

Math.Sign(0): 0

Math.Sign('-3'): -1

Math.Sign(true): 1

*/