• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  (C) Copyright John Maddock 2005.
2 //  Use, modification and distribution are subject to the
3 //  Boost 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 #ifndef NTL_STD_CXX
7 #  define NTL_STD_CXX
8 #endif
9 
10 #include <iostream>
11 #include <iomanip>
12 #include "mp_t.hpp"
13 
log1p(mp_t arg)14 mp_t log1p(mp_t arg)
15 {
16    return log(arg + 1);
17 }
18 
expm1(mp_t arg)19 mp_t expm1(mp_t arg)
20 {
21    return exp(arg) - 1;
22 }
23 
main()24 int main()
25 {
26    mp_t r, root_two;
27    r = 1.0;
28    root_two = 2.0;
29    root_two = sqrt(root_two);
30    r /= root_two;
31    mp_t lim = pow(mp_t(2), mp_t(-128));
32    std::cout << std::scientific << std::setprecision(40);
33    while(r > lim)
34    {
35       std::cout << "   { " << r << "L, " << log1p(r) << "L, " << expm1(r) << "L, }, \n";
36       std::cout << "   { " << -r << "L, " << log1p(-r) << "L, " << expm1(-r) << "L, }, \n";
37       r /= root_two;
38    }
39    return 0;
40 }
41 
42