Re: Some improvements to numeric sqrt() and ln()
От | Dean Rasheed |
---|---|
Тема | Re: Some improvements to numeric sqrt() and ln() |
Дата | |
Msg-id | CAEZATCWi1+8ExgPLk=bpEC=jxzjM5Bzch20nfhF7UaQWCC5dhQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Some improvements to numeric sqrt() and ln() (Tels <nospam-pg-abuse@bloodgate.com>) |
Список | pgsql-hackers |
On Tue, 3 Mar 2020 at 00:17, Tels <nospam-pg-abuse@bloodgate.com> wrote: > > Thank you for these patches, these sound like really nice improvements. Thanks for looking! > One thing can to my mind while reading the patch: > > + * If r < 0 Then > + * Let r = r + 2*s - 1 > + * Let s = s - 1 > > This can be reformulated as: > > + * If r < 0 Then > + * Let r = r + s > + * Let s = s - 1 > + * Let r = r + s > > which would remove one mul/shift and the temp. variable. Good point, that's a neat little optimisation. I wasn't able to detect any difference in performance, because those corrections are only triggered about 1 time in every 50 or so, but it looks neater to me, especially in the numeric iterations, where it saves a sub_var() by const_one as well as not using the temporary variable. Regards, Dean
В списке pgsql-hackers по дате отправления: