]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Copyright 2020 John Maddock. Distributed under the Boost | |
3 | // Software License, Version 1.0. (See accompanying file | |
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #include <boost/multiprecision/mpfr.hpp> | |
7 | #include <boost/math/special_functions/next.hpp> | |
8 | #include "test.hpp" | |
9 | ||
10 | using namespace boost::multiprecision; | |
11 | ||
12 | int main() | |
13 | { | |
14 | mpfr_float_50 half = 0.5; | |
15 | mpfr_float_50 under_half = boost::math::float_prior(half); | |
16 | BOOST_CHECK_NE(half, under_half); | |
17 | int e1, e2; | |
18 | mpfr_float_50 norm1, norm2; | |
19 | norm1 = frexp(half, &e1); | |
20 | norm2 = frexp(under_half, &e2); | |
21 | BOOST_CHECK_EQUAL(norm1, half); | |
22 | BOOST_CHECK_EQUAL(e1, 0); | |
23 | BOOST_CHECK_GT(1, norm2); | |
24 | BOOST_CHECK_LE(0.5, norm2); | |
25 | BOOST_CHECK_EQUAL(e2, -1); | |
26 | return boost::report_errors(); | |
27 | } |