7#if defined(KSeExpr_HAVE_CHARCONV_WITH_DOUBLES)
14 auto [
p, ec] = std::from_chars(num, num + std::strlen(num), v);
15 if (ec == std::errc()) {
25 auto [
p, ec] = std::from_chars(num.data(), num.data() + num.size(), v);
26 if (ec == std::errc()) {
36 auto [
p, ec] = std::from_chars(num.data(), num.data() + num.size(), v);
37 if (ec == std::errc()) {
39 }
else if (ec == std::errc::result_out_of_range) {
40 throw std::out_of_range {
"KSeExpr::Utils::strtol: out of range"};
42 throw std::invalid_argument {
"KSeExpr::Utils::strtol: impossible to parse the given number"};
67 }
else if (*
num ==
'+') {
71 while (*
num !=
'\0') {
72 if (*
num >=
'0' && *
num <=
'9') {
74 }
else if (*
num ==
'.') {
78 }
else if (*
num ==
'e') {
91 while (*
num !=
'\0') {
92 if (*
num >=
'0' && *
num <=
'9') {
95 }
else if (*
num ==
'e') {
113 }
else if (*
num ==
'+') {
118 while (*
num !=
'\0') {
119 if (*
num >=
'0' && *
num <=
'9') {
120 e =
e * 10 + *
num -
'0';
136 return Utils::atof(
num.data());
145 throw std::invalid_argument {
"KSeExpr::Utils::atoi: impossible to parse the given number"};
146 else if (
ptr !=
num.c_str() +
num.size())
147 throw std::invalid_argument {
"KSeExpr::Utils::atoi: the string had invalid extra characters"};
149 throw std::out_of_range {
"KSeExpr::Utils::atoi: out of range"};
165 return std::round(val);
170 return std::floor(val);
173#if defined(KSeExpr_HAVE_DYNAMIC_DISPATCH)
179KSeExpr_SSE41 double_t
floor(double_t val)
181 return _mm_cvtsd_f64(_mm_floor_sd(_mm_set_sd(0.0), _mm_set_sd(val)));
static constexpr std::array< int, 514 > p
KSeExpr_DEFAULT double_t round(double_t val)
KSeExpr_DEFAULT double_t floor(double_t val)
int32_t strtol(const char *num)
double_t atof(const char *num)