Returns a string containing a formatted number.

The format for the $FNUMBER function is:


$FNUMBER() formats or edits numbers, usually for reporting. For more information on rounding performed by $FNUMBER(), refer to “$Justify()”.

The formatting codes are:

Examples of $FNUMBER()


GTM>do ^fnum
  zprint ^fnum
  set X=-100000,Y=2000
  write "SUPPRESS NEGATIVE SIGN:",?35,$FNumber(X,"-"),!
  write "TRAILING SIGN:",?35,$FNumber(X,"T"),!
  write "NEGATIVE NUMBERS IN ():",?35,$FNumber(X,"P"),!
  write "COMMAS IN NUMBER:",?35,$FNumber(X,","),!
  write "NUMBER WITH FRACTION:",?35,$FNumber(X,"",2),!
  write "FORCE + SIGN IF POSITIVE:",?35,$FNumber(Y,"+"),!
SUPPRESS NEGATIVE SIGN:            100000
TRAILING SIGN:                     100000-
NEGATIVE NUMBERS IN ():            (100000)
COMMAS IN NUMBER:                  -100,000
NUMBER WITH FRACTION:              -100000.00
FORCE + SIGN IF POSITIVE:          +2000


set x=$fnumber(x,"-")

This example uses $FNUMBER() to SET x equal to its absolute value.