Skip to content

Instantly share code, notes, and snippets.

@visualzhou
Created November 27, 2012 04:29
Show Gist options
  • Save visualzhou/4152368 to your computer and use it in GitHub Desktop.
Save visualzhou/4152368 to your computer and use it in GitHub Desktop.
C++ presicion
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace std;
int main() {
std::string str = "2.492089450701739E62";
double d;
stringstream ss;
ss << str;
ss >> d;
std::cout << std::setprecision(15) << d << std::endl;
std::cout << std::setprecision(15) << 1.0 / 3 << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment