C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow
2013-10-25 08:02:51 +11:00
parent 58c2b0805e
commit 8bad05fa8c
3 changed files with 11 additions and 15 deletions

View File

@ -248,11 +248,6 @@ namespace exprtk
return data_;
}
inline operator const char* () const
{
return data_.data();
}
private:
std::string data_;
@ -417,6 +412,8 @@ namespace exprtk
10000000000000000.0,
};
static const std::size_t pow10_size = sizeof(pow10) / sizeof(double);
namespace numeric
{
namespace constant
@ -607,14 +604,13 @@ namespace exprtk
return ((v < T(0)) ? std::ceil(v - T(0.5)) : std::floor(v + T(0.5)));
}
template <typename T>
inline T roundn_impl(const T v0, const T v1, real_type_tag)
{
// 0 <= index <= sizeof(pow10)
const int index = std::max<int>(0,std::min<int>(sizeof(pow10),(int)std::floor(v1)));
const T p10 = pow10[index];
return T(std::floor((v0 * p10) + T(0.5)) / p10);
}
template <typename T>
inline T roundn_impl(const T v0, const T v1, real_type_tag)
{
const int index = std::max<int>(0, std::min<int>(pow10_size - 1, (int)std::floor(v1)));
const T p10 = T(pow10[index]);
return T(std::floor((v0 * p10) + T(0.5)) / p10);
}
template <typename T>
inline T roundn_impl(const T v0, const T, int_type_tag)