-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage14.cpp
44 lines (40 loc) · 1.78 KB
/
page14.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <limits>
using namespace std;
int main(){
cout << "largest float = "
<< numeric_limits<float>::max() << endl;
cout << "smallest float = "
<< numeric_limits<float>::min() << endl;
cout << "min exponent in binary = "
<< numeric_limits<float>::min_exponent << endl;
cout << "min exponent in decimal = "
<< numeric_limits<float>::min_exponent10 << endl;
cout << "max exponent in binary = "
<< numeric_limits<float>::max_exponent << endl;
cout << "max exponent in decimal = "
<< numeric_limits<float>::max_exponent10 << endl;
cout << "# of binary digits in mantissa = "
<< numeric_limits<float>::digits << endl;
cout << "# of decimal digits in mantissa = "
<< numeric_limits<float>::digits10 << endl;
cout << "base of exponent in float: "
<< numeric_limits<float>::radix << endl;
cout << "infinity in float: "
<< numeric_limits<float>::infinity() << endl;
cout << "float epsilon = "
<< numeric_limits<float>::epsilon() << endl;
cout << "float rounding error = "
<< numeric_limits<float>::round_error() << endl;
cout << "float rounding style = "
<< numeric_limits<float>::round_style << endl;
cout << endl;
double smallestDouble = numeric_limits<double>::min();
double doubleEps = numeric_limits<double>::epsilon();
long double largestLongDouble = numeric_limits<long double>::max();
long double longDoubleEpsilon = numeric_limits<long double>::epsilon();
cout << "smallest double = " << smallestDouble << endl;
cout << "double epsilon = " << doubleEps << endl;
cout << "largest long double = " << largestLongDouble <<endl;
cout << "long double epsilon = " <<longDoubleEpsilon << endl;
}