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

Numeric Interpretation

1984 Version of ANSI Standard

3.2.5 Numeric Interpretation of Data

Certain operations, such as arithmetic, deal with the numeric interpretations of their operands. The numeric interpretation is a mapping from the set of all data values into the set of all numeric values, described by the following algorithm. Note that the numeric interpretation maps numeric values into themselves.

(Note: The "head" of a string is defined to be a substring which contains all of the characters of the string to the left of a given point and none of the characters of the string to the right of that point. A head may be empty or it may be the entire string.)

Consider the argument to be the string S.

First, apply the following sign reduction rules to S as many times as possible, in any order.

  1. If S is of the form + T, then remove the +.
    (Shorthand: + T Right Arrow T)
  2. - + T Right Arrow - T
  3. - - T Right Arrow T

Second, apply one of the following, as appropriate.

  1. If the leftmost character of S is not"-", form the longest head of S which satisfies the syntax description of numlit. Then apply the algorithm of 3.2.4.2 to the result.
  2. If S is of the form - T, apply step a. above to T and append a "-" to the left of the result. If the result is "–0", change it to "0".

The "numeric expression" numexpr is defined to have the same syntax as expr. Its presence in a syntax description serves to indicate that the numeric interpretation of its value is to be taken when it is executed.

    numexpr::= expr

See also the transition diagram for numexpr.

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 12-Sep-2014, 13:11:21.

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