Skip to content

EXP


返回 e 的指定次幂

语法

declare function Exp cdecl ( byval number as double ) as double

用法

result = Exp( number )

参数

number

e 的幂次,类型为 Double

返回值

返回 enumber 次幂,类型为 Double

说明

数学常数 e(又称欧拉常数)是 ExpLog 函数的底数,是一个无理数和超越数。e 的精确值(保留二十位有效数字)为:2.7182818284590452354。参数 number 可以是函数范围内的任意有效数值表达式。若 number 过大,Exp 返回无穷大;若 number 过小,Exp 返回零(0.0);若 number 为零,则返回 1.0number 的精确限制取决于数学处理器。

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 的差异

另请参阅

  • Log
  • Operator ^ (Exponentiate)

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系