swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax    
operator  

** (power)

 

 

Return type: OMX
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 import the ombcd.xmd file in your program. To raise a floating point number, import the omfloat.xmd file.

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

BCD Example:

  import "ombcd.xmd" unprefixed
  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 0.01
      output "future amount is " || "d" % RoundValue || "%n"

Floating Point Example:

  import "omfloat.xmd" unprefixed
  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 principal 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 ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:44:54 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.