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

Return type: OMX
Returns:       

e raised to the power of x.



Syntax
  define external float function
      exp value float x
  where
x
a floating point number define external bcd function exp value bcd y
y
a BCD number


Purpose

Use exp to calculate the value of e raised to the power of either a floating point number or a BCD number.

Requirements

You must include one of the the following lines at the beginning of your OmniMark program:

Usage Notes

e is Euler's number, and is approximately equal to 2.71828182845904523536028747135 ...

You use BCD mathematics typically for financial calculations and floating point mathematics typically for extremely large numbers.

You calculate the value of e raised to the argument of exp, as in

  set my-value to exp (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.

Examples

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.

    Related Syntax
   sqrt
   ln
   log10
   ** (power operator)
 
 
----  

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

OmniMark 6.5 Documentation Generated: December 23, 2002 at 6:25:17 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-2002.