Sign Function

Description

By Eddie Shore, November 2011 (Eddie's Math and Calculator Blog)

The sign function (sometimes called signum) is defined as follows:
          {-1 if x < 0
sign(x) = { 0 if x = 0
          { 1 if x > 0

Examples:
  1. sign(-52): -52 f C, Result: -1
  2. sign(0): 0 f C, Result: 0
  3. sign(36): 36 f C, Result: 1

Program Resources

Labels

Name Description
 C Sign Function
 0 Temporary Label Used

Program

Line Display Key Sequence
000
001 42,21,13 f LBL C
002 43 20 g x=0
003 43 32 g RTN
004 43,30, 2 g TEST x<0
005 22 0 GTO 0
006 1 1
007 43 32 g RTN
008 42,21, 0 f LBL 0
009 1 1
010 16 CHS
011 43 32 g RTN