diff options
Diffstat (limited to 'strings')
-rw-r--r-- | strings/decimal.c | 14 | ||||
-rw-r--r-- | strings/strtod.c | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index ea92174bfc8..1ae75167794 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1083,7 +1083,11 @@ int decimal2longlong(decimal_t *from, longlong *to) x=x*DIG_BASE - *buf++; if (unlikely(y < (LONGLONG_MIN/DIG_BASE) || x > y)) { - *to= from->sign ? y : -y; + /* + the decimal is bigger than any possible integer + return border integer depending on the sign + */ + *to= from->sign ? LONGLONG_MIN : LONGLONG_MAX; return E_DEC_OVERFLOW; } } @@ -1911,6 +1915,14 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) return error; } +int decimal_intg(decimal_t *from) +{ + int res; + dec1 *tmp_res; + tmp_res= remove_leading_zeroes(from, &res); + return res; +} + int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to) { if (likely(from1->sign == from2->sign)) diff --git a/strings/strtod.c b/strings/strtod.c index 1b9a82ac30c..0ada423f373 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -251,7 +251,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) done: *end_ptr= (char*) str; /* end of number */ - if (overflow || isinf(result)) + if (overflow || my_isinf(result)) { result= DBL_MAX; *error= EOVERFLOW; |