Created
November 27, 2012 04:29
-
-
Save visualzhou/4152368 to your computer and use it in GitHub Desktop.
C++ presicion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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