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

            Bug ID: 125479
           Summary: stream operations piecewise distributions of float
                    type does not round trip
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkaminsk at gcc dot gnu.org
  Target Milestone: ---

The following programs returns 0, instead of 1:
#include <random>
#include <sstream>

int main()
{
  std::stringstream str;
  std::piecewise_constant_distribution<float>
     u(3, 0.0, 1.0, [](float r) -> float { return 1.0 + r; });
  str << u;

  std::piecewise_constant_distribution<float> v;
  str >> v;
  return u == v;
}

Link: https://godbolt.org/z/M9Ebcq5hj

Reply via email to