From 98c510c1e803fba09eb081ebe3fef6dd71b2431f Mon Sep 17 00:00:00 2001 From: junhangis Date: Wed, 27 Jul 2022 11:21:27 +0800 Subject: [PATCH] improve the performance of numeric's ln(). --- src/common/backend/utils/adt/numeric.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/backend/utils/adt/numeric.cpp b/src/common/backend/utils/adt/numeric.cpp index de521286c..ecf196373 100644 --- a/src/common/backend/utils/adt/numeric.cpp +++ b/src/common/backend/utils/adt/numeric.cpp @@ -6126,14 +6126,14 @@ static void ln_var(NumericVar* arg, NumericVar* result, int rscale) init_var(&elem); init_var(&fact); - set_var_from_var(arg, &x); - set_var_from_var(&const_two, &fact); + init_var_from_var(arg, &x); + init_var_from_var(&const_two, &fact); /* * Reduce input into range 0.9 < x < 1.1 with repeated sqrt() operations. * * The final logarithm will have up to around rscale+6 significant digits. - * Each sqrt() will roughly halve the weight of x, so adjust the local + * Each sqrt() will roughly have the weight of x, so adjust the local * rscale as we work so that we keep this many significant digits at each * step (plus a few more for good measure). */