math: tanh.c cleanup similar to sinh, cosh
authorSzabolcs Nagy <nsz@port70.net>
Sun, 16 Dec 2012 18:52:42 +0000 (19:52 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Sun, 16 Dec 2012 18:52:42 +0000 (19:52 +0100)
comments are kept in the double version of the function

compared to fdlibm/freebsd we partition the domain into one
more part and select different threshold points:
now the [log(5/3)/2,log(3)/2] and [log(3)/2,inf] domains
should have <1.5ulp error
(so only the last bit may be wrong, assuming good exp, expm1)

(note that log(3)/2 and log(5/3)/2 are the points where tanh
changes resolution: tanh(log(3)/2)=0.5, tanh(log(5/3)/2)=0.25)

for some x < log(5/3)/2 (~=0.2554) the error can be >1.5ulp
but it should be <2ulp
(the freebsd code had some >2ulp errors in [0.255,1])

even with the extra logic the new code produces smaller
object files


No differences found