Bugs item #3417114, was opened at 2011-10-02 15:52
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3417114&group_id=12740Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: R Y (fancidev)
Assigned to: Nobody/Anonymous (nobody)
Summary: BS call option price lower than intrinsic value
Initial Comment:
Compile and run the following program in Visual Studio 2010 produces the bug.
#include <iostream>
#include <ql/pricingengines/blackformula.hpp>
using namespace QuantLib;
static void TestBlackScholesBound()
{
double F = 1.35;
double K = 0.39;
double stdev = 0.12;
double c = blackFormula(Option::Call, K, F, stdev);
if (c < (F - K))
{
std::cerr << "Error: Option price = " << c << ", Lower Bound = "
<< (F - K) << std::endl;
}
}
int main()
{
TestBlackScholesBound();
system("PAUSE");
}
----------------------------------------------------------------------
>Comment By: Luigi Ballabio (lballabio)
Date: 2011-10-03 12:16
Message:
That also happens with g++ on Linux, but it's only caused by floating-point
precision issues. If you print out the values with more precision, you'll
find:
Option price = 0.95999999999999996447
Lower Bound = 0.9600000000000000755
due to the fact that you can't store 0.96, nor 1.35, nor 0.39 in a
floating-point number exactly. Also, if you write the check as:
if (c < 0.96)
instead of
if (c < (F - K))
the test passes.
That's not something we can fix on the library side, and adding a check
might just cause false positives.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3417114&group_id=12740------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev