rounding error in distribution.cpp

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

rounding error in distribution.cpp

leibniz777
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: rounding error in distribution.cpp

japari
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
Reply | Threaded
Open this post in threaded view
|

Re: rounding error in distribution.cpp

Luigi Ballabio
On Thu, 2009-09-10 at 09:58 +0200, Jose Aparicio-Navarro wrote:
> Quoting Oliver Klehn <[hidden email]>:
>
> > 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: rounding error in distribution.cpp

leibniz777
In reply to this post by japari
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
Reply | Threaded
Open this post in threaded view
|

Re: rounding error in distribution.cpp

Luigi Ballabio
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

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

leibniz777
In reply to this post by leibniz777
 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