Re: rounding error in distribution.cpp

Posted by japari on
URL: http://quantlib.414.s1.nabble.com/rounding-error-in-distribution-cpp-tp7994p7996.html

Quoting Oliver Klehn <[hidden email]>:

> When using the synthetic cdo pricing engine sometimes there is thrown an
> error by the file Distribution::locate:
> Although it is true that "x >= x_.front() && x <= x_.back() + dx_.back()" in
> the QL_REQUIRE function sometimes there is thrown an error because the
> condition is not fulfilled due to rounding errors.

I am not 100% sure it is the same problem without sample code but there has been
a fix for this recently. Can you check out you have this version of the
constructor?:

    Distribution::Distribution (int nBuckets, Real xmin, Real xmax)
    //-------------------------------------------------------------------------
        : size_(nBuckets),
          xmin_(xmin), xmax_(xmax), count_(nBuckets),
[...]
        // ensure we match exactly the domain, otherwise we might fail the
        //   locate test because of precission mismatches
        dx_.back() = xmax - x_.back();
    }

Best regards
Pepe

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users