https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82502

            Bug ID: 82502
           Summary: Cannot roundtrip / stream-read a hexfloat double.
           Product: gcc
           Version: 6.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maxim.yegorushkin at gmail dot com
  Target Milestone: ---

The following code successfully outputs double's in hexfloat format, but it
cannot read them back:

    #include <sstream>
    #include <iostream>
    #include <iomanip>

    int main() {
        std::cout << "Writing:\n";
        std::stringstream ss;
        ss << std::hexfloat << 1 << '\n' << 2 << '\n' << 1.234 << '\n' << 5.678
<< '\n';
        std::cout << ss.str() << "Reading:\n";
        ss >> std::hexfloat;
        for(double d; ss >> d;)
            std::cout << d << '\n';
    }

It outputs:

    Writing:
    1
    2
    0x1.3be76c8b43958p+0
    0x1.6b645a1cac083p+2
    Reading:
    1
    2
    0

Looks like this issue is related to
https://cplusplus.github.io/LWG/lwg-active.html#2381

Reply via email to