Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExprTk with increased precision

Tags:

I am trying to compile the ExprTk library with more precision than long double. I thought the simplist would be to try GCC's __float128 but I am getting the following compilation error and am not sure how to correct it.

exprtk.hpp: In instantiation of ‘static T exprtk::details::and_op<T>::process(exprtk::details::and_op<T>::Type, exprtk::details::and_op<T>::Type) [with T = __float128; exprtk::details::and_op<T>::Type = const __float128&]’:
exprtk.hpp:28439:10:   required from ‘void exprtk::parser<T>::load_binary_operations_map(exprtk::parser<T>::binary_op_map_t&) [with T = __float128; exprtk::parser<T>::binary_op_map_t = std::map<exprtk::details::operator_type, __float128 (*)(const __float128&, const __float128&), std::less<exprtk::details::operator_type>, std::allocator<std::pair<const exprtk::details::operator_type, __float128 (*)(const __float128&, const __float128&)> > >; typename exprtk::details::functor_t<T>::bfunc_t = __float128 (*)(const __float128&, const __float128&)]’
exprtk.hpp:15660:51:   required from ‘exprtk::parser<T>::parser(std::size_t) [with T = __float128; std::size_t = long unsigned int]’
mathtof.cpp:18:33:   required from here
exprtk.hpp:9923:105: error: call of overloaded ‘is_true(const __float128&)’ is ambiguous
          static inline T process(Type t1, Type t2) { return (details::is_true(t1) && details::is_true(t2)) ? T(1) : T(0); }
                                                                                                         ^
compilation terminated due to -Wfatal-errors.

EDIT:

I've tried implementing my own is_true

<typename T>
inline bool is_true(const T v)
{
    return std::not_equal_to<T>()(T(0),v);
}