Re: [Boost-bugs] [Boost C++ Libraries] #13503: Boost.Multiprecision generates incorrect code

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13503: Boost.Multiprecision generates incorrect code
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-03-31 21:57:48


#13503: Boost.Multiprecision generates incorrect code
-----------------------------------------+----------------------------
  Reporter: Sam Lunt <samuel.j.lunt@…> | Owner: John Maddock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: multiprecision
   Version: Boost 1.64.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------+----------------------------

Comment (by Sam Lunt <samuel.j.lunt@…>):

 Looking at the standard, it seems that conversion to signed type is
 implementation defined, but for conversion to unsigned, truncation is
 mandated.

 This is from section 4.7.2 and 4.7.3 [conv.integral]:

 2. If the destination type is unsigned, the resulting value is the least
 unsigned integer congruent to the source integer (modulo 2^n^ where n is
 the number of bits used to represent the unsigned type). [Note: In a two’s
 complement representation, this conversion is conceptual and there is no
 change in the bit pattern (if there is no truncation). — end note]

 3. If the destination type is signed, the value is unchanged if it can be
 represented in the destination type; otherwise, the value is
 implementation-defined.

 Is it possible to change the behavior to match the standard? I can image
 there could be some concern about a behavior change, but I'd wonder how
 many people are depending on this behavior and how many expect truncation
 but get saturation.

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13503#comment:2>
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 : 2018-03-31 22:03:57 UTC