<pre>function fmt N,Z,F  if char 1 of N is "-" then    put "-" into vSGN    delete char 1 of N  else    put empty into vSGN  end if  if F is empty then put "0" into F  set the numberFormat to F  get 1 * N  put the length of it into L  put offset(".",it) into P  if P > 0 then put L-P+1 into P  if (L-P) > 3 then    put "," before char (L-P-2) of it    add 1 to L    if (L-P) > 7 then      put "," before char (L-P-6) of it      add 1 to L      if (L-P) > 11 then        put "," before char (L-P-10) of it        add 1 to L      end if    end if  end if  put vSGN before it  put the length of it into L  if L < Z then put spc(Z-L) before it else if L > Z then get char 1 to Z of it  set the numberFormat to "0"  return itend fmtfunction fmt N,Z,F  if F is empty then put "0" into F  set the numberFormat to F  if F = "0" then put 0 into P else put 3 into P  get 1 * N  put the length of it into L  if L > (9+P) then put "," after char (L-(9+P)) of it  if L > (6+P) then put "," after char (L-(6+P)) of it  if L > (3+P) then put "," after char (L-(3+P)) of it  put the length of it into L  if L < Z then put spc(Z-L) before it  if L > Z then get char 1 to Z of it  return itend fmt</pre>