EXP Function
----------------------------------------------------------------------------
Action
Calculates the exponential function.
Syntax
EXP( x)
Remarks
The EXP function returns e (the base of natural logarithms) to the power
of x.
The exponent x must be less than or equal to 88.02969 when you are using
single-precision values and less than or equal to 709.782712893 when you are
using double-precision values. If you use a value of x that isn't within
those limits, BASIC generates the error message Overflow.
EXP is calculated in single precision if x is an integer or
single-precision value. If you use any other numeric data type, EXP is
calculated in double precision.
See Also
LOG
Example
The following example uses the EXP function to calculate the growth of a
bacterial colony over a 15-day period. The program prompts you for an
initial population and the rate of growth.
CLS ' Clear screen.
INPUT "Initial bacterial population"; Colony0
INPUT "Growth rate per day as a percentage of population"; Rate
R = Rate - 100 . Form$ = "## ###,###,###,###"
PRINT . PRINT "Day Population"
FOR T = 0 TO 15 STEP 5
PRINT USING Form$; T, Colony0 * EXP(R * T)
NEXT
Output
Initial bacterial population? 10000
Growth rate per day as a percentage of population? 10
Day Population
0 10,000
5 16,487
10 27,183
15 44,817