Login  Register

Re: Gregorian Bad Year exception error: please help!

Posted by Amine Ifri on Jul 27, 2017; 2:07pm
URL: http://quantlib.414.s1.nabble.com/Gregorian-Bad-Year-exception-error-please-help-tp18451p18457.html

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