|
Boost : |
Subject: Re: [boost] [math] potentian bug: iround throws, given double( numeric_limits<int>::min() )
From: Mukkaysh Srivastav (srimks11_at_[hidden])
Date: 2011-10-20 03:11:43
Al,
I tried compiling and executing this code simply to understand the issues.
The compilation been successful but while executing I get below errors -
-----
$ ./test-3.exe
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost:
:exception_detail::error_info_injector<boost::math::rounding_error> >'
what(): Error in function boost::math::iround<d>(d): Value -2147483648
can not be represented in the target integer type.
Aborted (core dumped)
$
-----
Above was did tried on Cygwin platform (1.7.9(0.237/5/3) 2011-03-29 10:10
i686 Cygwin).
And on Ubuntu, I have same error message while executing -
-----
./test-1
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::math::rounding_error>
>'
what(): Error in function boost::math::iround<d>(d): Value -2147483648
can not be represented in the target integer type.
Aborted
-----
~ BR
-----
On Wed, Oct 12, 2011 at 4:38 PM, John Maddock <boost.regex_at_[hidden]>wrote:
> The docs of the Rounding Functions say:
>>
>> If the argument v is either non-finite or else outside the range of the
>> result type, then returns the result of rounding_error: by default this
>> throws an instance of boost::math::rounding_error.
>>
>> So the example shown below seems to show a bug, since
>> std::numeric_limits<int>::min(**) is *not* outside the range of int. Or
>> did I
>> miss something?
>>
>
> It's a bug: the error checking is off by one for negative values.
>
> Fixed in Trunk.
>
> Thanks, John.
>
> ______________________________**_________________
> Unsubscribe & other changes: http://lists.boost.org/**
> mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk