SIGN

Returns a numerical value which takes its sign from one argument and its magnitude from another:
SIGN(x1, x2) = ABS(x1) if x2 > 0SIGN(x1, x2) = -ABS(x1) if x2 < 0 
 
Note:  
SIGN is discontinuous. Use this function with care

Format

SIGN(x1, x2)

Arguments

 
x1
Any valid expression that evaluates to a real number.
x2
Any valid expression that evaluates to a real number.

Example

The following examples illustrate the use of the SIGN function:
 
Function
SIGN(9.6, 4.5)
Result
9.6
 
Function
SIGN(-4.7, 1.2)
Result
4.7
 
Function
SIGN(5.3, -6.5)
Result
-5.3
 
Function
SIGN(-2.5, - 5.2)
Result
-2.5