#include <boost/cstdlib.hpp>
#include <boost/config.hpp>
#include <boost/array.hpp>
-#include <boost/type_traits/is_floating_point.hpp>
-#include <boost/type_traits/is_fundamental.hpp>
-
#include "table_type.hpp"
// Copy of i:\modular-boost\libs\math\test\table_type.hpp
// #include "handle_test_result.hpp"
#include <fstream> // std::ofstream
#include <cmath>
#include <typeinfo> // for type name using typid(thingy).name();
+#include <type_traits>
#ifndef BOOST_ROOT
# define BOOST_ROOT i:/modular-boost/
int get_digits; // fraction of maximum possible accuracy required.
// = digits * digits_accuracy
// Vector of values for each algorithm, std::cbrt, boost::math::cbrt, TOMS748, Newton, Halley.
- //std::vector< boost::int_least64_t> times; converted to int.
+ //std::vector< std::int_least64_t> times; converted to int.
std::vector<int> times;
- //boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times (as int).
+ //std::int_least64_t min_time = std::numeric_limits<std::int_least64_t>::max(); // Used to normalize times (as int).
std::vector<double> normed_times;
- boost::int_least64_t min_time = (std::numeric_limits<boost::int_least64_t>::max)(); // Used to normalize times.
+ std::int_least64_t min_time = (std::numeric_limits<std::int_least64_t>::max)(); // Used to normalize times.
std::vector<uintmax_t> iterations;
std::vector<long int> distances;
std::vector<cpp_bin_float_100> full_results;
// Maybe guess should be double, or use enable_if to avoid warning about conversion double to float here?
T guess;
- if (boost::is_fundamental<T>::value)
+ if (std::is_fundamental<T>::value)
{
int exponent;
frexp(x, &exponent); // Get exponent of z (ignore mantissa).
T factor = 2; // How big steps to take when searching.
- const boost::uintmax_t maxit = 50; // Limit to maximum iterations.
- boost::uintmax_t it = maxit; // Initially our chosen max iterations, but updated with actual.
+ const std::uintmax_t maxit = 50; // Limit to maximum iterations.
+ std::uintmax_t it = maxit; // Initially our chosen max iterations, but updated with actual.
bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess.
// Some fraction of digits is used to control how accurate to try to make the result.
int get_digits = static_cast<int>(std::numeric_limits<T>::digits - 2);
using namespace boost::math::tools;
int exponent;
T guess;
- if(boost::is_fundamental<T>::value)
+ if(std::is_fundamental<T>::value)
{
frexp(x, &exponent); // Get exponent of z (ignore mantissa).
guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
T min = guess / 2; // Minimum possible value is half our guess.
T max = 2 * guess; // Maximum possible value is twice our guess.
int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.6);
- const boost::uintmax_t maxit = 20;
- boost::uintmax_t it = maxit;
+ const std::uintmax_t maxit = 20;
+ std::uintmax_t it = maxit;
T result = newton_raphson_iterate(cbrt_functor_deriv<T>(x), guess, min, max, get_digits, it);
iters = it;
return result;
using namespace boost::math::tools;
int exponent;
T guess;
- if(boost::is_fundamental<T>::value)
+ if(std::is_fundamental<T>::value)
{
frexp(x, &exponent); // Get exponent of z (ignore mantissa).
guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
T max = 2 * guess; // Maximum possible value is twice our guess.
// digits used to control how accurate to try to make the result.
int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.4);
- boost::uintmax_t maxit = 20;
- boost::uintmax_t it = maxit;
+ std::uintmax_t maxit = 20;
+ std::uintmax_t it = maxit;
T result = halley_iterate(cbrt_functor_2deriv<T>(x), guess, min, max, get_digits, it);
iters = it;
return result;
using namespace boost::math::tools;
int exponent;
T guess;
- if(boost::is_fundamental<T>::value)
+ if(std::is_fundamental<T>::value)
{
frexp(x, &exponent); // Get exponent of z (ignore mantissa).
guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
T max = 2 * guess; // Maximum possible value is twice our guess.
// digits used to control how accurate to try to make the result.
int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.4);
- const boost::uintmax_t maxit = 20;
- boost::uintmax_t it = maxit;
+ const std::uintmax_t maxit = 20;
+ std::uintmax_t it = maxit;
T result = schroder_iterate(cbrt_functor_2deriv<T>(x), guess, min, max, get_digits, it);
iters = it;
return result;