Created
September 26, 2015 10:13
-
-
Save kaskavalci/303cd56b0a9bda67decb to your computer and use it in GitHub Desktop.
This file contains 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
void smallerF() | |
{ | |
cout << "MIN FLOAT test" << endl; | |
errno = 0; | |
stringstream ss; | |
ss << "1.17549430e-39"; | |
cout << "Min possible :\t" << FLT_MIN << endl; | |
cout << "str: \t\t" << ss.str() << endl; | |
float converted = strtof(ss.str().c_str(), NULL); | |
cout << "Error: \t\t" << (errno == ERANGE ? "Range error" : "No error") << endl; | |
cout << "Converted: \t" << converted << endl; | |
cout << "Normal :\t" << (isnormal(converted) ? "True" : "False") << endl; | |
cout << "Comparison: \t" << (converted < FLT_MIN ? "smaller" : "greater or equal") << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment