swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
  Related Syntax    
operator   **    

Return type: Opaque
Returns:       

The BCD or floating point number raised to the power "y", or the integer, string, or numeric-literal raised to the power "y".

The first argument must be greater than 0 if the second argument is either equal to or less than zero, or not an integer.



Syntax
  numeric-expression ** numeric-expression


Purpose

You can use the ** operator to raise a number to any given power.

To raise a BCD number to a power, you must include the ombcd.xin file in your program. To raise a floating point number, include the omfloat.xin file.

The following code shows how to use ** to calculate the future value of a single amount, expressed by the equation:

BCD Example:

  include "ombcd.xin"
  process
      local bcd Principal initial {1000}
      local bcd InterestRate initial {0.09}
      local bcd Time initial {3}
      local bcd FutureValue
      local bcd RoundValue

      set FutureValue to Principal * (1 + InterestRate) ** Time
      set RoundValue to round FutureValue bankers-nearest bcd 0.01
      output "future amount is " || "d" % RoundValue || "%n"

Floating Point Example:

  include "omfloat.xin"
  process
      local float Principal initial {1000}
      local float InterestRate initial {0.09}
      local float Time initial {3}
      local float FutureValue
      local float RoundValue

      set FutureValue to Principal * (1 + InterestRate) ** Time
      set RoundValue to round FutureValue by 0.01
      output "future amount is " || "d" % RoundValue || "%n"

If the principle is $1000, the interest rate 9 percent, and the time 3 years, the result would be a future amount of $1295.03.

    Related Syntax
   sqrt
   exp
   ln
   log10
 
 
----  

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ OMX ] [ ERRORS ]

Generated: August 11, 2000 at 3:06:55 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.