Test NAN and inf.
This commit is contained in:
parent
c87d8b9bd1
commit
4eb93057a9
23
main.cpp
23
main.cpp
@ -2,18 +2,15 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "bool:\t\t" << sizeof(bool) << " bytes\n";
|
||||
std::cout << "char:\t\t" << sizeof(char) << " bytes\n";
|
||||
std::cout << "wchar_t:\t" << sizeof(wchar_t) << " bytes\n";
|
||||
std::cout << "char16_t:\t" << sizeof(char16_t) << " bytes\n";
|
||||
std::cout << "char32_t:\t" << sizeof(char32_t) << " bytes\n";
|
||||
std::cout << "short:\t\t" << sizeof(short) << " bytes\n";
|
||||
std::cout << "int:\t\t" << sizeof(int) << " bytes\n";
|
||||
std::cout << "long:\t\t" << sizeof(long) << " bytes\n";
|
||||
std::cout << "long long:\t" << sizeof(long long) << " bytes\n";
|
||||
std::cout << "float:\t\t" << sizeof(float) << " bytes\n";
|
||||
std::cout << "double:\t\t" << sizeof(double) << " bytes\n";
|
||||
std::cout << "long double:\t" << sizeof(long double) << " bytes\n";
|
||||
std::cout << "std::size_t:\t" << sizeof(std::size_t) << " bytes\n";
|
||||
double zero {0.0};
|
||||
double posinf { 5.0 / zero }; // positive infinity
|
||||
std::cout << posinf << '\n';
|
||||
|
||||
double neginf { -5.0 / zero }; // negative infinity
|
||||
std::cout << neginf << '\n';
|
||||
|
||||
double nan { zero / zero }; // not a number (mathematically invalid)
|
||||
std::cout << nan << '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user