Problem: Avenue does not correctly evaluate mathematical equations


The information in this article applies to ArcView GIS versions 3.x only. The instructions described apply to the Avenue programming language, which is specific to the ArcView GIS application.

Avenue does not correctly evaluate mathematical equations. For example, the expression "2 + 4 * 6" evaluates to 36 rather than the correct value of 26.


Avenue does not use standard mathematical precedence; instead the evaluation proceeds from left to right. In the example above, Avenue adds the 2 and 4 to get 6, then multiplies by 6 to arrive at a total of 36.

Solution or Workaround

Use parentheses to enforce operational order. The example above should be 2+(4*6). This expression in Avenue will yield the correct result, 24.

For more information on mathematical functions, see the Number class in the ArcView Help. From the Help menu, select Help Topics and click on the Index tab. Search on the word "number".