Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$FNUMBER

1995 Version of ANSI (Equivalent to Current ISO Version) of Standard

7.1.5.6 $FNumber

$FN[UMBER] ( numexpr , fncodexpr )

    fncodexpr::= expr V fncode
    fncode::= [ fncodatom ... ]
    fncodatom::=



fncodp
fncodt
,
+
-




       
 
(Note: comma)
 
(Note: hyphen)
    fncodp::=

p
P


    fncodt::=

t
T


This form returns a value which is an edited form of numexpr. Each fncodatom is applied to numexpr in formatting the results by the following rules (order of processing is not significant):

fncodatomAction
fncodp Represent negative numexpr values in parentheses. Let A be the absolute value of numexpr. Use of fncodp will result in the following:
  1. If numexpr < 0, the result will be "("_A_")".
  2. If numexpr '< 0, the result will be " "_A_" ".
fncodt Represent numexpr with a trailing rather than a leading "+" or "-" sign. Note: if sign suppression is in force (either by default on positive values, or by design using the "-" fncodatom), use of fncodt will result in a trailing space character.
, Insert comma delimiters every third position to the left of the decimal (present or assumed) within numexpr. Note: no comma shall be inserted which would result in a leading comma character.
+ Force a plus sign ("+") on positive values of numexpr. Position of the "+" (leading or trailing) is dependent on whether or not fncodt is present.
- Suppress the negative sign "-" on negative values of numexpr.

If fncodexpr equals an empty string, no special formatting is performed and the result of the expression is the original value of numexpr.

More than one occurrence of a particular fncodatom within a single fncode is identical to a single occurrence of that fncodatom. Erroneous conditions are produced, with ecode="M2", when a fncodp is present with any of the sign suppression or sign placement fncodatoms ("+-" or fncodt).

$FN[UMBER] ( numexpr , fncodexpr , intexpr )

This form is identical to the two-argument form of $FNumber, except that numexpr is rounded to intexpr fraction digits, including possible trailing zeros, before processing any fncodatoms. If intexpr is zero, the evaluated numexpr contains no decimal point. Note: if (–1 < numexpr < 1), the result of $FNumber has a leading zero ("0") to the left of the decimal point. Negative values of intexpr are reserved for future extensions of the $FNumber function.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

This page most recently updated on 15-Nov-2023, 13:08:50.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)