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

exp

 

 

Return type: OMX
Returns:       

e raised to the power of x.



Syntax
  define external float function
      exp value float x

Argument definitions

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

To use ombcd or omfloat, you must import the module into your program using a statement like one of these two:

(Please see the import topic for more on importing.)

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, you need to coerce the integer - to a floating point or BCD number - so that the appropriate function is called. The result will depend on which exponential function is called.

In OmniMark, always surround operators with spaces.

Examples

BCD Example:


  ; Displays e to the power of 2 as a BCD
  import "ombcd.xmd" unprefixed
  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.
  import "omfloat.xmd" unprefixed
  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)
 
 
 

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

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

Copyright © Stilo Corporation, 1988-2005.