|
Boost : |
Subject: [boost] [math] potentian bug: iround throws, given double( numeric_limits<int>::min() )
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2011-10-11 14:09:49
Hello,
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?
<code>
#include <boost/math/special_functions/round.hpp>
#include <cassert>
#include <limits>
int main()
{
int const i = std::numeric_limits<int>::min();
double const x = i;
assert( i == boost::math::iround(x) );
}
</code>
Regards
Kris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk