1 | #include <boost/math/tr1.hpp>
|
---|
2 | #include <math.h>
|
---|
3 | #include <iostream>
|
---|
4 |
|
---|
5 | int main()
|
---|
6 | {
|
---|
7 | double inf = 1.0/0.0;
|
---|
8 | double minf = (-1.0)/0.0;
|
---|
9 |
|
---|
10 | std::cout << "value just before inf (should be valmax)" << std::endl;
|
---|
11 | std::cout << "libc: " << ::nextafter(inf, 0) << std::endl;
|
---|
12 | std::cout << "boost.math: " << boost::math::tr1::nextafter(inf, 0) << std::endl;
|
---|
13 | std::cout << std::endl;
|
---|
14 |
|
---|
15 | std::cout << "value just after minf (should be valmin)" << std::endl;
|
---|
16 | std::cout << "libc: " << ::nextafter(minf, 0) << std::endl;
|
---|
17 | std::cout << "boost.math: " << boost::math::tr1::nextafter(minf, 0) << std::endl;
|
---|
18 | std::cout << std::endl;
|
---|
19 | }
|
---|