about summary refs log tree commit diff
path: root/src/math/lroundl.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2020-06-13 22:03:13 +0000
committerRich Felker <dalias@aerifal.cx>2020-08-05 23:05:33 -0400
commit97e9b73d59b65d445f2ba0b6294605eac1d72ecb (patch)
tree3093eb43c0653bec2d1e7bc6c87a47fceb1e607a /src/math/lroundl.c
parentf1198ea3cfae3a3567e4ab4d2c741ed98b86f976 (diff)
downloadmusl-97e9b73d59b65d445f2ba0b6294605eac1d72ecb.tar.gz
musl-97e9b73d59b65d445f2ba0b6294605eac1d72ecb.tar.xz
musl-97e9b73d59b65d445f2ba0b6294605eac1d72ecb.zip
math: new software sqrt
approximate 1/sqrt(x) and sqrt(x) with goldschmidt iterations.
this is known to be a fast method for computing sqrt, but it is
tricky to get right, so added detailed comments.

use a lookup table for the initial estimate, this adds 256bytes
rodata but it can be shared between sqrt, sqrtf and sqrtl.
this saves one iteration compared to a linear estimate.

this is for soft float targets, but it supports fenv by using a
floating-point operation to get the final result.  the result
is correctly rounded in all rounding modes.  if fenv support is
turned off then the nearest rounded result is computed and
inexact exception is not signaled.

assumes fast 32bit integer arithmetics and 32 to 64bit mul.
Diffstat (limited to 'src/math/lroundl.c')
0 files changed, 0 insertions, 0 deletions