mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
Vec_ToText was underestimating max_length of the result
switch to a more predictable, shorter, and more correct output that is, print as many significant digits as necessary. but not more (they'd be just zeros) and not less (it'd lose precision)
This commit is contained in:
parent
91720da9be
commit
88119addff
7 changed files with 41 additions and 31 deletions
|
|
@ -97,7 +97,11 @@ String *Item_func_vec_totext::val_str_ascii(String *str)
|
|||
else if (std::isnan(val))
|
||||
str->append(STRING_WITH_LEN("NaN"));
|
||||
else
|
||||
str->append_float(val, FLT_DIG);
|
||||
{
|
||||
char buf[MAX_FLOAT_STR_LENGTH+1];
|
||||
size_t l= my_gcvt(val, MY_GCVT_ARG_FLOAT, MAX_FLOAT_STR_LENGTH, buf, 0);
|
||||
str->append(buf, l);
|
||||
}
|
||||
|
||||
ptr+= 4;
|
||||
if (r1->length() - i > 4)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue