[Boost-bugs] [Boost C++ Libraries] #6280: numeric_cast throws on exactly representable conversion

Subject: [Boost-bugs] [Boost C++ Libraries] #6280: numeric_cast throws on exactly representable conversion
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-16 21:53:37


#6280: numeric_cast throws on exactly representable conversion
----------------------------------------------------+-----------------------
 Reporter: Simeon Maxein <smaxein@…> | Owner: dgregor
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: numeric
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
----------------------------------------------------+-----------------------
 If a double or float representing the smallest possible value of int64_t
 is cast to int64_t using numeric_cast, an exception is thrown saying that
 a negative overflow has occured.

 I would expect the cast to work, since the value is exactly representable
 in the target type. Since the absolute value is a power of two, there
 should not be any error in the floating point representation.

 This is also reproducable in trunk, according to VeXocide. I found the
 problem in Boost 1.47.0 on Windows, using MinGW 4.5.2.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6280>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC