Siebel VB Language Reference > VB Language Reference >

Exp Function

This standard VB function returns the value e (the base of natural logarithms) raised to a power.





The exponent value for e


The value of e raised to the power number.


If the variable to contain the return value has a data type of integer, currency, or single, the return value is a single-precision value. If the variable has a data type of long, variant, or double, the value returned is a double-precision number.

The constant e is approximately 2.718282.


This example estimates the value of a factorial of a number entered by the user. A factorial (notated with an exclamation mark, !) is the product of a number and each integer between it and the number 1. For example, 5 factorial, or 5!, is the product of 5*4*3*2*1, or the value 120.

Sub Button_Click
   Dim x as Single
   Dim msgtext, PI
   Dim factorial as Double
   PI = 3.14159
i: x = 55
   If x< = 0 then
      Exit Sub
   ElseIf x>88 then
      Goto i
   End If
   factorial = Sqr(2 * PI * x) * (x^x/Exp(x))
   msgtext = "The estimated factorial is: " & Format _
      (factorial, "Scientific")
End Sub

See Also

Abs Function
Fix Function
Int Function
Log Function
Rnd Function
Sgn Function
Sqr Function

Siebel VB Language Reference