macros与手动之间的区别使用LOG在同一个公式上输出
那么它是一个非常奇怪的问题
我有一个macros产生一个选项的增量(D1):
Function dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend) dOne = (Log(UnderlyingPrice / ExercisePrice) + (Interest - Dividend + (0.5 * Volatility ^ 2)) * Time) / (Volatility * (Sqr(Time))) End Function
当我将这些值传递给它时,它会生成所需的输出:
但是,当我尝试在Excel中复制这个,它给出了一个完全不同的输出
我知道手动生成的输出计算是正确的。 但是,所需的值是从VBA生成的值。
请build议我在这里错过了什么。
VBA中的Log
函数是自然的日志: ln(x) 。
公式中的LOG
函数是以10为底的log 10 (x) 。
如果你想在VBA中logging10的基数,你将不得不使用对数标识来转换基数:
Log(x)/Log(10)
在你的情况
dOne = (Log(UnderlyingPrice / ExercisePrice) / Log(10) + (Interest - Dividend + (0.5 * Volatility ^ 2)) * Time) / (Volatility * (Sqr(Time)))