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

Return type: Opaque
Returns:       

e raised to the power of x.



Syntax
  define external float function
      exp value float x

  define external bcd  function
      exp value bcd x


Purpose

If you know the number's natural logarithm, you can use exp to calculate the exponential value of either

You must include either ombcd.xin or omfloat.xin in your program. Decide whether you want BCD mathematics (excellent for financial calculations) or floating point mathematics (excellent for extremely large numbers).

The exp function calculates the value of e raised to the power of "x", where "x" is the natural logarithm.

BCD Example:


  ; Displays e to the power of 2 as a BCD
  include "ombcd.xin"
  process
    local bcd x initial {"2.3025850929940461"}
    local bcd result

    set result to exp (x)
    output "e to the power of " || "d" % x || " = " || "d" % result || "%n"
  ; Output: "e to the power of 2.3025850929940461 = 10.0000000000000002" 

Floating Point Example:

  ; Displays the value of e to the power of 2 as a floating point number.
  include "omfloat.xin"
  process
    local float x initial {"2.3025850929940461"}
    local float result

    set result to exp (x)
    output "e to the power of " || "d" % x || " = " || "d" % result || "%n"
  ; Output: "e to the power of 2.3025850929940461 = 10"

In the example above, instead of using the line set result to exp (x), you could have written set result to e ** x.

If the result of an exponential value does not fit in the data type of the argument, the value returned is truncated to fit the data type.

If you take the exponential value of an integer, the result is coerced into the data type of the library you have included - either a floating point or BCD number.

In OmniMark, always surround operators with spaces.

    Related Syntax
   sqrt
   ln
   log10
   **
 
 
----  

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

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

Copyright © OmniMark Technologies Corporation, 1988-2000.