Subject: [Boost-bugs] [Boost C++ Libraries] #8745: stream operator << for number/cpp_int_backend with 8 bit or less precision not working
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-28 16:29:48
#8745: stream operator << for number/cpp_int_backend with 8 bit or less precision
not working
-------------------------------------------------+-------------------------
Reporter: neal.p.smith@⦠| Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component:
Version: Boost 1.53.0 | multiprecision
Keywords: multiprecision cpp_int_backend | Severity: Problem
stream |
-------------------------------------------------+-------------------------
for 8 bit or less numbers << with hex format sets characters to the
numeric value of their digit rather than the ascii value. ie if the
character should be 'F' the returned value is 15 rather than the ASCII
value for F.
number<cpp_int_backend<7, 7, unsigned_magnitude, unchecked, void>>
myNum07( "0xF");
number<cpp_int_backend<8, 8, unsigned_magnitude, unchecked, void>>
myNum08( "0x0F");
number<cpp_int_backend<9, 9, unsigned_magnitude, unchecked, void>>
myNum09( "0x0F");
number<cpp_int_backend<16, 16, unsigned_magnitude, unchecked, void>>
myNum16("0x000F");
char outBuf[1000];
std::stringstream ss;
ss << setfill('0');
ss << "7 bit : " << std::setw(2) << std::hex << myNum07 << endl;
ss << "8 bit : " << std::setw(2) << std::hex << myNum08 << endl;
ss << "9 bit : " << std::setw(2) << std::hex << myNum09 << endl;
ss << "16 bit: " << std::setw(2) << std::hex << myNum16 << endl;
strncpy(outBuf, ss.str().c_str(), 999);
printf("%s\n", outBuf);
output is:
----------
7 bit : 0â¼
8 bit : 0â¼
9 bit : 0f
16 bit: 0f
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8745> 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:13 UTC