#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

void foo( const double d )
{
    const double rounded_2_decimals = std::round(d*100.0) / 100.0;
    std::cout << "d=" << std::setprecision(9) <<  d << std::endl;
    std::cout << "r=" << std::setprecision(9) << rounded_2_decimals << std::endl;
}

int main() {
	// your code goes here
	double d = 3.1249999;

    foo(d);

	return 0;
}