rounding error in distribution.cpp

View: New views
6 Messages — Rating Filter:   Alert me  

rounding error in distribution.cpp

by leibniz777 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
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
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: rounding error in distribution.cpp

by Jose Aparicio-Navarro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Quoting Oliver Klehn <oklehn@...>:

> 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
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: rounding error in distribution.cpp

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-09-10 at 09:58 +0200, Jose Aparicio-Navarro wrote:
> Quoting Oliver Klehn <oklehn@...>:
>
> > 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.

Possibly. I've fixed the requirement anyway.

Luigi


--

It is better to know some of the questions than all of the answers.
-- James Thurber



------------------------------------------------------------------------------
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
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: rounding error in distribution.cpp

by leibniz777 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have not this version of the constructor. Where can I find it?



Jose Aparicio-Navarro wrote:
Quoting Oliver Klehn <oklehn@gmx.de>:

> 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
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: rounding error in distribution.cpp

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-09-10 at 02:05 -0700, leibniz777 wrote:
> I have not this version of the constructor. Where can I find it?

>From the Subversion repository (see <http://quantlib.org/svn.shtml>.)

Luigi


--

Better to have an approximate answer to the right question than a
precise answer to the wrong question.
-- John Tukey as quoted by John Chambers



------------------------------------------------------------------------------
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
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: rounding error in distribution.cpp already fixed in 16341

by leibniz777 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 With the fix in 16341 there seem to be so such errors anymore.



leibniz777 wrote:
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.
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
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
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users