#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <limits>
using namespace std;

int main() {
	const float x = 10.0000095;
	const float y = 10.0000105;
	
	// Default precision
	{
		stringstream def_prec;
		
		// Write to string
		def_prec << x <<" "<<y;
		
		// What was written ?
		cout <<def_prec.str()<<endl;
		
		// Read back
		float x2, y2;
		def_prec>>x2 >>y2;
		
		// Check
		printf("%.8f vs %.8f\n", x, x2);
		printf("%.8f vs %.8f\n", y, y2);
	}
	
	cout<<endl;
	
	// Using max_digits10
	const int digits_max = numeric_limits<float>::max_digits10;
	{
		stringstream max_prec;
		max_prec << setprecision(digits_max) << x <<" "<<y;
		// What was written ?
		cout <<max_prec.str()<<endl;
		
		// Read back
		float x2, y2;
		max_prec>>x2 >>y2;
		
		// Check
		printf("%.8f vs %.8f\n", x, x2);
		printf("%.8f vs %.8f\n", y, y2);
	}
	
	cout<<endl;
	
	{
		stringstream some_prec;
		some_prec << setprecision(digits_max-1) << x <<" "<<y;
		// What was written ?
		cout <<some_prec.str()<<endl;
		
		// Read back
		float x2, y2;
		some_prec>>x2 >>y2;
		
		// Check
		printf("%.8f vs %.8f\n", x, x2);
		printf("%.8f vs %.8f\n", y, y2);
	}

}