Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84e832a

Browse files
author
Thomas G. Lockhart
committed
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').
1 parent54067db commit84e832a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎src/backend/utils/adt/numeric.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*1998 Jan Wieck
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.11 1999/03/14 16:49:32 momjian Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.12 1999/05/04 15:50:24 thomas Exp $
99
*
1010
* ----------
1111
*/
@@ -1693,7 +1693,7 @@ float8_numeric(float64 val)
16931693
{
16941694
Numericres;
16951695
NumericVarresult;
1696-
char*tmp;
1696+
charbuf[512];
16971697

16981698
if (val==NULL)
16991699
returnNULL;
@@ -1703,12 +1703,11 @@ float8_numeric(float64 val)
17031703

17041704
init_var(&result);
17051705

1706-
tmp=float8out(val);
1707-
set_var_from_str(tmp,&result);
1706+
sprintf(buf,"%f",*val);
1707+
set_var_from_str(buf,&result);
17081708
res=make_result(&result);
17091709

17101710
free_var(&result);
1711-
pfree(tmp);
17121711

17131712
returnres;
17141713
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp