summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index 0c1f03016e0..9cf4a281be2 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -972,12 +972,18 @@ int decimal2double(decimal_t *from, double *to)
int double2decimal(double from, decimal_t *to)
{
/* TODO: fix it, when we'll have dtoa */
- char s[400], *end;
- sprintf(s, "%.16G", from);
- end= strend(s);
- return string2decimal(s, to, &end);
+ char buff[400], *end;
+ int length, res;
+ DBUG_ENTER("double2decimal");
+ length= my_sprintf(buff, (buff, "%.16G", from));
+ DBUG_PRINT("info",("from: %g from_as_str: %s", from, buff));
+ end= buff+length;
+ res= string2decimal(buff, to, &end);
+ DBUG_PRINT("exit", ("res: %d", res));
+ DBUG_RETURN(res);
}
+
static int ull2dec(ulonglong from, decimal_t *to)
{
int intg1, error=E_DEC_OK;