]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sinpi[fl] etc: Fix the ld128 implementations
authorSteve Kargl <kargl@FreeBSD.org>
Sun, 31 Oct 2021 22:26:20 +0000 (00:26 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Mon, 1 Nov 2021 02:38:19 +0000 (04:38 +0200)
commit4f889260c33c163ab28e0e082b4d7e7562d9c647
tree9ed5e3816a721515ed66d25e3d5272b35ef66b20
parentd5d2ce1c8550a41e7374893ccd864c172461221f
sinpi[fl] etc: Fix the ld128 implementations

Mark Murray graciously provided access to an aarch64 system
to test the ld128 implementations.  This patch address
* Misuses of copysignl() in sinpil() and tanpil().
* Redo the splitting of argument 'x' into an integer part and
  remainder.  The remainder must satify 0 <= r < 1.
* Update the reduction of the integer part to something that can
  easily be seen as even or odd, e.g., sin(pi*x) = (-1)^n*sin(pi*r)
  with n <= 2^112 and we an reduce n by subtracting integer powers
  of 2.
* In s_cospil.c, fix typos where 'x' is used where 'ax', the
  remainder, is required.
* In tanpil(), fix the use of an uninitialized variable, ax = fabsl(ax),
  ax should be x in fabsl().

One item of note, in the limited tested on aarch64, the max ULP
for sinpil() and cospil() were less than 1.1 ULP, which is higher
that the desired max ULP less than 1.  This was traced to the
kernel for cosl() in the fundamental interval [0,pi/4].
The coefficients in the minmax polynomial likely need refinement.

PR: 218514
MFC after: 1 week
lib/msun/ld128/s_cospil.c
lib/msun/ld128/s_sinpil.c
lib/msun/ld128/s_tanpil.c