Commit 84e832a8 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Use sprintf() to convert float8 to a string during conversion to numeric.

Original code used float8out(), but the resulting exponential notation
 was not handled (e.g. '3E9' was decoded as '3').
parent 54067db6
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.11 1999/03/14 16:49:32 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.12 1999/05/04 15:50:24 thomas Exp $
* *
* ---------- * ----------
*/ */
...@@ -1693,7 +1693,7 @@ float8_numeric(float64 val) ...@@ -1693,7 +1693,7 @@ float8_numeric(float64 val)
{ {
Numeric res; Numeric res;
NumericVar result; NumericVar result;
char *tmp; char buf[512];
if (val == NULL) if (val == NULL)
return NULL; return NULL;
...@@ -1703,12 +1703,11 @@ float8_numeric(float64 val) ...@@ -1703,12 +1703,11 @@ float8_numeric(float64 val)
init_var(&result); init_var(&result);
tmp = float8out(val); sprintf(buf, "%f", *val);
set_var_from_str(tmp, &result); set_var_from_str(buf, &result);
res = make_result(&result); res = make_result(&result);
free_var(&result); free_var(&result);
pfree(tmp);
return res; return res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment