29 #include <boost/format.hpp>
30 #include <boost/math/constants/constants.hpp>
31 #include <boost/math/special_functions/next.hpp>
48 cout <<
"================================================================================" << endl;
49 cout <<
"Float:" << endl;
50 cout <<
"--------------------------------------------------------------------------------" << endl;
55 cout <<
"================================================================================" << endl;
56 cout <<
"Double:" << endl;
57 cout <<
"--------------------------------------------------------------------------------" << endl;
100 template <
typename T>
110 template <
typename T>
113 using boost::math::float_next;
123 auto zero = Zero<T>();
124 auto zeroplus = float_next(zero);
125 auto nextafterzero = nextafter(zero, Two<T>());
126 auto nextzerotoward = nexttoward(zero, Two<T>());
128 cout <<
"zero: " << zero << endl;
129 cout <<
"next to zero: " << zeroplus << endl;
130 cout <<
"next after zero: " << nextafterzero << endl;
131 cout <<
"next after zero toward two: " << nextzerotoward << endl;
134 auto oneplus = float_next(one);
135 auto nextafterone = nextafter(one, Two<T>());
136 auto nextonetoward = nexttoward(one, Two<T>());
137 auto cospiover7 = cos(pi<T>() / Seven<T>());
138 auto default_test_tolerance = pow(Ten<T>(), -numeric_limits<T>::digits10);
140 cout <<
"one: " << one << endl;
141 cout <<
"next to one: " << oneplus << endl;
142 cout <<
"next after one: " << nextafterone << endl;
143 cout <<
"next after one toward two: " << nextonetoward << endl;
145 cout <<
"pi: " << pi<T>() << endl;
146 cout <<
"the Cosine of pi/7: " << cospiover7 << endl;
147 cout <<
"the default test tolerance: " << default_test_tolerance << endl;
149 cout <<
"The mantissa digits: " << numeric_limits<T>::digits << endl;
150 cout <<
"The decimal digits: " << numeric_limits<T>::digits10 << endl;
151 cout <<
"The epsilon: " << numeric_limits<T>::epsilon() << endl;
152 cout <<
"The minimum exponent: " << numeric_limits<T>::min_exponent << endl;
153 cout <<
"The minimum decimal exponent: " << numeric_limits<T>::min_exponent10 << endl;
154 cout <<
"The maximum exponent: " << numeric_limits<float>::max_exponent << endl;
155 cout <<
"The maximum decimal exponent: " << numeric_limits<T>::max_exponent10 << endl;
156 cout <<
"The minimum: " << numeric_limits<T>::min() << endl;
157 cout <<
"The maximum: " << numeric_limits<T>::max() << endl;
158 cout <<
"The sizeof: " <<
sizeof(T) << endl;
159 cout <<
"The sizeof in bits: " << 8 *
sizeof(T) << endl;
169 printFloatPrecision<float>();
171 printFloatPrecision<double>();