Gregorian Bad Year exception error: please help!

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

Gregorian Bad Year exception error: please help!

Amine Ifri
Hi Community,

I am writing a small interface for a simulation time axis for exposures using QL. To keep the question short, I show below the function where error is reported: 

        inline SimulationTimeAxis& SimulationTimeAxis::MergeWithOtherTimeAxis(const SimulationTimeAxis& other_axis)
        {
            exposure_dates_.insert(exposure_dates_.end(), (other_axis.exposure_dates()).begin(),
                                   (other_axis.exposure_dates()).end());
            std::sort(exposure_dates_.begin(),exposure_dates_.end());
            std::unique(exposure_dates_.begin(), exposure_dates_.end());
            return(*this);
        }

I get the following exception error message when testing the method:

exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >: Year is out of valid range: 1400..10000

And I was wondering whether anyone had already come across such error in the past. Your help is much appreciated.

Thanks,
Amine


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Gregorian Bad Year exception error: please help!

Luigi Ballabio
Apologies if I'm asking the obvious, but did you check the dates in your axes? Are they all valid dates between years 1400 and 10000?

Luigi


On Thu, Jul 27, 2017 at 1:57 PM Amine Ifri <[hidden email]> wrote:
Hi Community,

I am writing a small interface for a simulation time axis for exposures using QL. To keep the question short, I show below the function where error is reported: 

        inline SimulationTimeAxis& SimulationTimeAxis::MergeWithOtherTimeAxis(const SimulationTimeAxis& other_axis)
        {
            exposure_dates_.insert(exposure_dates_.end(), (other_axis.exposure_dates()).begin(),
                                   (other_axis.exposure_dates()).end());
            std::sort(exposure_dates_.begin(),exposure_dates_.end());
            std::unique(exposure_dates_.begin(), exposure_dates_.end());
            return(*this);
        }

I get the following exception error message when testing the method:

exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >: Year is out of valid range: 1400..10000

And I was wondering whether anyone had already come across such error in the past. Your help is much appreciated.

Thanks,
Amine

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Gregorian Bad Year exception error: please help!

Amine Ifri
Hi Luigi,

I checked the dates on both axes. They are all valid and go on to 2037. For some reason, std::vector::insert is not working properly on them.
We shouldn’t have any problem on the sort method since Date class is already endowed with a < comparison operator.

Thanks for the advise.
Amine

On 27 Jul 2017, at 13:30, Luigi Ballabio <[hidden email]> wrote:

Apologies if I'm asking the obvious, but did you check the dates in your axes? Are they all valid dates between years 1400 and 10000?

Luigi


On Thu, Jul 27, 2017 at 1:57 PM Amine Ifri <[hidden email]> wrote:
Hi Community,

I am writing a small interface for a simulation time axis for exposures using QL. To keep the question short, I show below the function where error is reported: 

        inline SimulationTimeAxis& SimulationTimeAxis::MergeWithOtherTimeAxis(const SimulationTimeAxis& other_axis)
        {
            exposure_dates_.insert(exposure_dates_.end(), (other_axis.exposure_dates()).begin(),
                                   (other_axis.exposure_dates()).end());
            std::sort(exposure_dates_.begin(),exposure_dates_.end());
            std::unique(exposure_dates_.begin(), exposure_dates_.end());
            return(*this);
        }

I get the following exception error message when testing the method:

exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >: Year is out of valid range: 1400..10000

And I was wondering whether anyone had already come across such error in the past. Your help is much appreciated.

Thanks,
Amine

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Gregorian Bad Year exception error: please help!

Luigi Ballabio
That's weird.  May you try debugging the program and see what is happening when the exception is thrown?

Luigi


On Thu, Jul 27, 2017 at 4:15 PM Amine Ifri <[hidden email]> wrote:
Hi Luigi,

I checked the dates on both axes. They are all valid and go on to 2037. For some reason, std::vector::insert is not working properly on them.
We shouldn’t have any problem on the sort method since Date class is already endowed with a < comparison operator.

Thanks for the advise.
Amine

On 27 Jul 2017, at 13:30, Luigi Ballabio <[hidden email]> wrote:

Apologies if I'm asking the obvious, but did you check the dates in your axes? Are they all valid dates between years 1400 and 10000?

Luigi


On Thu, Jul 27, 2017 at 1:57 PM Amine Ifri <[hidden email]> wrote:
Hi Community,

I am writing a small interface for a simulation time axis for exposures using QL. To keep the question short, I show below the function where error is reported: 

        inline SimulationTimeAxis& SimulationTimeAxis::MergeWithOtherTimeAxis(const SimulationTimeAxis& other_axis)
        {
            exposure_dates_.insert(exposure_dates_.end(), (other_axis.exposure_dates()).begin(),
                                   (other_axis.exposure_dates()).end());
            std::sort(exposure_dates_.begin(),exposure_dates_.end());
            std::unique(exposure_dates_.begin(), exposure_dates_.end());
            return(*this);
        }

I get the following exception error message when testing the method:

exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >: Year is out of valid range: 1400..10000

And I was wondering whether anyone had already come across such error in the past. Your help is much appreciated.

Thanks,
Amine

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users