1
0

Test NAN and inf.

This commit is contained in:
Captain ALM 2022-08-14 22:01:30 +01:00
parent c87d8b9bd1
commit 4eb93057a9
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -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;
}