Go to file
Anssi Hannula f67f9c9af2 ieee754: Remove slow paths from asin and acos
asin and acos have slow paths for rounding the last bit that cause some
calls to be 500-1500x slower than average calls.

These slow paths are rare, a test of a trillion (1.000.000.000.000)
random inputs between -1 and 1 showed 32870 slow calls for acos and 4473
for asin, with most occurrences between -1.0 .. -0.9 and 0.9 .. 1.0.

The slow paths claim correct rounding and use __sin32() and __cos32()
(which compare two result candidates and return the closest one) as the
final step, with the second result candidate (res1) having a small offset
applied from res. This suggests that res and res1 are intended to be 1
ULP apart (which makes sense for rounding), barring bugs, allowing us to
pick either one and still remain within 1 ULP of the exact result.

Remove the slow paths as the accuracy is better than 1 ULP even without
them, which is enough for glibc.

Also remove code comments claiming correctly rounded results.

After slow path removal, checking the accuracy of 14.400.000.000 random
asin() and acos() inputs showed only three incorrectly rounded
(error > 0.5 ULP) results:
- asin(-0x1.ee2b43286db75p-1) (0.500002 ULP, same as before)
- asin(-0x1.f692ba202abcp-4)  (0.500003 ULP, same as before)
- asin(-0x1.9915e876fc062p-1) (0.50000000001 ULP, previously exact)
The first two had the same error even before this commit, and they did
not use the slow path at all.

Checking 4934 known randomly found previously-slow-path asin inputs
shows 25 calls with incorrectly rounded results, with a maximum error of
0.500000002 ULP (for 0x1.fcd5742999ab8p-1). The previous slow-path code
rounded all these inputs correctly (error < 0.5 ULP).
The observed average speed increase was 130x.

Checking 36240 known randomly found previously-slow-path acos inputs
shows 42 calls with incorrectly rounded results, with a maximum error of
0.500000008 ULP (for 0x1.f63845056f35ep-1). The previous "exact"
slow-path code showed 34 calls with incorrectly rounded results, with the
same maximum error of 0.500000008 ULP (for 0x1.f63845056f35ep-1).
The observed average speed increase was 130x.

The functions could likely be trimmed more while keeping acceptable
accuracy, but this at least gets rid of the egregiously slow cases.

Tested on x86_64.
2020-12-18 12:09:23 +05:30
argp Fix spelling and grammar in several comments 2020-12-12 01:16:56 +01:00
assert Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
benchtests New benchtest: pthread locks 2020-10-21 11:03:52 -04:00
bits Replace Minumum/minumum with Minimum/minimum 2020-10-06 05:15:11 -07:00
catgets Remove internal usage of extensible stat functions 2020-09-11 14:35:32 -03:00
ChangeLog.old Prepare for glibc 2.32 release. 2020-08-04 22:17:00 -04:00
conform hurd: Remove some remnants of cthreads 2020-11-15 13:16:03 +01:00
crypt Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
csu Replace __libc_multiple_libcs with __libc_initial flag 2020-12-16 15:13:40 +01:00
ctype Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
debug Remove __warndecl 2020-11-05 15:11:42 +05:30
dirent Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dlfcn treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
elf Replace __libc_multiple_libcs with __libc_initial flag 2020-12-16 15:13:40 +01:00
gmon Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gnulib Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
grp nsswitch: handle missing actions properly 2020-12-14 12:19:43 -05:00
gshadow shadow: Implement fgetspent_r using __nss_fgetent_r 2020-07-21 07:34:43 +02:00
hesiod nss_hesiod: Use NSS_DECLARE_MODULE_FUNCTIONS 2020-02-13 09:14:44 +01:00
htl {nptl,htl}/semaphoreP.h: clean up 2020-12-16 14:51:14 +01:00
hurd hurd: Add __libc_open and __libc_close 2020-12-16 01:58:33 +01:00
iconv treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
iconvdata treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
include Replace __libc_multiple_libcs with __libc_initial flag 2020-12-16 15:13:40 +01:00
inet Fix spelling and grammar in several comments 2020-12-12 01:16:56 +01:00
intl Revert "Fix missing redirects in testsuite targets" 2020-10-08 10:09:30 +02:00
io io: nftw/ftw: Fix stack overflow with large nopenfd [BZ #26353] 2020-11-26 17:35:58 -03:00
libio Revert "Fix missing redirects in testsuite targets" 2020-10-08 10:09:30 +02:00
locale treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
localedata Revert "Fix missing redirects in testsuite targets" 2020-10-08 10:09:30 +02:00
login Linux: unlockpt needs to fail with EINVAL, not ENOTTY (bug 26053) 2020-10-07 10:56:00 +02:00
mach hurd: Add LLL_PRIVATE and LLL_SHARED 2020-12-16 01:58:33 +01:00
malloc malloc: Use __libc_initial to detect an inner libc 2020-12-16 15:13:40 +01:00
manual s390x: Require GCC 7.1 or later to build glibc. 2020-12-17 16:18:04 +01:00
math math: Regenerate auto-libm-test-out-j0 2020-08-08 16:41:40 -03:00
mathvec Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
misc Replace __libc_multiple_libcs with __libc_initial flag 2020-12-16 15:13:40 +01:00
nis Disable spurious -Warray-bounds for ypclnt.c (bug 26687) 2020-10-30 21:40:25 +00:00
nptl {nptl,htl}/semaphoreP.h: clean up 2020-12-16 14:51:14 +01:00
nptl_db treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
nscd nsswitch: use new internal API (callers) 2020-12-04 17:16:32 -05:00
nss nsswitch: handle missing actions properly 2020-12-14 12:19:43 -05:00
po Update translations. 2020-08-04 20:31:51 -04:00
posix nsswitch: use new internal API (callers) 2020-12-04 17:16:32 -05:00
pwd Remove tls.h inclusion from internal errno.h 2020-11-13 12:59:19 -03:00
resolv y2038: Convert gai_suspend to support 64 bit time 2020-12-04 10:04:38 +01:00
resource Move vtimes to a compatibility symbol 2020-10-19 16:44:20 -03:00
rt rt: Fix typos in comments in <aio.h> 2020-10-19 10:55:00 +02:00
scripts Use Linux 5.10 in build-many-glibcs.py. 2020-12-15 23:36:41 +00:00
setjmp Fix GCC 11 -Warray-parameter warning for __sigsetjmp (bug 26647) 2020-10-05 16:46:46 +00:00
shadow shadow: Implement fgetspent_r using __nss_fgetent_r 2020-07-21 07:34:43 +02:00
signal Remove tls.h inclusion from internal errno.h 2020-11-13 12:59:19 -03:00
socket Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
soft-fp Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stdio-common tests: Remove NULL check for an array 2020-11-12 13:29:59 +05:30
stdlib getenv: Move call to strlen to the branch it's used in. 2020-12-18 12:02:28 +05:30
string treewide: fix incorrect spelling of indices in comments 2020-12-11 02:00:00 +00:00
sunrpc Handle out-of-memory case in svc_tcp.c/svc_unix.c:rendezvous_request. 2020-12-10 11:11:20 +01:00
support support: Add support_slibdir_prefix variable 2020-12-11 18:30:57 +01:00
sysdeps ieee754: Remove slow paths from asin and acos 2020-12-18 12:09:23 +05:30
sysvipc sysvipc: Return EINVAL for invalid shmctl commands 2020-10-14 11:49:55 -03:00
termios Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
time linux: Allow adjtime with NULL argument [BZ #26833] 2020-11-09 11:19:35 -03:00
timezone timezone: Change zdump installation to bin directory 2020-11-25 15:52:50 +01:00
wcsmbs Make strtoimax, strtoumax, wcstoimax, wcstoumax into aliases 2020-12-08 18:15:27 +00:00
wctype Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
.gitattributes
.gitignore
abi-tags
aclocal.m4
config.h.in Remove --enable-obsolete-rpc configure flag 2020-07-13 19:36:35 +02:00
config.make.in Remove --enable-obsolete-rpc configure flag 2020-07-13 19:36:35 +02:00
configure Remove --enable-obsolete-rpc configure flag 2020-07-13 19:36:35 +02:00
configure.ac Remove --enable-obsolete-rpc configure flag 2020-07-13 19:36:35 +02:00
COPYING
COPYING.LIB
extra-lib.mk
gen-locales.mk
INSTALL s390x: Require GCC 7.1 or later to build glibc. 2020-12-17 16:18:04 +01:00
libc-abis
libof-iterator.mk
LICENSES
MAINTAINERS
Makeconfig Add {,sysdep-}ld-library-path make variable 2020-11-16 21:15:20 +00:00
Makefile Set locale related environment variables in debugglibc.sh 2020-09-24 14:58:36 +02:00
Makefile.help Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Makefile.in
Makerules Don't mix linker error messages into edited scripts 2020-08-04 19:52:56 -04:00
NEWS s390x: Require GCC 7.1 or later to build glibc. 2020-12-17 16:18:04 +01:00
o-iterator.mk
README Documentation for the RISC-V 32-bit port 2020-08-27 08:17:44 -07:00
Rules Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
shlib-versions Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
test-skeleton.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
version.h Open master branch for glibc 2.33 development. 2020-08-04 23:41:43 -04:00

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	ia64-*-linux-gnu
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.