improve the performance of numeric's ln().

This commit is contained in:
junhangis
2022-07-27 11:21:27 +08:00
parent 0c5e9903ce
commit 98c510c1e8

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