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()
|
int main()
|
||||||
{
|
{
|
||||||
std::cout << "bool:\t\t" << sizeof(bool) << " bytes\n";
|
double zero {0.0};
|
||||||
std::cout << "char:\t\t" << sizeof(char) << " bytes\n";
|
double posinf { 5.0 / zero }; // positive infinity
|
||||||
std::cout << "wchar_t:\t" << sizeof(wchar_t) << " bytes\n";
|
std::cout << posinf << '\n';
|
||||||
std::cout << "char16_t:\t" << sizeof(char16_t) << " bytes\n";
|
|
||||||
std::cout << "char32_t:\t" << sizeof(char32_t) << " bytes\n";
|
double neginf { -5.0 / zero }; // negative infinity
|
||||||
std::cout << "short:\t\t" << sizeof(short) << " bytes\n";
|
std::cout << neginf << '\n';
|
||||||
std::cout << "int:\t\t" << sizeof(int) << " bytes\n";
|
|
||||||
std::cout << "long:\t\t" << sizeof(long) << " bytes\n";
|
double nan { zero / zero }; // not a number (mathematically invalid)
|
||||||
std::cout << "long long:\t" << sizeof(long long) << " bytes\n";
|
std::cout << nan << '\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";
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user