From dc30f461575342ffeb6c0f2d5931493c1c3a91c0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 13 Feb 1998 17:54:15 +0000 Subject: Update. 1998-02-13 17:39 Ulrich Drepper * elf/Makefile: Don't use --version-script parameter to link ld.so unconditionally. 1998-01-02 04:19 Geoff Keating * math/Makefile: Add t_exp. * math/libm-test.c: Tighten accuracy bounds for exp(), correct constants. * math/test-reduce.c: Remove temporarily, it seems to be broken. * sysdeps/libm-ieee754/e_exp.c: Use accurate table method. * sysdeps/libm-ieee754/e_expf.c: Use table & double precision for better accuracy. * sysdeps/libm-ieee754/s_exp2.c: Use better polynomial; correct algorithm for very large/very small arguments. * sysdeps/libm-ieee754/s_exp2f.c: Use slightly better polynomial; correct algorithm for very large/very small arguments; adjust for new table. * sysdeps/libm-ieee754/t_exp.c: New file. * sysdeps/libm-ieee754/t_exp2f.h: Use table with smaller deltas. * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Put 'strange test' back, with comment that explains what breaks when you remove it :-(. * localedata/xfrm-test.c: Avoid integer overflow. * stdlib/strfmon.c: char is unsigned, sometimes. *sysdeps/powerpc * sysdeps/powerpc/Makefile: Remove quad float support. * sysdeps/powerpc/q_*.c: Remove, they will become an add-on. * sysdeps/powerpc/quad_float.h: Likewise. * sysdeps/powerpc/test-arith.c: Likewise. * sysdeps/powerpc/test-arithf.c: Likewise. * sysdeps/generic/s_exp2.c: Remove, we have this implemented now. * sysdeps/generic/s_exp2f.c: Likewise. * sysdeps/powerpc/bits/mathinline.h: Use underscores around __asm__, don't try anything if _SOFT_FLOAT. 1997-12-31 Andreas Schwab * locale/C-ctype.c (_nl_C_LC_CTYPE_class32): Undo last change. * locale/programs/ld-ctype.c (CHAR_CLASS32_TRANS): Likewise. * wctype/wctype.c: Likewise. * wctype/wctype.h (_ISwxxx): Renamed from _ISxxx, all uses changed. They are incompatible with the _ISxxx values from on little endian machines. (_ISwbit) [__BYTE_ORDER == __LITTLE_ENDIAN]: Correctly transform bit number. This fixes the real bug and restores the integrity of the ctype locale file. * wctype/wcfuncs.c: Change all _ISxxx to _ISwxxx. * wctype/wcfuncs_l.c: Likewise. * wctype/wcextra.c: Likewise. * wctype/wctype_l.c [__BYTE_ORDER == __LITTLE_ENDIAN]: Use correct byte swapping. 1998-02-09 Andreas Schwab * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S (errno): Put it into .bss segment instead of .common, so that aliases on it work. * sysdeps/unix/sysv/linux/i386/sysdep.S (errno): Add .type and .size directives, put into .bss segment instead of initializing it to 4. 1998-02-12 08:00 H.J. Lu * libc.map (gnu_get_libc_release, gnu_get_libc_version): Added. * version.c (__gnu_get_libc_release, __gnu_get_libc_version): New functions. Make names without __ weak aliases. (__libc_release, __libc_version): Make them static. * include/gnu/libc-version.h: New file. * Makefile (headers): Add gnu/libc-version.h. 1998-02-13 Ulrich Drepper * stdlib/stdlib.h (struct drand48_data): Leave X to user macros and use x for member name. Reported by Daniel Lyddy . * stdlib/drand48.c: Change according to member name change. * stdlib/drand48_r.c: Likewise. * stdlib/lcong48_r.c: Likewise. * stdlib/lrand48.c: Likewise. * stdlib/lrand48_r.c: Likewise. * stdlib/mrand48.c: Likewise. * stdlib/mrand48_r.c: Likewise. * stdlib/seed48.c: Likewise. * stdlib/seed48_r.c: Likewise. * stdlib/srand48_r.c: Likewise. 1998-02-11 Andreas Jaeger * nss/test-netdb.c: Add some more test cases. 1998-02-13 11:39 Ulrich Drepper * libio/iovsscanf.c: Undo last change modifying errno. 1998-02-12 Andreas Schwab * stdio-common/vfscanf.c: Never try to read another character after EOF. Don't decrement read_in after EOF, it wasn't incremented in the first place. (NEXT_WIDE_CHAR): Set First, not first. 1998-02-06 07:48 H.J. Lu * db/Makefile ($(inst_libdir)/libndbm.a, $(inst_libdir)/libndbm.so): New targets. * db2/Makefile: Likewise. 1998-02-12 08:20 H.J. Lu * sysdeps/gnu/errlist.awk (sys_errlist, sys_nerr): Create weak aliases if HAVE_ELF or PIC or DO_VERSIONING is not defined. 1998-02-12 Andreas Schwab * sysdeps/generic/_G_config.h: Define _G_wchar_t, for C++ . * sysdeps/unix/sysv/linux/_G_config.h: Likewise. 1998-02-11 Andreas Schwab * sysdeps/unix/make-syscalls.sh: Fix sed pattern when dealing with versioned symbols. 1998-02-13 08:14 H.J. Lu * libc.map (_dl_global_scope, _dl_lookup_symbol_skip, _dl_lookup_versioned_symbol, _dl_lookup_versioned_symbol_skip): Added for libdl.so. * elf/rtld.map: New file. Needed to define the GLIBC_2.* * manual/socket.texi (Host Address Functions): Clarify description * sysdeps/unix/sysv/linux/alpha/bits/time.h (struct timeval): --- ChangeLog | 160 +++++- Makefile | 3 +- db/Makefile | 10 + db2/Makefile | 10 + elf/Makefile | 7 +- include/gnu/libc-version.h | 37 ++ libc.map | 5 + libio/iovsscanf.c | 2 - locale/C-ctype.c | 172 +++---- locale/programs/ld-ctype.c | 5 +- localedata/xfrm-test.c | 8 +- math/Makefile | 6 +- math/libm-test.c | 8 +- nss/test-netdb.c | 18 +- stdio-common/vfscanf.c | 50 +- stdlib/drand48.c | 4 +- stdlib/drand48_r.c | 4 +- stdlib/lcong48_r.c | 10 +- stdlib/lrand48.c | 4 +- stdlib/lrand48_r.c | 4 +- stdlib/mrand48.c | 4 +- stdlib/mrand48_r.c | 4 +- stdlib/seed48.c | 4 +- stdlib/seed48_r.c | 16 +- stdlib/srand48_r.c | 14 +- stdlib/stdlib.h | 4 +- stdlib/strfmon.c | 6 +- sysdeps/generic/_G_config.h | 2 + sysdeps/gnu/errlist.awk | 2 +- sysdeps/gnu/errlist.c | 2 +- sysdeps/libm-ieee754/e_exp.c | 330 +++++++------ sysdeps/libm-ieee754/e_expf.c | 241 +++++---- sysdeps/libm-ieee754/s_exp2.c | 71 +-- sysdeps/libm-ieee754/s_exp2f.c | 77 +-- sysdeps/libm-ieee754/t_exp.c | 436 +++++++++++++++++ sysdeps/libm-ieee754/t_exp2f.h | 649 +++++++++++++------------ sysdeps/powerpc/Dist | 1 - sysdeps/powerpc/Makefile | 10 - sysdeps/powerpc/bits/mathinline.h | 12 +- sysdeps/powerpc/q_addsub.c | 549 --------------------- sysdeps/powerpc/q_dtoq.c | 66 --- sysdeps/powerpc/q_feq.c | 65 --- sysdeps/powerpc/q_fne.c | 70 --- sysdeps/powerpc/q_itoq.c | 50 -- sysdeps/powerpc/q_lltoq.c | 52 -- sysdeps/powerpc/q_neg.c | 38 -- sysdeps/powerpc/q_qtoi.c | 65 --- sysdeps/powerpc/q_qtoll.c | 64 --- sysdeps/powerpc/q_qtos.c | 84 ---- sysdeps/powerpc/q_qtou.c | 64 --- sysdeps/powerpc/q_qtoull.c | 65 --- sysdeps/powerpc/q_stoq.c | 65 --- sysdeps/powerpc/q_ulltoq.c | 46 -- sysdeps/powerpc/q_utoq.c | 44 -- sysdeps/powerpc/quad_float.h | 44 -- sysdeps/unix/make-syscalls.sh | 4 +- sysdeps/unix/sysv/linux/_G_config.h | 2 + sysdeps/unix/sysv/linux/i386/sysdep.S | 8 +- sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 16 +- sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S | 7 +- version.c | 24 +- wctype/wcextra.c | 4 +- wctype/wcfuncs.c | 22 +- wctype/wcfuncs_l.c | 22 +- wctype/wctype.c | 6 +- wctype/wctype.h | 82 ++-- wctype/wctype_l.c | 6 +- 67 files changed, 1709 insertions(+), 2337 deletions(-) create mode 100644 include/gnu/libc-version.h create mode 100644 sysdeps/libm-ieee754/t_exp.c delete mode 100644 sysdeps/powerpc/q_addsub.c delete mode 100644 sysdeps/powerpc/q_dtoq.c delete mode 100644 sysdeps/powerpc/q_feq.c delete mode 100644 sysdeps/powerpc/q_fne.c delete mode 100644 sysdeps/powerpc/q_itoq.c delete mode 100644 sysdeps/powerpc/q_lltoq.c delete mode 100644 sysdeps/powerpc/q_neg.c delete mode 100644 sysdeps/powerpc/q_qtoi.c delete mode 100644 sysdeps/powerpc/q_qtoll.c delete mode 100644 sysdeps/powerpc/q_qtos.c delete mode 100644 sysdeps/powerpc/q_qtou.c delete mode 100644 sysdeps/powerpc/q_qtoull.c delete mode 100644 sysdeps/powerpc/q_stoq.c delete mode 100644 sysdeps/powerpc/q_ulltoq.c delete mode 100644 sysdeps/powerpc/q_utoq.c delete mode 100644 sysdeps/powerpc/quad_float.h diff --git a/ChangeLog b/ChangeLog index b96b848ece..719304cd7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,143 @@ +1998-02-13 17:39 Ulrich Drepper + + * elf/Makefile: Don't use --version-script parameter to link ld.so + unconditionally. + +1998-01-02 04:19 Geoff Keating + + * math/Makefile: Add t_exp. + * math/libm-test.c: Tighten accuracy bounds for exp(), correct + constants. + * math/test-reduce.c: Remove temporarily, it seems to be broken. + * sysdeps/libm-ieee754/e_exp.c: Use accurate table method. + * sysdeps/libm-ieee754/e_expf.c: Use table & double precision for + better accuracy. + * sysdeps/libm-ieee754/s_exp2.c: Use better polynomial; correct + algorithm for very large/very small arguments. + * sysdeps/libm-ieee754/s_exp2f.c: Use slightly better polynomial; + correct algorithm for very large/very small arguments; adjust for + new table. + * sysdeps/libm-ieee754/t_exp.c: New file. + * sysdeps/libm-ieee754/t_exp2f.h: Use table with smaller deltas. + + * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Put 'strange test' + back, with comment that explains what breaks when you remove it :-(. + + * localedata/xfrm-test.c: Avoid integer overflow. + + * stdlib/strfmon.c: char is unsigned, sometimes. + + *sysdeps/powerpc + * sysdeps/powerpc/Makefile: Remove quad float support. + * sysdeps/powerpc/q_*.c: Remove, they will become an add-on. + * sysdeps/powerpc/quad_float.h: Likewise. + * sysdeps/powerpc/test-arith.c: Likewise. + * sysdeps/powerpc/test-arithf.c: Likewise. + + * sysdeps/generic/s_exp2.c: Remove, we have this implemented now. + * sysdeps/generic/s_exp2f.c: Likewise. + + * sysdeps/powerpc/bits/mathinline.h: Use underscores around __asm__, + don't try anything if _SOFT_FLOAT. + +1997-12-31 Andreas Schwab + + * locale/C-ctype.c (_nl_C_LC_CTYPE_class32): Undo last change. + * locale/programs/ld-ctype.c (CHAR_CLASS32_TRANS): Likewise. + * wctype/wctype.c: Likewise. + * wctype/wctype.h (_ISwxxx): Renamed from _ISxxx, all uses + changed. They are incompatible with the _ISxxx values from + on little endian machines. + (_ISwbit) [__BYTE_ORDER == __LITTLE_ENDIAN]: Correctly transform + bit number. This fixes the real bug and restores the integrity of + the ctype locale file. + * wctype/wcfuncs.c: Change all _ISxxx to _ISwxxx. + * wctype/wcfuncs_l.c: Likewise. + * wctype/wcextra.c: Likewise. + * wctype/wctype_l.c [__BYTE_ORDER == __LITTLE_ENDIAN]: Use correct + byte swapping. + +1998-02-09 Andreas Schwab + + * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S (errno): Put it + into .bss segment instead of .common, so that aliases on it work. + + * sysdeps/unix/sysv/linux/i386/sysdep.S (errno): Add .type and + .size directives, put into .bss segment instead of initializing it + to 4. + +1998-02-12 08:00 H.J. Lu + + * libc.map (gnu_get_libc_release, gnu_get_libc_version): Added. + + * version.c (__gnu_get_libc_release, __gnu_get_libc_version): New + functions. + Make names without __ weak aliases. + (__libc_release, __libc_version): Make them static. + + * include/gnu/libc-version.h: New file. + * Makefile (headers): Add gnu/libc-version.h. + +1998-02-13 Ulrich Drepper + + * stdlib/stdlib.h (struct drand48_data): Leave X to user macros + and use x for member name. + Reported by Daniel Lyddy . + + * stdlib/drand48.c: Change according to member name change. + * stdlib/drand48_r.c: Likewise. + * stdlib/lcong48_r.c: Likewise. + * stdlib/lrand48.c: Likewise. + * stdlib/lrand48_r.c: Likewise. + * stdlib/mrand48.c: Likewise. + * stdlib/mrand48_r.c: Likewise. + * stdlib/seed48.c: Likewise. + * stdlib/seed48_r.c: Likewise. + * stdlib/srand48_r.c: Likewise. + +1998-02-11 Andreas Jaeger + + * nss/test-netdb.c: Add some more test cases. + +1998-02-13 11:39 Ulrich Drepper + + * libio/iovsscanf.c: Undo last change modifying errno. + +1998-02-12 Andreas Schwab + + * stdio-common/vfscanf.c: Never try to read another character + after EOF. Don't decrement read_in after EOF, it wasn't + incremented in the first place. + (NEXT_WIDE_CHAR): Set First, not first. + +1998-02-06 07:48 H.J. Lu + + * db/Makefile ($(inst_libdir)/libndbm.a, + $(inst_libdir)/libndbm.so): New targets. + * db2/Makefile: Likewise. + +1998-02-12 08:20 H.J. Lu + + * sysdeps/gnu/errlist.awk (sys_errlist, sys_nerr): Create weak + aliases if HAVE_ELF or PIC or DO_VERSIONING is not defined. + +1998-02-12 Andreas Schwab + + * sysdeps/generic/_G_config.h: Define _G_wchar_t, for C++ + . + * sysdeps/unix/sysv/linux/_G_config.h: Likewise. + +1998-02-11 Andreas Schwab + + * sysdeps/unix/make-syscalls.sh: Fix sed pattern when dealing with + versioned symbols. + +1998-02-13 08:14 H.J. Lu + + * libc.map (_dl_global_scope, _dl_lookup_symbol_skip, + _dl_lookup_versioned_symbol, _dl_lookup_versioned_symbol_skip): + Added for libdl.so. + 1998-02-09 Andreas Schwab * sysdeps/unix/sysv/linux/syscalls.list: Don't mark lchown as @@ -78,7 +218,7 @@ * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_missing_rt_sigs): Rename from __libc_have_rt_sigs and leave as COMMON data. - + 1998-02-11 08:30 H.J. Lu * sysdeps/libm-ieee754/w_powl.c (__powl): Use __finitel instead @@ -129,7 +269,7 @@ * io/fts.c (fts_build): Don't try to use d_type if it doesn't exist. - + * sysdeps/arm/sys/ucontext.h: New file. 1998-02-04 10:11 Philip Blundell @@ -137,7 +277,7 @@ * manual/stdio.texi (Formatted Output Functions): Explicitly say that the return value from snprintf() does not count the terminating NUL as a character. - + 1998-02-10 16:57 Ulrich Drepper * manual/users.texi: Rewrite to describe correct POSIX behaviour, @@ -185,7 +325,7 @@ 1998-02-10 16:57 Ulrich Drepper * resolv/nss_dns/dns-host.c: Various code cleanups. - + 1998-02-09 08:10 H.J. Lu * resolv/gethnamaddr.c (getanswer): Fix the PTR/CNAME bug. @@ -214,7 +354,7 @@ * sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Correct last patch to support obsolete tty major numbers correctly. - + 1998-02-02 08:47 H.J. Lu * login/Makefile ($(inst_libexecdir)/pt_chown): Make the target @@ -264,20 +404,20 @@ * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_missing_rt_sigs): Rename from __libc_have_rt_sigs and leave as COMMON data. - + 1998-02-04 11:58 Richard Henderson * Makeconfig (CFLAGS-.os): Kill -fno-common. * Makerules (libc.so): Prelink libc_pic.a, allocating commons. * libc.map (GLIBC_2.1): Add Linux/Alpha tv64 symbols. - * elf/rtld.map: New file. Needed to define the GLIBC_2.* + * elf/rtld.map: New file. Needed to define the GLIBC_2.* version symbols. * include/libc-symbols.h (symbol_version, default_symbol_version): Provide asm versions and correct !DO_VERSIONING versions. * sysdeps/unix/make-syscalls.sh: Recognize version symbols in the weak symbol list. - + * sysdeps/unix/sysv/linux/sigaction.c (__libc_missing_rt_sigs): Rename from __libc_have_rt_sigs and leave as COMMON data. * sysdeps/unix/sysv/linux/sigpending.c: Likewise. @@ -306,7 +446,7 @@ 1998-01-29 Andreas Jaeger - * manual/socket.texi (Host Address Functions): Clarify description + * manual/socket.texi (Host Address Functions): Clarify description of inet_network. 1998-02-07 Andreas Schwab @@ -352,7 +492,7 @@ * sysdeps/unix/sysv/linux/alpha/clone.S: Elide terminal ldgp for PROF. * sysdeps/unix/sysv/linux/alpha/rt_sigaction.S: Fix typos. - * sysdeps/unix/sysv/linux/alpha/bits/time.h (struct timeval): + * sysdeps/unix/sysv/linux/alpha/bits/time.h (struct timeval): Follow POSIX and make tv_sec a time_t. * sysdeps/unix/sysv/linux/alpha/getitimer.S: New file to handle new tv64 syscall as well as fall back to tv32. diff --git a/Makefile b/Makefile index 2b82557225..7efe32350b 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,8 @@ subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \ $(addprefix install-, no-libc.a bin lib data headers others) headers := errno.h sys/errno.h bits/errno.h limits.h values.h \ - features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h + features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \ + gnu/libc-version.h aux = sysdep $(libc-init) version before-compile += $(objpfx)version-info.h diff --git a/db/Makefile b/db/Makefile index 9f45e9fea2..2d742d133a 100644 --- a/db/Makefile +++ b/db/Makefile @@ -51,3 +51,13 @@ endif # This ensures they will load libc.so for needed symbols if loaded by # a statically-linked program that hasn't already loaded it. $(objpfx)libdb.so: $(common-objpfx)libc.so + +subdir_install: $(inst_libdir)/libndbm.a +$(inst_libdir)/libndbm.a: $(inst_libdir)/libdb.a + $(make-link) + +ifeq ($(build-shared),yes) +subdir_install: $(inst_libdir)/libndbm.so +$(inst_libdir)/libndbm.so: $(inst_libdir)/libdb.so + $(make-link) +endif diff --git a/db2/Makefile b/db2/Makefile index fb25bb6de1..2d95bd715c 100644 --- a/db2/Makefile +++ b/db2/Makefile @@ -110,3 +110,13 @@ endif # Depend on libc.so so a DT_NEEDED is generated in the shared objects. $(objpfx)libdb.so: $(common-objpfx)libc.so + +subdir_install: $(inst_libdir)/libndbm.a +$(inst_libdir)/libndbm.a: $(inst_libdir)/libdb.a + $(make-link) + +ifeq ($(build-shared),yes) +subdir_install: $(inst_libdir)/libndbm.so +$(inst_libdir)/libndbm.so: $(inst_libdir)/libdb.so + $(make-link) +endif diff --git a/elf/Makefile b/elf/Makefile index 85dba53f99..5fe73e7171 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -103,11 +103,13 @@ $(objpfx)rtld-ldscript: $(rtld-ldscript-in) $(rtld-parms) $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript $(rtld-link) -Wl,-soname=$(rtld-installed-name) +RTLD-VERSIONS=$(addprefix -Wl,--version-script=,$(libc-map)) + define rtld-link $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \ $(filter-out $(objpfx)rtld-ldscript,$^) \ - -Wl,--version-script=$(libc-map) + $(RTLD-VERSIONS) endef else $(objpfx)ld.so: $(objpfx)librtld.os @@ -115,8 +117,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os define rtld-link $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ - -Wl,-rpath=$(default-rpath) $^ \ - -Wl,--version-script=$(libc-map) + -Wl,-rpath=$(default-rpath) $^ $(RTLD-VERSIONS) endef endif diff --git a/include/gnu/libc-version.h b/include/gnu/libc-version.h new file mode 100644 index 0000000000..ab80cfc987 --- /dev/null +++ b/include/gnu/libc-version.h @@ -0,0 +1,37 @@ +/* Interface to GNU libc specific functions for version information. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GNU_LIBC_VERSION_H +#define _GNU_LIBC_VERSION_H 1 + +#include + +__BEGIN_DECLS + +/* Return string describing release status of currently running GNU libc. */ +extern const char *__gnu_get_libc_release __P ((void)); +extern const char *gnu_get_libc_release __P ((void)); + +/* Return string describing version of currently running GNU libc. */ +extern const char *__gnu_get_libc_version __P ((void)); +extern const char *gnu_get_libc_version __P ((void)); + +__END_DECLS + +#endif /* gnu/libc-version.h */ diff --git a/libc.map b/libc.map index 9cd9646b21..76154c9d90 100644 --- a/libc.map +++ b/libc.map @@ -433,6 +433,8 @@ GLIBC_2.0 { _dl_map_object; _dl_map_object_deps; _dl_object_relocation_scope; _dl_relocate_object; _dl_signal_error; _dl_starting_up; _dl_sysdep_start; _r_debug; + _dl_global_scope; _dl_lookup_symbol_skip; + _dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip; local: *; @@ -464,4 +466,7 @@ GLIBC_2.1 { # New errlist. _sys_errlist; sys_errlist; sys_nerr; + + # New special glibc functions. + gnu_get_libc_release; gnu_get_libc_version; } GLIBC_2.0; diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c index 0674a4b164..d7fb8c532e 100644 --- a/libio/iovsscanf.c +++ b/libio/iovsscanf.c @@ -44,8 +44,6 @@ _IO_vsscanf (string, format, args) _IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); _IO_flockfile (&sf._sbf._f); - errno = 0; /* Necessary since _IO_vfscanf tests for errno but the - string I/O functions don't set it. */ ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL); _IO_cleanup_region_end (1); return ret; diff --git a/locale/C-ctype.c b/locale/C-ctype.c index 09511eb1e6..851b95fd98 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -95,92 +95,92 @@ const char _nl_C_LC_CTYPE_class[768] = /* 0xfa */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" ; const char _nl_C_LC_CTYPE_class32[1024] = - /* 0x00 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x03 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x06 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x09 */ "\003\040\000\000" "\002\040\000\000" "\002\040\000\000" - /* 0x0c */ "\002\040\000\000" "\002\040\000\000" "\002\000\000\000" - /* 0x0f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x12 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x15 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x18 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x1b */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x1e */ "\002\000\000\000" "\002\000\000\000" "\001\140\000\000" - /* 0x21 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x24 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x27 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x2a */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x2d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x30 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x33 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x36 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x39 */ "\010\330\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x3c */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x3f */ "\004\300\000\000" "\004\300\000\000" "\010\325\000\000" - /* 0x42 */ "\010\325\000\000" "\010\325\000\000" "\010\325\000\000" - /* 0x45 */ "\010\325\000\000" "\010\325\000\000" "\010\305\000\000" - /* 0x48 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x4b */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x4e */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x51 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x54 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x57 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x5a */ "\010\305\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x5d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x60 */ "\004\300\000\000" "\010\326\000\000" "\010\326\000\000" - /* 0x63 */ "\010\326\000\000" "\010\326\000\000" "\010\326\000\000" - /* 0x66 */ "\010\326\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x69 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x6c */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x6f */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x72 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x75 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x78 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x7b */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x7e */ "\004\300\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x81 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x84 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x87 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x8a */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x8d */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x90 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x93 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x96 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x99 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x9c */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x9f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xab */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xae */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xba */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xbd */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xcc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xcf */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xdb */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xde */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xea */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xed */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xfc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xff */ "\002\000\000\000" + /* 0x00 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x03 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x06 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x09 */ "\000\000\003\040" "\000\000\002\040" "\000\000\002\040" + /* 0x0c */ "\000\000\002\040" "\000\000\002\040" "\000\000\002\000" + /* 0x0f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x12 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x15 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x18 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x1b */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x1e */ "\000\000\002\000" "\000\000\002\000" "\000\000\001\140" + /* 0x21 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x24 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x27 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x2a */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x2d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x30 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x33 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x36 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x39 */ "\000\000\010\330" "\000\000\004\300" "\000\000\004\300" + /* 0x3c */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x3f */ "\000\000\004\300" "\000\000\004\300" "\000\000\010\325" + /* 0x42 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\325" + /* 0x45 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\305" + /* 0x48 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x4b */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x4e */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x51 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x54 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x57 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x5a */ "\000\000\010\305" "\000\000\004\300" "\000\000\004\300" + /* 0x5d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x60 */ "\000\000\004\300" "\000\000\010\326" "\000\000\010\326" + /* 0x63 */ "\000\000\010\326" "\000\000\010\326" "\000\000\010\326" + /* 0x66 */ "\000\000\010\326" "\000\000\010\306" "\000\000\010\306" + /* 0x69 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x6c */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x6f */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x72 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x75 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x78 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x7b */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x7e */ "\000\000\004\300" "\000\000\002\000" "\000\000\002\000" + /* 0x81 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x84 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x87 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x8a */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x8d */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x90 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x93 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x96 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x99 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x9c */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x9f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xab */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xae */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xba */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xbd */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xcc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xcf */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xdb */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xde */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xea */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xed */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xfc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xff */ "\000\000\002\000" ; const u_int32_t _nl_C_LC_CTYPE_toupper[384] = { diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index f2ad46f092..8ab70abb5a 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -56,9 +56,6 @@ void *xrealloc (void *__ptr, size_t __n); #define SWAPU16(w) \ ((((w) >> 8) & 0xff) | (((w) & 0xff) << 8)) -#define XSWAPU32(w) \ - ((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8)) - /* To be compatible with former implementations we for now restrict the number of bits for character classes to 16. When compatibility @@ -66,7 +63,7 @@ void *xrealloc (void *__ptr, size_t __n); #define char_class_t u_int16_t #define CHAR_CLASS_TRANS SWAPU16 #define char_class32_t u_int32_t -#define CHAR_CLASS32_TRANS XSWAPU32 +#define CHAR_CLASS32_TRANS SWAPU32 /* The real definition of the struct for the LC_CTYPE locale. */ diff --git a/localedata/xfrm-test.c b/localedata/xfrm-test.c index 51f32d5632..0ba288797a 100644 --- a/localedata/xfrm-test.c +++ b/localedata/xfrm-test.c @@ -1,5 +1,5 @@ /* Test collation function via transformation using real data. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -102,12 +102,12 @@ main (int argc, char *argv[]) /* While we are at it a first little test. */ r1 = strcmp (strings[idx1].xfrm, strings[idx2].xfrm); r2 = strcmp (strings[idx2].xfrm, strings[idx1].xfrm); - r = -(r1 * r2); + r = -(r1 ^ r2); if (r) - r /= abs (r1 * r2); + r /= abs (r1 ^ r2); if (r < 0 || (r == 0 && (r1 != 0 || r2 != 0)) - || (r > 0 && (r1 * r2) >= 0)) + || (r > 0 && (r1 ^ r2) >= 0)) printf ("collate wrong: %d vs. %d\n", r1, r2); } diff --git a/math/Makefile b/math/Makefile index 2be1718d32..ec5910ee9b 100644 --- a/math/Makefile +++ b/math/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -41,7 +41,7 @@ libm-map := libm.map libm-support = k_standard s_lib_version s_matherr s_signgam \ fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \ ftestexcept fegetround fesetround fegetenv feholdexcpt \ - fesetenv feupdateenv + fesetenv feupdateenv t_exp libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \ e_hypot e_j0 e_j1 e_jn e_lgamma_r e_log e_log10 e_pow \ e_rem_pio2 e_remainder e_scalb e_sinh e_sqrt e_gamma_r \ @@ -78,7 +78,7 @@ distribute += $(long-c-yes:=.c) # Rules for the test suite. tests = test-float test-double $(test-longdouble-$(long-double-fcts)) \ test-ifloat test-idouble test-matherr test-fenv \ - atest-exp atest-sincos atest-exp2 # test-reduce + atest-exp atest-sincos atest-exp2 # We do the `long double' tests only if this data type is available and # distinct from `double'. test-longdouble-yes = test-ldouble test-ildoubl diff --git a/math/libm-test.c b/math/libm-test.c index f35ef41423..3dffcad6dc 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -138,6 +138,8 @@ /* Various constants (we must supply them precalculated for accuracy). */ #define M_PI_6 .52359877559829887308L +#define M_E2 7.389056098930650227230L +#define M_E3 20.08553692318766774093L static int noErrors; /* number of errors */ static int noTests; /* number of tests (without testing exceptions) */ @@ -1175,11 +1177,11 @@ exp_test (void) check_isinfp ("exp (+inf) == +inf", FUNC(exp) (plus_infty)); check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0); #endif - check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 5e-16, 0)); + check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 0, 0)); - check_eps ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E, + check_eps ("exp (2) == e^2", FUNC(exp) (2), M_E2, CHOOSE (1e-18, 0, 0)); - check_eps ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E, + check_eps ("exp (3) == e^3", FUNC(exp) (3), M_E3, CHOOSE (1.5e-17, 0, 0)); check_eps ("exp (0.7) == 2.0137527074...", FUNC(exp) (0.7), 2.0137527074704765216L, CHOOSE(9e-17L, 0, 0)); diff --git a/nss/test-netdb.c b/nss/test-netdb.c index 46cf52409b..7f1a767b4e 100644 --- a/nss/test-netdb.c +++ b/nss/test-netdb.c @@ -83,6 +83,13 @@ test_services (void) sptr = getservbyname ("not-existant", NULL); output_servent ("getservbyname (\"not-existant\", NULL)", sptr); + /* This shouldn't return anything. */ + sptr = getservbyname ("", ""); + output_servent ("getservbyname (\"\", \"\")", sptr); + + sptr = getservbyname ("", "tcp"); + output_servent ("getservbyname (\"\", \"tcp\")", sptr); + sptr = getservbyport (htons(53), "tcp"); output_servent ("getservbyport (htons(53), \"tcp\")", sptr); @@ -157,6 +164,11 @@ test_hosts (void) output_hostent ("gethostbyname(\"localhost\")", hptr1); } + hptr1 = gethostbyname ("127.0.0.1"); + output_hostent ("gethostbyname (\"127.0.0.1\")", hptr1); + + hptr1 = gethostbyname2 ("localhost", AF_INET); + output_hostent ("gethostbyname2 (\"localhost\", AF_INET)", hptr1); if (gethostname (name, namelen) == 0) { @@ -211,12 +223,15 @@ test_network (void) u_int32_t ip; /* - this test needs the following line in /etc/networks: + This test needs the following line in /etc/networks: loopback 127.0.0.0 */ nptr = getnetbyname ("loopback"); output_netent ("getnetbyname (\"loopback\")",nptr); + nptr = getnetbyname ("LoopBACK"); + output_netent ("getnetbyname (\"LoopBACK\")",nptr); + ip = inet_network ("127.0.0.0"); nptr = getnetbyaddr (ip, AF_INET); output_netent ("getnetbyaddr (inet_network (\"127.0.0.0\"), AF_INET)",nptr); @@ -335,6 +350,7 @@ main (void) /* setdb ("db"); */ + test_hosts (); test_network (); test_protocols (); diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 9f8eba9c4c..afb6f7c05a 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -454,17 +454,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (*f == '\0') conv_error (); - /* We must take care for EINTR errors. */ - if (c == EOF && errno == EINTR) - input_error (); - /* Find the conversion specifier. */ fc = *f++; if (skip_space || (fc != '[' && fc != 'c' && fc != 'C' && fc != 'n')) { /* Eat whitespace. */ do - if (inchar () == EOF && errno == EINTR) + if (inchar () == EOF) input_error (); while (isspace (c)); ungetc (c, s); @@ -474,6 +470,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) switch (fc) { case '%': /* Must match a literal '%'. */ + if (c == EOF) + input_error (); c = inchar (); if (c != fc) { @@ -538,7 +536,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) conv_error (); } - c = inchar (); + if (c != EOF) + c = inchar (); if (c == EOF) input_error (); @@ -554,10 +553,6 @@ __vfscanf (FILE *s, const char *format, va_list argptr) else while (--width > 0 && inchar () != EOF); - if (width > 0) - /* I.e., EOF was read. */ - --read_in; - if (!(flags & SUPPRESS)) ++done; @@ -580,6 +575,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) conv_error (); } + if (c == EOF) + input_error (); + do { #define NEXT_WIDE_CHAR(First) \ @@ -589,10 +587,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (First) \ input_error (); \ else \ - { \ - --read_in; \ - break; \ - } \ + break; \ val = c; \ if (val >= 0x80) \ { \ @@ -643,16 +638,12 @@ __vfscanf (FILE *s, const char *format, va_list argptr) \ if (!(flags & SUPPRESS)) \ *wstr++ = val; \ - first = 0 + First = 0 NEXT_WIDE_CHAR (first); } while (--width > 0); - if (width > 0) - /* I.e., EOF was read. */ - --read_in; - if (!(flags & SUPPRESS)) ++done; } @@ -684,7 +675,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) } STRING_ARG (str, char); - c = inchar (); + if (c != EOF) + c = inchar (); if (c == EOF) input_error (); @@ -750,6 +742,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) int first = 1; STRING_ARG (wstr, wchar_t); + if (c == EOF) + input_error (); + do { size_t cnt = 0; @@ -805,7 +800,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) number_signed = 1; number: - c = inchar (); + if (c != EOF) + c = inchar (); if (c == EOF) input_error (); @@ -926,7 +922,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) case 'G': case 'a': case 'A': - c = inchar (); + if (c != EOF) + c = inchar (); if (c == EOF) input_error (); @@ -1035,13 +1032,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (flags & LONG) { STRING_ARG (wstr, wchar_t); - c = '\0'; /* This is to keep gcc quiet. */ } else { STRING_ARG (str, char); - c = inchar (); + if (c != EOF) + c = inchar (); if (c == EOF) input_error (); } @@ -1099,6 +1096,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) wint_t val; int first = 1; + if (c == EOF) + input_error (); + do { size_t cnt = 0; @@ -1168,7 +1168,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) } } - /* The last thing we saw int the format string was a white space. + /* The last thing we saw in the format string was a white space. Consume the last white spaces. */ if (skip_space) { diff --git a/stdlib/drand48.c b/stdlib/drand48.c index 7fa6f33356..4668ead152 100644 --- a/stdlib/drand48.c +++ b/stdlib/drand48.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -27,7 +27,7 @@ drand48 () { double result; - (void) __erand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result); + (void) __erand48_r (__libc_drand48_data.x, &__libc_drand48_data, &result); return result; } diff --git a/stdlib/drand48_r.c b/stdlib/drand48_r.c index 7ce500a998..066c400f9c 100644 --- a/stdlib/drand48_r.c +++ b/stdlib/drand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -26,5 +26,5 @@ drand48_r (buffer, result) struct drand48_data *buffer; double *result; { - return __erand48_r (buffer->X, buffer, result); + return __erand48_r (buffer->x, buffer, result); } diff --git a/stdlib/lcong48_r.c b/stdlib/lcong48_r.c index ac30d7941a..32b948c946 100644 --- a/stdlib/lcong48_r.c +++ b/stdlib/lcong48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -28,12 +28,12 @@ __lcong48_r (param, buffer) { /* Store the given values. */ #if USHRT_MAX == 0xffffU - memcpy (buffer->X, ¶m[0], sizeof (buffer->X)); + memcpy (buffer->x, ¶m[0], sizeof (buffer->x)); memcpy (buffer->a, ¶m[3], sizeof (buffer->a)); #else - buffer->X[2] = (param[2] << 16) | param[1]; - buffer->X[1] = param[0] << 16; - buffer->X[0] = 0; + buffer->x[2] = (param[2] << 16) | param[1]; + buffer->x[1] = param[0] << 16; + buffer->x[0] = 0; buffer->a[2] = (param[5] << 16) | param[4]; buffer->a[1] = param[3] << 16; diff --git a/stdlib/lrand48.c b/stdlib/lrand48.c index 0c2593551b..1857ed4291 100644 --- a/stdlib/lrand48.c +++ b/stdlib/lrand48.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -27,7 +27,7 @@ lrand48 () { long int result; - (void) __nrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result); + (void) __nrand48_r (__libc_drand48_data.x, &__libc_drand48_data, &result); return result; } diff --git a/stdlib/lrand48_r.c b/stdlib/lrand48_r.c index de4dd99fea..40df2941c1 100644 --- a/stdlib/lrand48_r.c +++ b/stdlib/lrand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -28,5 +28,5 @@ lrand48_r (buffer, result) if (buffer == NULL) return -1; - return nrand48_r (buffer->X, buffer, result); + return nrand48_r (buffer->x, buffer, result); } diff --git a/stdlib/mrand48.c b/stdlib/mrand48.c index 9b0507c1af..aebb9b0117 100644 --- a/stdlib/mrand48.c +++ b/stdlib/mrand48.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -27,7 +27,7 @@ mrand48 () { long int result; - (void) __jrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result); + (void) __jrand48_r (__libc_drand48_data.x, &__libc_drand48_data, &result); return result; } diff --git a/stdlib/mrand48_r.c b/stdlib/mrand48_r.c index 23c0a1562b..f3bab4070e 100644 --- a/stdlib/mrand48_r.c +++ b/stdlib/mrand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -28,5 +28,5 @@ mrand48_r (buffer, result) if (buffer == NULL) return -1; - return jrand48_r (buffer->X, buffer, result); + return jrand48_r (buffer->x, buffer, result); } diff --git a/stdlib/seed48.c b/stdlib/seed48.c index f8f31b24c9..19bb215529 100644 --- a/stdlib/seed48.c +++ b/stdlib/seed48.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -28,5 +28,5 @@ seed48 (seed16v) { (void) __seed48_r (seed16v, &__libc_drand48_data); - return __libc_drand48_data.old_X; + return __libc_drand48_data.old_x; } diff --git a/stdlib/seed48_r.c b/stdlib/seed48_r.c index ec3a3ec561..910a2256c6 100644 --- a/stdlib/seed48_r.c +++ b/stdlib/seed48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -27,21 +27,21 @@ __seed48_r (seed16v, buffer) struct drand48_data *buffer; { /* Save old value at a private place to be used as return value. */ - memcpy (buffer->old_X, buffer->X, sizeof (buffer->X)); + memcpy (buffer->old_x, buffer->x, sizeof (buffer->x)); /* Install new state. */ #if USHRT_MAX == 0xffffU - buffer->X[2] = seed16v[2]; - buffer->X[1] = seed16v[1]; - buffer->X[0] = seed16v[0]; + buffer->x[2] = seed16v[2]; + buffer->x[1] = seed16v[1]; + buffer->x[0] = seed16v[0]; buffer->a[2] = 0x5; buffer->a[1] = 0xdeec; buffer->a[0] = 0xe66d; #else - buffer->X[2] = (seed16v[2] << 16) | seed16v[1]; - buffer->X[1] = seed16v[0] << 16; - buffer->X[0] = 0; + buffer->x[2] = (seed16v[2] << 16) | seed16v[1]; + buffer->x[1] = seed16v[0] << 16; + buffer->x[0] = 0; buffer->a[2] = 0x5deecUL; buffer->a[1] = 0xe66d0000UL; diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c index 763d5c4ef8..abaec32e5a 100644 --- a/stdlib/srand48_r.c +++ b/stdlib/srand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , August 1995. @@ -30,17 +30,17 @@ __srand48_r (seedval, buffer) seedval &= 0xffffffffl; #if USHRT_MAX == 0xffffU - buffer->X[2] = seedval >> 16; - buffer->X[1] = seedval & 0xffffl; - buffer->X[0] = 0x330e; + buffer->x[2] = seedval >> 16; + buffer->x[1] = seedval & 0xffffl; + buffer->x[0] = 0x330e; buffer->a[2] = 0x5; buffer->a[1] = 0xdeec; buffer->a[0] = 0xe66d; #else - buffer->X[2] = seedval; - buffer->X[1] = 0x330e0000UL; - buffer->X[0] = 0; + buffer->x[2] = seedval; + buffer->x[1] = 0x330e0000UL; + buffer->x[0] = 0; buffer->a[2] = 0x5deecUL; buffer->a[1] = 0xe66d0000UL; diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index aa7ac20c15..eb9d25ec6f 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -416,10 +416,10 @@ extern void lcong48 __P ((unsigned short int __param[7])); /* Data structure for communication with thread safe versions. */ struct drand48_data { - unsigned short int X[3]; /* Current state. */ + unsigned short int x[3]; /* Current state. */ unsigned short int a[3]; /* Factor in congruential formula. */ unsigned short int c; /* Additive const. in congruential formula. */ - unsigned short int old_X[3]; /* Old state. */ + unsigned short int old_x[3]; /* Old state. */ int init; /* Flag for initializing. */ }; diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index 4f8b5b70af..e1ff401e72 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -1,5 +1,5 @@ /* Formatting a monetary value according to the current locale. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper and Jochen Hein , 1996. @@ -296,7 +296,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) case 'i': /* Use international currency symbol. */ currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL); if (right_prec == -1) - if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == '\177') + if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX) right_prec = 2; else right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS); @@ -304,7 +304,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) case 'n': /* Use national currency symbol. */ currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL); if (right_prec == -1) - if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == '\177') + if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX) right_prec = 2; else right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS); diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h index f670d4cf04..6734996877 100644 --- a/sysdeps/generic/_G_config.h +++ b/sysdeps/generic/_G_config.h @@ -8,6 +8,7 @@ #include #define __need_size_t +#define __need_wchar_t #define __need_wint_t #define __need_NULL #include @@ -27,6 +28,7 @@ typedef unsigned int wint_t; #define _G_off64_t __off_t #define _G_pid_t __pid_t #define _G_uid_t __uid_t +#define _G_wchar_t wchar_t #define _G_wint_t wint_t #define _G_stat64 stat diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk index 6e9ad45966..a14c29cf98 100644 --- a/sysdeps/gnu/errlist.awk +++ b/sysdeps/gnu/errlist.awk @@ -85,7 +85,7 @@ END { print " };"; print ""; print "const int SYS_NERR = sizeof SYS_ERRLIST / sizeof SYS_ERRLIST [0];"; - print "#ifndef PIC"; + print "#if !defined HAVE_ELF || !defined PIC || !defined DO_VERSIONING"; print "weak_alias (_sys_errlist, sys_errlist)"; print "weak_alias (_sys_nerr, sys_nerr)"; print "#endif"; diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c index 0d12cb32c9..6b7b4d4f6b 100644 --- a/sysdeps/gnu/errlist.c +++ b/sysdeps/gnu/errlist.c @@ -815,7 +815,7 @@ TRANS This error code has no purpose. */ }; const int SYS_NERR = sizeof SYS_ERRLIST / sizeof SYS_ERRLIST [0]; -#ifndef PIC +#if !defined HAVE_ELF || !defined PIC || !defined DO_VERSIONING weak_alias (_sys_errlist, sys_errlist) weak_alias (_sys_nerr, sys_nerr) #endif diff --git a/sysdeps/libm-ieee754/e_exp.c b/sysdeps/libm-ieee754/e_exp.c index 9eba853c8f..a6d53eb9df 100644 --- a/sysdeps/libm-ieee754/e_exp.c +++ b/sysdeps/libm-ieee754/e_exp.c @@ -1,167 +1,179 @@ -/* @(#)e_exp.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_exp.c,v 1.8 1995/05/10 20:45:03 jtc Exp $"; -#endif +/* Double-precision floating point e^x. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating -/* __ieee754_exp(x) - * Returns the exponential of x. - * - * Method - * 1. Argument reduction: - * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658. - * Given x, find r and integer k such that - * - * x = k*ln2 + r, |r| <= 0.5*ln2. - * - * Here r will be represented as r = hi-lo for better - * accuracy. - * - * 2. Approximation of exp(r) by a special rational function on - * the interval [0,0.34658]: - * Write - * R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ... - * We use a special Reme algorithm on [0,0.34658] to generate - * a polynomial of degree 5 to approximate R. The maximum error - * of this polynomial approximation is bounded by 2**-59. In - * other words, - * R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5 - * (where z=r*r, and the values of P1 to P5 are listed below) - * and - * | 5 | -59 - * | 2.0+P1*z+...+P5*z - R(z) | <= 2 - * | | - * The computation of exp(r) thus becomes - * 2*r - * exp(r) = 1 + ------- - * R - r - * r*R1(r) - * = 1 + r + ----------- (for better accuracy) - * 2 - R1(r) - * where - * 2 4 10 - * R1(r) = r - (P1*r + P2*r + ... + P5*r ). - * - * 3. Scale back to obtain exp(x): - * From step 1, we have - * exp(x) = 2^k * exp(r) - * - * Special cases: - * exp(INF) is INF, exp(NaN) is NaN; - * exp(-INF) is 0, and - * for finite argument, only exp(0)=1 is exact. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Misc. info. - * For IEEE double - * if x > 7.09782712893383973096e+02 then exp(x) overflow - * if x < -7.45133219101941108420e+02 then exp(x) underflow - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -one = 1.0, -halF[2] = {0.5,-0.5,}, -huge = 1.0e+300, -twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/ -o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ -u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */ -ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */ - -6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */ -ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */ - -1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */ -P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ -P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ -P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ -P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ -P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ - - -#ifdef __STDC__ - double __ieee754_exp(double x) /* default IEEE double exp */ -#else - double __ieee754_exp(x) /* default IEEE double exp */ - double x; + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* How this works: + The basic design here is from + Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical + Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., + 17 (1), March 1991, pp. 26-45. + + The input value, x, is written as + + x = n * ln(2)_0 + t/512 + delta[t] + x + n * ln(2)_1 + + where: + - n is an integer, 1024 >= n >= -1075; + - ln(2)_0 is the first 43 bits of ln(2), and ln(2)_1 is the remainder, so + that |ln(2)_1| < 2^-32; + - t is an integer, 177 >= t >= -177 + - delta is based on a table entry, delta[t] < 2^-28 + - x is whatever is left, |x| < 2^-10 + + Then e^x is approximated as + + e^x = 2^n_1 ( 2^n_0 e^(t/512 + delta[t]) + + ( 2^n_0 e^(t/512 + delta[t]) + * ( p(x + n * ln(2)_1) + - n*ln(2)_1 + - n*ln(2)_1 * p(x + n * ln(2)_1) ) ) ) + + where + - p(x) is a polynomial approximating e(x)-1; + - e^(t/512 + delta[t]) is obtained from a table; + - n_1 + n_0 = n, so that |n_0| < DBL_MIN_EXP-1. + + If it happens that n_1 == 0 (this is the usual case), that multiplication + is omitted. + */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE #endif +#include +#include +#include +#include +#include +#include + +extern const float __exp_deltatable[178]; +extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; + +static const volatile double TWO1023 = 8.988465674311579539e+307; +static const volatile double TWOM1000 = 9.3326361850321887899e-302; + +double +__ieee754_exp (double x) { - double y,hi,lo,c,t; - int32_t k,xsb; - u_int32_t hx; - - GET_HIGH_WORD(hx,x); - xsb = (hx>>31)&1; /* sign bit of x */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out non-finite argument */ - if(hx >= 0x40862E42) { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) { - u_int32_t lx; - GET_LOW_WORD(lx,x); - if(((hx&0xfffff)|lx)!=0) - return x+x; /* NaN */ - else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ - } - if(x > o_threshold) return huge*huge; /* overflow */ - if(x < u_threshold) return twom1000*twom1000; /* underflow */ + static const uint32_t a_minf = 0xff800000; + static const double himark = 709.7827128933840868; + static const double lomark = -745.1332191