|
From: R Y <fan...@gm...> - 2011-10-03 12:32:05
|
The bug report was invalidated and closed too soon that I haven't been able to put a comment on that one, so let me post it here... The bug was that the result of BS() formula, c=BS(F,K,sigma,"call") for a call option doesn't satisfy c>=F-K for certain K<<F (i.e. deep in the money strike). The issue is caused by floating point precision. That is true. But I was hoping the dev team could dig a bit further for the cause but it seems I have to do that myself and lay out the answer here... *The root cause is that there is a flaw in the implementation of the cumulative normal CDF function such that the function f(x) is not monotonically increasing in x.* I'm not an expert in numerical analysis so I don't know what's wrong exactly with the implementation. But if we use the cdf function in boost::math, we fix the problem. A sketch of code below (assuming discount factor 1.0): // Compute call value manually. double d1 = std::log(F/K)/(sigma*sqrt(T)) + 0.5*sigma*sqrt(T); double d2 = d1 - sigma*sqrt(T); boost::math::normal N; double nd1 = boost::math::cdf(N, d1); double nd2 = boost::math::cdf(N, d2); double c = F * nd1 - K * nd2; |