SIGN()

SIGN()

Sign of a number

Syntax

      SIGN( <nNumber> ) -> nSign

Arguments

<nNumber> a number

Returns

<nSign> sign of <nNumber>

Description

The function SIGN() determines the sign of <nNumber>. If <nNumber> is > 0, then SIGN(<nNumber>) returns 1 If <nNumber> is < 0, then SIGN(<nNumber>) returns -1 If <nNumber> is == 0, then SIGN(<nNumber>) returns 0

Examples

      ? sign( 1.1 )   // --> 1
      ? sign( -1.1 )  // --> -1
      ? sign( 0.0 )   // --> 0

Tests

      sign( 1.1 )  == 1
      sign( -1.1 ) == -1
      sign( 0.0 )  == 0

Compliance

SIGN() is compatible with CT3’s SIGN().

Platforms

All

Files

Source is math.c, library is libct.

Advertisements

2 responses to “SIGN()

  1. Pingback: Harbour All Functions – S | Viva Clipper !

  2. Pingback: Harbour Math Functions | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s