!1981 提升numeric ln运算的速度

Merge pull request !1981 from junhangis/junhangis/performance/numeric_ceil_floor_ln
This commit is contained in:
opengauss-bot
2022-08-06 03:43:35 +00:00
committed by Gitee

View File

@ -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).
*/