Boost logo

Boost Users :

Subject: Re: [Boost-users] [numeric conversation] behavior on std::numeric_limits<double>::max() + eps with numeric_cast
From: Brandon Kohn (blkohn_at_[hidden])
Date: 2014-06-09 08:06:01


On 6/9/2014 02:53 AM, Olaf Peter wrote:
> std::cout << boost::numeric_cast<double>(z) << '\n';
>
> I would expect that an exception is thrown which isn't, the output is
> 1.79769e+308
> 1.79769e+308

In the case of conversion to the same type I believe a trivial fall
through is done which just returns the value, so this is the expected
behavior.

>
> and as second: If I write my onw UDT as shown in the tutorial like:
>
> it doesn't change the result - is this the right way?
>
It's hard for me to tell just from the code snippets you've provided.
Could you send me a small test which shows the problem you're having?

Thanks,

Brandon Kohn


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net