mirror of
https://github.com/ArashPartow/exprtk.git
synced 2025-06-12 16:27:23 +00:00
C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html
This commit is contained in:
22
exprtk.hpp
22
exprtk.hpp
@ -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)
|
||||
|
Reference in New Issue
Block a user