Commit 5df20d44 authored by Jan Wieck's avatar Jan Wieck

Little precision fix for POWER(). I discovered problems with big

exponents.

Jan
parent 0e9d75c6
...@@ -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.1 1998/12/30 19:56:29 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.2 1998/12/30 20:46:05 wieck Exp $
* *
* ---------- * ----------
*/ */
...@@ -3371,9 +3371,9 @@ log_var(NumericVar *base, NumericVar *num, NumericVar *result) ...@@ -3371,9 +3371,9 @@ log_var(NumericVar *base, NumericVar *num, NumericVar *result)
/* ---------- /* ----------
* log_var() - * power_var() -
* *
* Compute the logarithm of x in a given base * Raise base to the power of exp
* ---------- * ----------
*/ */
static void static void
...@@ -3384,7 +3384,7 @@ power_var(NumericVar *base, NumericVar *exp, NumericVar *result) ...@@ -3384,7 +3384,7 @@ power_var(NumericVar *base, NumericVar *exp, NumericVar *result)
int save_global_rscale; int save_global_rscale;
save_global_rscale = global_rscale; save_global_rscale = global_rscale;
global_rscale += 8 + MAX(0, exp->weight); global_rscale += global_rscale / 3 + 8;
init_var(&ln_base); init_var(&ln_base);
init_var(&ln_num); init_var(&ln_num);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.1 1998/12/30 19:56:35 wieck Exp $ * $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.2 1998/12/30 20:46:06 wieck Exp $
* *
* ---------- * ----------
*/ */
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION #define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION
#define NUMERIC_MIN_DISPLAY_SCALE NUMERIC_DEFAULT_SCALE + 4 #define NUMERIC_MIN_DISPLAY_SCALE NUMERIC_DEFAULT_SCALE + 4
#define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION + 4) #define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2)
#define NUMERIC_MIN_RESULT_SCALE (NUMERIC_DEFAULT_PRECISION + 4) #define NUMERIC_MIN_RESULT_SCALE (NUMERIC_DEFAULT_PRECISION + 4)
#define NUMERIC_UNPACKED_DATASIZE (NUMERIC_MAX_PRECISION * 2 + 4) #define NUMERIC_UNPACKED_DATASIZE (NUMERIC_MAX_PRECISION * 2 + 4)
......
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