The mgiMath Tag

Tag Behavior

Use the mgiMath tag to perform numerical calculations.


Tag Syntax

The mgiMath tag has a beginning tag with no required parameters and three optional parameters, a body and an ending tag. The tag form is:

<mgiMath resultPrecision="Integer" workPrecision="Integer" 
displayPrecision="Integer">
Calculation
</mgiMath>

Required Parameters:

  • None

Optional Parameters:

  • resultPrecision - The resultPrecision is the number of decimal places that the result is rounded to. The default is "8".
  • workPrecision - The workPrecision is the number of decimal places maintained througout the calculation in order to avoid rounding errors at individual steps during the process. The default is "8".
  • displayPrecision - The displayPrecision parameter specifies the precision that should be used to display the result. If the specified precision has less decimal places than the actual number, the number is rounded. If the specified precision has more decimal places than the actual number, the number is padded with trailing zeroes. The default is to display the number with no trailing zeroes after the decimal point.


Technical Notes

  • Mathematical operations - The body of the mgiMath tag can contain mathematical expressions that adhere to the algebraic order of operations. The body can consist of the following characters as well as whitespace:
0 1 2 3 4 5 6 7 8 9 . + - * / \ % ^ ( )
  • Operators:
    • + Addition
    • - Subtraction or Negate
    • * Multiplication
    • / Division
    • \ Division (Remainder truncated)
    • % Modulo (Remainder of division)
    • ^ Exponentiation
    • ( ) Grouping
  • Order of Operations:
    1. ( ) Grouping
    2. + - Positive and negative numbers
    3. ^ Exponents
    4. * / % Multiplication, division, and modulo (processed left to right)
    5. + - Addition and subtraction (processed left to right)


Example Usage and Output

<mgiMath resultPrecision="4" workPrecision="4">
1.5 + 6.7 * (4 - 12)
</mgiMath>

The result of this mathematical calculation is: 52.1


Suggested Usage

  • Calculations


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]