Ticket #5823: nextafter_test.cpp

File nextafter_test.cpp, 652 bytes (added by Mathias Gaunard, 11 years ago)
Line 
1#include <boost/math/tr1.hpp>
2#include <math.h>
3#include <iostream>
4
5int 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}