Numerical values manipulation functions

See Useful string manipulation functions for use of these functions

FormatNum
Reduces a numerical value by rounding it to a fixed number of significant digits ( 4 here) Examples: FormatNum(num) q:'$ISVALIDNUM(num) "" s intnb=$L($FNUMBER($P(num,".",1),"-")) i $ZABS(num)<1 s intnb=0 s decnb=0 i intnb<4 s decnb=4-intnb s res=$NUM(num,decnb) i $E(res,1)="." s res="0"_res i $E(res,1,2)="-." s res="-0"_$E(res,2,$L(res)) q res
 * 1235.2 &gt; 1235
 * 0.166666 &gt; 0.1667
 * 12.3578 &gt; 12.36
 * Arguments:
 * num: value to format
 * Returns:formatted value

function
description
 * Arguments:
 * arg:
 * Returns:

function
description
 * Arguments:
 * arg:
 * Returns:

function
description
 * Arguments:
 * arg:
 * Returns: