EXP
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgExp
- 最后更新: 2018-04-16
返回 e 的指定次幂
语法
declare function Exp cdecl ( byval number as double ) as double用法
result = Exp( number )参数
number
e 的幂次,类型为 Double。
返回值
返回 e 的 number 次幂,类型为 Double。
说明
数学常数 e(又称欧拉常数)是 Exp 和 Log 函数的底数,是一个无理数和超越数。e 的精确值(保留二十位有效数字)为:2.7182818284590452354。参数 number 可以是函数范围内的任意有效数值表达式。若 number 过大,Exp 返回无穷大;若 number 过小,Exp 返回零(0.0);若 number 为零,则返回 1.0。number 的精确限制取决于数学处理器。
Exp 可作为运算符重载,以接受用户自定义类型。
示例
vb
'Compute Continuous Compound Interest
Dim r As Double
Dim p As Double
Dim t As Double
Dim a As Double
Input "Please enter the initial investment (principal amount): "; p
Input "Please enter the annual interest rate (as a decimal): "; r
Input "Please enter the number of years to invest: "; t
a = p * Exp ( r * t )
Print ""
Print "After";t;" years, at an interest rate of"; r * 100; "%, your initial investment of"; p; " would be worth";a输出结果如下:
Please enter the initial investment (principal amount): 100
Please enter the annual interest rate (As a decimal): .08
Please enter the number of years To invest: 20
After 20 years, at an interest rate of 8%, your initial investment of 100 would be worth 495.3032424395115与 QB 的差异
- 无
另请参阅
LogOperator ^ (Exponentiate)
返回 目录