Adobe ColdFusion 8

Sgn

Description

Determines the sign of a number.

Returns

  • 1, if number is positive.
  • 0, if number is 0.
  • -1, if number is negative.

Category

Mathematical functions

Function syntax

Sgn(number)

See also

Abs

Parameters

Parameter

Description

number

A number

Example

<h3>Sgn Example</h3>
<p>Sgn determines the sign of a number. Returns 1 if number is positive; 
    0 if number is 0; -1 if number is negative.
<p>Sgn(14): <cfoutput>#Sgn(14)#</cfoutput>
<p>Sgn(21-21): <cfoutput>#Sgn(21-21)#</cfoutput>
<p>Sgn(-0.007): <cfoutput>#Sgn(-0.007)#</cfoutput>