Clarify the choice of rscale in numeric_sqrt().
authorDean Rasheed <dean.a.rasheed@gmail.com>
Thu, 2 Feb 2023 09:41:22 +0000 (09:41 +0000)
committerDean Rasheed <dean.a.rasheed@gmail.com>
Thu, 2 Feb 2023 09:41:22 +0000 (09:41 +0000)
commit0736fc1ceb0659a9f73699910ac56603336daeee
treeb303d350d99bc9a66fad349f7ce2ea109d8e8beb
parent9a84f2947bf9345ad6b93ba37da63633649eaea8
Clarify the choice of rscale in numeric_sqrt().

Improve the comment explaining the choice of rscale in numeric_sqrt(),
and ensure that the code works consistently when other values of
NBASE/DEC_DIGITS are used.

Note that, in practice, we always expect DEC_DIGITS == 4, and this
does not change the computation in that case.

Joel Jacobson and Dean Rasheed

Discussion: https://postgr.es/m/06712c29-98e9-43b3-98da-f234d81c6e49%40app.fastmail.com
src/backend/utils/adt/numeric.c