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

Commit5df20d4

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Little precision fix for POWER(). I discovered problems with big
exponents.Jan
1 parent0e9d75c commit5df20d4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 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.1 1998/12/3019:56:29 wieck Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.2 1998/12/3020:46:05 wieck Exp $
99
*
1010
* ----------
1111
*/
@@ -3371,9 +3371,9 @@ log_var(NumericVar *base, NumericVar *num, NumericVar *result)
33713371

33723372

33733373
/* ----------
3374-
*log_var() -
3374+
*power_var() -
33753375
*
3376-
*Computethelogarithm ofx in a given base
3376+
*Raise base tothepower ofexp
33773377
* ----------
33783378
*/
33793379
staticvoid
@@ -3384,7 +3384,7 @@ power_var(NumericVar *base, NumericVar *exp, NumericVar *result)
33843384
intsave_global_rscale;
33853385

33863386
save_global_rscale=global_rscale;
3387-
global_rscale+=8+MAX(0,exp->weight);
3387+
global_rscale+=global_rscale /3+8;
33883388

33893389
init_var(&ln_base);
33903390
init_var(&ln_num);

‎src/include/utils/numeric.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*1998 Jan Wieck
77
*
8-
* $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.1 1998/12/3019:56:35 wieck Exp $
8+
* $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.2 1998/12/3020:46:06 wieck Exp $
99
*
1010
* ----------
1111
*/
@@ -27,7 +27,7 @@
2727
#defineNUMERIC_MAX_DISPLAY_SCALENUMERIC_MAX_PRECISION
2828
#defineNUMERIC_MIN_DISPLAY_SCALENUMERIC_DEFAULT_SCALE + 4
2929

30-
#defineNUMERIC_MAX_RESULT_SCALE(NUMERIC_MAX_PRECISION+ 4)
30+
#defineNUMERIC_MAX_RESULT_SCALE(NUMERIC_MAX_PRECISION* 2)
3131
#defineNUMERIC_MIN_RESULT_SCALE(NUMERIC_DEFAULT_PRECISION + 4)
3232

3333
#defineNUMERIC_UNPACKED_DATASIZE(NUMERIC_MAX_PRECISION * 2 + 4)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp