
The following is an excerpt from the random_test.cpp file (part of the instantiate_urng function): urng2 = urng; { // narrow stream first std::ostringstream file; file << urng; // move forward urng(); // restore old state std::istringstream input(file.str()); input >> urng; // std::cout << file.str() << std::endl; #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // MSVC brokenness // advance some more so that state is exercised for(int i = 0; i < 10000; ++i) { urng(); urng2(); } BOOST_CHECK(urng == urng2); #endif // BOOST_MSVC } My concern is that when a random number generator with an underlying double type (like fibonacci607) is stored to the stream and then pulled back out, then precision may be lost, and the underlying data is not guaranteed to be the same. If a double is written out to a stream in decimal form and then read back in the value may be changed. Am I missing some sort of language guarantee that this is supposed to work? I've tried this on AIX and the test failed at this point for fibonacci607 because some (but not all) of the underlying doubles had changed after the object was stored and retrieved. Thanks!