#include #include #include #include #include using namespace std; int main() { float f; long double bigNumber; numeric_limitsfloatInfo; numeric_limitsldInfo; cout << "\tThe size of a float is " << sizeof(float) << endl; cout << "\tThe size of a float is " << sizeof(f) << endl; cout << "\tThe size of a double is " << sizeof(double) << endl; cout << "\tThe size of a long double is " << sizeof(long double) << endl; cout << endl; // limits cout << "The smallest float is " << floatInfo.min() << endl; cout << "The largest float is " << floatInfo.max() << endl; bigNumber = floatInfo.max(); // overflow cout << bigNumber << " + 1 = " << bigNumber+1 << endl; cout << "An exmpal of gap " << endl; long double biggerNumber = bigNumber + 1; cout << bigNumber << " - " << biggerNumber << " = " << bigNumber-biggerNumber << endl; cout << endl << endl; cout << "At 1, the next float is " << floatInfo.epsilon() << endl; cout << "At 1, the next ld is " << ldInfo.epsilon() << endl; cout << "Everything between this and 1 is in the GAP" << endl; cout << endl << endl; cout << "The largest long double is " << ldInfo.max() << endl; cout << "The smallest long double is " << ldInfo.min() << endl; cout << "The closest to zero long double is " << ldInfo.denorm_min() << endl; cout << endl; cout << "minimum exponent for ld " << ldInfo.min_exponent << endl ; cout << "minimum exponent for float " << floatInfo.min_exponent << endl; cout << endl << endl; cout << "0/0 " << float(0) / float(0) << endl; cout << "7/0 " << 7.0/0.0 << endl; cout << "-7/0 " << -7.0/0.0 << endl; cout << endl << endl; cout << "Pi = " << M_PI << endl; return 0; }