FLOAT MATH

FLOAT expressions return floating point (fractional) numbers. The FLOAT MATH expression performs a floating-point arithmetic operation on two values.

The operation to be performed is supplied in the VALUE attribute of an EXPRNODE element. The values to be operated on are supplied in two sub-expressions.

The possible operations that may be specified in the VALUE attribute are as follows:
  • ADD
  • SUBTRACT - expression 1 minus expression 2.
  • MULTIPLY
  • DIVIDE - expression 1 divided by expression 2.
  • POWER - expression 1 raised to the power of expression 2.
  • PERCENT - the percentage expression 1 is of expression 2 (100 * (expression 1 / expression 2)).

The sub-expressions can be PROPERTY, STRING, INTEGER, or FLOAT expressions (use PROPERTY expressions to retrieve values from the current record). The values returned by the sub-expressions are converted to floating-point numbers prior to performing the parent operation.

See the EXPRESSION element for DTD and attribute information.

Example

This example subtracts to constants and returns a floating point result.

<EXPRESSION TYPE="FLOAT" NAME="MATH">
   <EXPRNODE NAME="OPERATOR" VALUE="SUBTRACT"/>
   <EXPRESSION TYPE="FLOAT" NAME="CONST">
      <EXPRNODE NAME="VALUE" VALUE="9.25"/>
   </EXPRESSION>
   <EXPRESSION TYPE="FLOAT" NAME="CONST">
      <EXPRNODE NAME="VALUE" VALUE="11.75"/>
   </EXPRESSION>
</EXPRESSION>