1998-02-13 17:39  Ulrich Drepper  <drepper@cygnus.com>

	* elf/Makefile: Don't use --version-script parameter to link ld.so
	unconditionally.

1998-01-02 04:19  Geoff Keating  <geoffk@ozemail.com.au>

	* 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  <schwab@issan.informatik.uni-dortmund.de>

	* 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
	<ctype.h> 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  <schwab@issan.informatik.uni-dortmund.de>

	* 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  <hjl@gnu.org>

	* 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  <drepper@cygnus.com>

	* stdlib/stdlib.h (struct drand48_data): Leave X to user macros
	and use x for member name.
	Reported by Daniel Lyddy <daniell@cs.berkeley.edu>.

	* 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  <aj@arthur.rhein-neckar.de>

	* nss/test-netdb.c: Add some more test cases.

1998-02-13 11:39  Ulrich Drepper  <drepper@cygnus.com>

	* libio/iovsscanf.c: Undo last change modifying errno.

1998-02-12  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* 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  <hjl@gnu.org>

	* db/Makefile ($(inst_libdir)/libndbm.a,
	$(inst_libdir)/libndbm.so): New targets.
	* db2/Makefile: Likewise.

1998-02-12 08:20  H.J. Lu  <hjl@gnu.org>

	* 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  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/_G_config.h: Define _G_wchar_t, for C++
	<streambuf.h>.
	* sysdeps/unix/sysv/linux/_G_config.h: Likewise.

1998-02-11  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/make-syscalls.sh: Fix sed pattern when dealing with
	versioned symbols.

1998-02-13 08:14  H.J. Lu  <hjl@gnu.org>

	* 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):
This commit is contained in:
Ulrich Drepper 1998-02-13 17:54:15 +00:00
parent e15867921d
commit dc30f46157
66 changed files with 1679 additions and 2307 deletions

160
ChangeLog
View file

@ -1,3 +1,143 @@
1998-02-13 17:39 Ulrich Drepper <drepper@cygnus.com>
* elf/Makefile: Don't use --version-script parameter to link ld.so
unconditionally.
1998-01-02 04:19 Geoff Keating <geoffk@ozemail.com.au>
* 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 <schwab@issan.informatik.uni-dortmund.de>
* 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
<ctype.h> 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 <schwab@issan.informatik.uni-dortmund.de>
* 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 <hjl@gnu.org>
* 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 <drepper@cygnus.com>
* stdlib/stdlib.h (struct drand48_data): Leave X to user macros
and use x for member name.
Reported by Daniel Lyddy <daniell@cs.berkeley.edu>.
* 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 <aj@arthur.rhein-neckar.de>
* nss/test-netdb.c: Add some more test cases.
1998-02-13 11:39 Ulrich Drepper <drepper@cygnus.com>
* libio/iovsscanf.c: Undo last change modifying errno.
1998-02-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* 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 <hjl@gnu.org>
* db/Makefile ($(inst_libdir)/libndbm.a,
$(inst_libdir)/libndbm.so): New targets.
* db2/Makefile: Likewise.
1998-02-12 08:20 H.J. Lu <hjl@gnu.org>
* 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 <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/generic/_G_config.h: Define _G_wchar_t, for C++
<streambuf.h>.
* sysdeps/unix/sysv/linux/_G_config.h: Likewise.
1998-02-11 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/make-syscalls.sh: Fix sed pattern when dealing with
versioned symbols.
1998-02-13 08:14 H.J. Lu <hjl@gnu.org>
* 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 <schwab@issan.informatik.uni-dortmund.de>
* 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 <hjl@gnu.org>
* 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 <pb@nexus.co.uk>
@ -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 <drepper@happy.cygnus.com>
* manual/users.texi: Rewrite to describe correct POSIX behaviour,
@ -185,7 +325,7 @@
1998-02-10 16:57 Ulrich Drepper <drepper@happy.cygnus.com>
* resolv/nss_dns/dns-host.c: Various code cleanups.
1998-02-09 08:10 H.J. Lu <hjl@gnu.org>
* 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 <hjl@gnu.org>
* 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 <rth@twiddle.rth.home>
* 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 <aj@arthur.rhein-neckar.de>
* manual/socket.texi (Host Address Functions): Clarify description
* manual/socket.texi (Host Address Functions): Clarify description
of inet_network.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,5 @@
/* 32-bit fixed point unsigned integer to 128-bit floating point.
Copyright (C) 1997 Free Software Foundation, Inc.
/* 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
@ -17,28 +17,21 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <quad_float.h>
#ifndef _GNU_LIBC_VERSION_H
#define _GNU_LIBC_VERSION_H 1
/* long double _q_utoq(unsigned int a);
Convert 'a' to long double.
*/
#include <features.h>
void
__q_utoq(unsigned int result[4], unsigned int a)
{
unsigned rx;
int cs, css;
__BEGIN_DECLS
/* Normalize. */
cs = cntlzw(a);
a <<= cs+1;
/* 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));
/* Calculate the exponent, in 4 easy instructions. */
css = 31-cs;
rx = 16383+css << 16 & ~css;
/* 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));
/* Put it all together. */
result[2] = result[3] = 0;
asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(a), "0"(rx));
result[1] = a << 16;
}
__END_DECLS
#endif /* gnu/libc-version.h */

View file

@ -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;

View file

@ -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;

View file

@ -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] =
{

View file

@ -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. */

View file

@ -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 <drepper@cygnus.com>, 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);
}

View file

@ -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

View file

@ -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));

View file

@ -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 ();

View file

@ -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)
{

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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);
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, August 1995.
@ -28,12 +28,12 @@ __lcong48_r (param, buffer)
{
/* Store the given values. */
#if USHRT_MAX == 0xffffU
memcpy (buffer->X, &param[0], sizeof (buffer->X));
memcpy (buffer->x, &param[0], sizeof (buffer->x));
memcpy (buffer->a, &param[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;

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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);
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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);
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;
}

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;

View file

@ -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 <drepper@gnu.ai.mit.edu>, 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;

View file

@ -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. */
};

View file

@ -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 <drepper@cygnus.com>
and Jochen Hein <Jochen.Hein@informatik.TU-Clausthal.de>, 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);

View file

@ -8,6 +8,7 @@
#include <bits/types.h>
#define __need_size_t
#define __need_wchar_t
#define __need_wint_t
#define __need_NULL
#include <stddef.h>
@ -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

View file

@ -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";

View file

@ -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

View file

@ -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.
* ====================================================
*/
/* 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 <geoffk@ozemail.com.au>
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: e_exp.c,v 1.8 1995/05/10 20:45:03 jtc Exp $";
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 <float.h>
#include <ieee754.h>
#include <math.h>
#include <fenv.h>
#include <inttypes.h>
#include <math_private.h>
/* __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.
*/
extern const float __exp_deltatable[178];
extern const double __exp_atable[355] /* __attribute__((mode(DF))) */;
#include "math.h"
#include "math_private.h"
static const volatile double TWO1023 = 8.988465674311579539e+307;
static const volatile double TWOM1000 = 9.3326361850321887899e-302;
#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;
#endif
double
__ieee754_exp (double x)
{
double y,hi,lo,c,t;
int32_t k,xsb;
u_int32_t hx;
static const uint32_t a_minf = 0xff800000;
static const double himark = 709.7827128933840868;
static const double lomark = -745.1332191019412221;
/* Check for usual case. */
if (isless (x, himark) && isgreater (x, lomark))
{
static const float TWO43 = 8796093022208.0;
static const float TWO52 = 4503599627370496.0;
/* 1/ln(2). */
static const double M_1_LN2 = 1.442695040888963387;
/* ln(2), part 1 */
static const double M_LN2_0 = .6931471805598903302;
/* ln(2), part 2 */
static const double M_LN2_1 = 5.497923018708371155e-14;
GET_HIGH_WORD(hx,x);
xsb = (hx>>31)&1; /* sign bit of x */
hx &= 0x7fffffff; /* high word of |x| */
int tval, unsafe, n_i;
double x22, n, t, dely, result;
union ieee754_double ex2_u, scale_u;
fenv_t oldenv;
/* 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 */
feholdexcept (&oldenv);
fesetround (FE_TONEAREST);
/* Calculate n. */
if (x >= 0)
{
n = x * M_1_LN2 + TWO52;
n -= TWO52;
}
else
{
n = x * M_1_LN2 - TWO52;
n += TWO52;
}
x = x - n*M_LN2_0;
if (x >= 0)
{
/* Calculate t/512. */
t = x + TWO43;
t -= TWO43;
x -= t;
/* Compute tval = t. */
tval = (int) (t * 512.0);
x -= __exp_deltatable[tval];
}
else
{
/* As above, but x is negative. */
t = x - TWO43;
t += TWO43;
x -= t;
tval = (int) (t * 512.0);
x += __exp_deltatable[-tval];
}
/* argument reduction */
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
} else {
k = invln2*x+halF[xsb];
t = k;
hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
lo = t*ln2LO[0];
}
x = hi - lo;
}
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
/* Now, the variable x contains x + n*ln(2)_1. */
dely = n*M_LN2_1;
/* x is now in primary range */
t = x*x;
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
if(k >= -1021) {
u_int32_t hy;
GET_HIGH_WORD(hy,y);
SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */
return y;
} else {
u_int32_t hy;
GET_HIGH_WORD(hy,y);
SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */
return y*twom1000;
}
/* Compute ex2 = 2^n_0 e^(t/512+delta[t]). */
ex2_u.d = __exp_atable[tval+177];
n_i = (int)n;
/* 'unsafe' is 1 iff n_1 != 0. */
unsafe = abs(n_i) >= -DBL_MIN_EXP - 1;
ex2_u.ieee.exponent += n_i >> unsafe;
/* Compute scale = 2^n_1. */
scale_u.d = 1.0;
scale_u.ieee.exponent += n_i - (n_i >> unsafe);
/* Approximate e^x2 - 1, using a fourth-degree polynomial,
with maximum error in [-2^-10-2^-28,2^-10+2^-28]
less than 4.9e-19. */
x22 = (((0.04166666898464281565
* x + 0.1666666766008501610)
* x + 0.499999999999990008)
* x + 0.9999999999999976685) * x;
/* Allow for impact of dely. */
x22 -= dely + dely*x22;
/* Return result. */
fesetenv (&oldenv);
result = x22 * ex2_u.d + ex2_u.d;
if (!unsafe)
return result;
else
return result * scale_u.d;
}
/* Exceptional cases: */
else if (isless (x, himark))
{
if (x == *(const float *) &a_minf)
/* e^-inf == 0, with no error. */
return 0;
else
/* Underflow */
return TWOM1000 * TWOM1000;
}
else
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO1023*x;
}

View file

@ -1,104 +1,157 @@
/* e_expf.c -- float version of e_exp.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
/* Single-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 <geoffk@ozemail.com.au>
/*
* ====================================================
* 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.
* ====================================================
*/
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.
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: e_expf.c,v 1.6 1996/04/08 15:43:43 phil Exp $";
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 input value, x, is written as
x = n * ln(2) + t/512 + delta[t] + x;
where:
- n is an integer, 127 >= n >= -150;
- 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 ( e^(t/512 + delta[t])
+ ( e^(t/512 + delta[t])
* ( p(x + delta[t] + n * ln(2)) - delta ) ) )
where
- p(x) is a polynomial approximating e(x)-1;
- e^(t/512 + delta[t]) is obtained from a table.
The table used is the same one as for the double precision version;
since we have the table, we might as well use it.
It turns out to be faster to do calculations in double precision than
to perform an 'accurate table method' expf, because of the range reduction
overhead (compare exp2f).
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <float.h>
#include <ieee754.h>
#include <math.h>
#include <fenv.h>
#include <inttypes.h>
#include <math_private.h>
#include "math.h"
#include "math_private.h"
extern const float __exp_deltatable[178];
extern const double __exp_atable[355] /* __attribute__((mode(DF))) */;
static const float huge = 1.0e+30;
static const volatile float TWOM100 = 7.88860905e-31;
static const volatile float TWO127 = 1.7014118346e+38;
#ifdef __STDC__
static const float
#else
static float
#endif
one = 1.0,
halF[2] = {0.5,-0.5,},
twom100 = 7.8886090522e-31, /* 2**-100=0x0d800000 */
o_threshold= 8.8721679688e+01, /* 0x42b17180 */
u_threshold= -1.0397208405e+02, /* 0xc2cff1b5 */
ln2HI[2] ={ 6.9313812256e-01, /* 0x3f317180 */
-6.9313812256e-01,}, /* 0xbf317180 */
ln2LO[2] ={ 9.0580006145e-06, /* 0x3717f7d1 */
-9.0580006145e-06,}, /* 0xb717f7d1 */
invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */
P1 = 1.6666667163e-01, /* 0x3e2aaaab */
P2 = -2.7777778450e-03, /* 0xbb360b61 */
P3 = 6.6137559770e-05, /* 0x388ab355 */
P4 = -1.6533901999e-06, /* 0xb5ddea0e */
P5 = 4.1381369442e-08; /* 0x3331bb4c */
#ifdef __STDC__
float __ieee754_expf(float x) /* default IEEE double exp */
#else
float __ieee754_expf(x) /* default IEEE double exp */
float x;
#endif
float
__ieee754_expf (float x)
{
float y,hi,lo,c,t;
int32_t k,xsb;
u_int32_t hx;
static const uint32_t a_minf = 0xff800000;
static const float himark = 88.72283935546875;
static const float lomark = -103.972084045410;
/* Check for usual case. */
if (isless (x, himark) && isgreater (x, lomark))
{
static const float TWO43 = 8796093022208.0;
static const float TWO23 = 8388608.0;
/* 1/ln(2). */
#undef M_1_LN2
static const float M_1_LN2 = 1.44269502163f;
/* ln(2) */
#undef M_LN2
static const double M_LN2 = .6931471805599452862;
GET_FLOAT_WORD(hx,x);
xsb = (hx>>31)&1; /* sign bit of x */
hx &= 0x7fffffff; /* high word of |x| */
int tval;
double x22, t, result, dx;
float n, delta;
union ieee754_double ex2_u;
fenv_t oldenv;
/* filter out non-finite argument */
if(hx >= 0x42b17218) { /* if |x|>=88.721... */
if(hx>0x7f800000)
return x+x; /* NaN */
if(hx==0x7f800000)
return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */
if(x > o_threshold) return huge*huge; /* overflow */
if(x < u_threshold) return twom100*twom100; /* underflow */
feholdexcept (&oldenv);
fesetround (FE_TONEAREST);
/* Calculate n. */
if (x >= 0)
{
n = x * M_1_LN2 + TWO23;
n -= TWO23;
}
else
{
n = x * M_1_LN2 - TWO23;
n += TWO23;
}
dx = x - n*M_LN2;
if (dx >= 0)
{
/* Calculate t/512. */
t = dx + TWO43;
t -= TWO43;
dx -= t;
/* Compute tval = t. */
tval = (int) (t * 512.0);
delta = - __exp_deltatable[tval];
}
else
{
/* As above, but x is negative. */
t = dx - TWO43;
t += TWO43;
dx -= t;
tval = (int) (t * 512.0);
delta = __exp_deltatable[-tval];
}
/* argument reduction */
if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */
if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
} else {
k = invln2*x+halF[xsb];
t = k;
hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
lo = t*ln2LO[0];
}
x = hi - lo;
}
else if(hx < 0x31800000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
/* Compute ex2 = 2^n e^(t/512+delta[t]). */
ex2_u.d = __exp_atable[tval+177];
ex2_u.ieee.exponent += (int) n;
/* x is now in primary range */
t = x*x;
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-(float)2.0)-x);
else y = one-((lo-(x*c)/((float)2.0-c))-hi);
if(k >= -125) {
u_int32_t hy;
GET_FLOAT_WORD(hy,y);
SET_FLOAT_WORD(y,hy+(k<<23)); /* add k to y's exponent */
return y;
} else {
u_int32_t hy;
GET_FLOAT_WORD(hy,y);
SET_FLOAT_WORD(y,hy+((k+100)<<23)); /* add k to y's exponent */
return y*twom100;
}
/* Approximate e^(dx+delta) - 1, using a second-degree polynomial,
with maximum error in [-2^-10-2^-28,2^-10+2^-28]
less than 5e-11. */
x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta;
/* Return result. */
fesetenv (&oldenv);
result = x22 * ex2_u.d + ex2_u.d;
return (float) result;
}
/* Exceptional cases: */
else if (isless (x, himark))
{
if (x == *(const float *) &a_minf)
/* e^-inf == 0, with no error. */
return 0;
else
/* Underflow */
return TWOM100 * TWOM100;
}
else
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO127*x;
}

View file

@ -36,21 +36,23 @@
#include "t_exp2.h"
static const volatile double TWO1000 = 1.071508607186267320948e+301;
static const volatile double TWO1023 = 8.988465674311579539e+307;
static const volatile double TWOM1000 = 9.3326361850321887899e-302;
double
__ieee754_exp2 (double x)
{
static const uint32_t a_inf = 0x7f800000;
static const uint32_t a_minf = 0xff800000;
static const double himark = (double) DBL_MAX_EXP;
static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1) - 1.0;
/* Check for usual case. */
if (isless (x, (double) DBL_MAX_EXP)
&& isgreater (x, (double) (DBL_MIN_EXP - 1)))
if (isless (x, himark) && isgreater (x, lomark))
{
static const float TWO43 = 8796093022208.0;
int tval;
double rx, x22;
union ieee754_double ex2_u;
int tval, unsafe;
double rx, x22, result;
union ieee754_double ex2_u, scale_u;
fenv_t oldenv;
feholdexcept (&oldenv);
@ -95,37 +97,42 @@ __ieee754_exp2 (double x)
/* 3. Compute ex2 = 2^(t/512+e+ex). */
ex2_u.d = exp2_accuratetable[tval & 511];
ex2_u.ieee.exponent += tval >> 9;
tval >>= 9;
unsafe = abs(tval) >= -DBL_MIN_EXP - 1;
ex2_u.ieee.exponent += tval >> unsafe;
scale_u.d = 1.0;
scale_u.ieee.exponent += tval - (tval >> unsafe);
/* 4. Approximate 2^x2 - 1, using a fourth-degree polynomial,
2^x2 ~= sum(k=0..4 | (x2 * ln(2))^k / k! ) +
so
2^x2 - 1 ~= sum(k=1..4 | (x2 * ln(2))^k / k! )
with error less than 2^(1/1024) * (x2 * ln(2))^5 / 5! < 1.2e-18. */
with maximum error in [-2^-10-2^-30,2^-10+2^-30]
less than 10^-19. */
x22 = (((.0096181291076284772
* x + .055504108664821580)
* x + .240226506959100712)
* x + .69314718055994531) * ex2_u.d;
x22 = (((.0096181293647031180
* x + .055504110254308625)
* x + .240226506959100583)
* x + .69314718055994495) * ex2_u.d;
/* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */
fesetenv (&oldenv);
/* Need to check: does this set FE_INEXACT correctly? */
return x22 * x + ex2_u.d;
result = x22 * x + ex2_u.d;
if (!unsafe)
return result;
else
return result * scale_u.d;
}
/* 2^inf == inf, with no error. */
else if (x == *(const float *) &a_inf)
return x;
/* Check for overflow. */
else if (isgreaterequal (x, (double) DBL_MAX_EXP))
return TWO1000 * TWO1000;
/* And underflow (including -inf). */
else if (isless (x, (double) (DBL_MIN_EXP - DBL_MANT_DIG)))
return TWOM1000 * TWOM1000;
/* Maybe the result needs to be a denormalised number... */
else if (!isnan (x))
return __ieee754_exp2 (x + 1000.0) * TWOM1000;
else /* isnan(x) */
return x + x;
/* Exceptional cases: */
else if (isless (x, himark))
{
if (x == *(const float *) &a_minf)
/* e^-inf == 0, with no error. */
return 0;
else
/* Underflow */
return TWOM1000 * TWOM1000;
}
else
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO1023*x;
}

View file

@ -38,20 +38,22 @@
#include "t_exp2f.h"
static const volatile float TWOM100 = 7.88860905e-31;
static const volatile float huge = 1e+30;
static const volatile float TWO127 = 1.7014118346e+38;
float
__ieee754_exp2f (float x)
{
static const uint32_t a_inf = 0x7f800000;
static const uint32_t a_minf = 0xff800000;
static const float himark = (float) FLT_MAX_EXP;
static const float lomark = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1) - 1.0;
/* Check for usual case. */
if (isless (x, (float) FLT_MAX_EXP)
&& isgreater (x, (float) (FLT_MIN_EXP - 1)))
if (isless (x, himark) && isgreater (x, lomark))
{
static const float TWO16 = 65536.0;
int tval;
float rx, x22;
union ieee754_float ex2_u;
static const float TWO15 = 32768.0;
int tval, unsafe;
float rx, x22, result;
union ieee754_float ex2_u, scale_u;
fenv_t oldenv;
feholdexcept (&oldenv);
@ -68,13 +70,13 @@ __ieee754_exp2f (float x)
First, calculate rx = ex + t/256. */
if (x >= 0)
{
rx = x + TWO16;
rx -= TWO16;
rx = x + TWO15;
rx -= TWO15;
}
else
{
rx = x - TWO16;
rx += TWO16;
rx = x - TWO15;
+ rx += TWO15;
}
x -= rx; /* Compute x=x1. */
/* Compute tval = (ex*256 + t)+128.
@ -92,40 +94,43 @@ __ieee754_exp2f (float x)
/* 'tval & 255' is the same as 'tval%256' except that it's always
positive.
Compute x = x2. */
x -= exp2_deltatable[tval & 255];
x -= __exp2_deltatable[tval & 255];
/* 3. Compute ex2 = 2^(t/255+e+ex). */
ex2_u.f = exp2_accuratetable[tval & 255];
ex2_u.ieee.exponent += tval >> 8;
ex2_u.f = __exp2f_atable[tval & 255];
tval >>= 8;
unsafe = abs(tval) >= -FLT_MIN_EXP - 1;
ex2_u.ieee.exponent += tval >> unsafe;
scale_u.f = 1.0;
scale_u.ieee.exponent += tval - (tval >> unsafe);
/* 4. Approximate 2^x2 - 1, using a second-degree polynomial,
2^x2 ~= sum(k=0..2 | (x2 * ln(2))^k / k! ) +
so
2^x2 - 1 ~= sum(k=1..4 | (x2 * ln(2))^k / k! )
with error less than 2^(1/512+7e-4) * (x2 * ln(2))^3 / 3! < 1.2e-18. */
with maximum error in [-2^-9 - 2^-14, 2^-9 + 2^-14]
less than 1.3e-10. */
x22 = (.240226507f * x + .6931471806f) * ex2_u.f;
x22 = (.24022656679f * x + .69314736128f) * ex2_u.f;
/* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */
fesetenv (&oldenv);
/* Need to check: does this set FE_INEXACT correctly? */
return x22 * x + ex2_u.f;
result = x22 * x + ex2_u.f;
if (!unsafe)
return result;
else
return result * scale_u.f;
}
/* 2^inf == inf, with no error. */
else if (x == *(const float *)&a_inf)
/* Exceptional cases: */
else if (isless (x, himark))
{
return x;
if (x == *(const float *) &a_minf)
/* e^-inf == 0, with no error. */
return 0;
else
/* Underflow */
return TWOM100 * TWOM100;
}
/* Check for overflow. */
else if (isgreaterequal (x, (float) FLT_MAX_EXP))
return huge * huge;
/* And underflow (including -inf). */
else if (isless (x, (float) (FLT_MIN_EXP - FLT_MANT_DIG)))
return TWOM100 * TWOM100;
/* Maybe the result needs to be a denormalised number... */
else if (!isnan (x))
return __ieee754_exp2f (x + 100.0) * TWOM100;
else /* isnan(x) */
return x + x;
else
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO127*x;
}

View file

@ -0,0 +1,436 @@
/* Accurate tables for exp().
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
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. */
/* This table has the property that, for all integers -177 <= i <= 177,
exp(i/512.0 + __exp_deltatable[abs(i)]) == __exp_atable[i+177] + r
for some -2^-64 < r < 2^-64 (abs(r) < 2^-65 if i <= 0); and that
__exp_deltatable[abs(i)] == t * 2^-60
for integer t so that abs(t) <= 8847927 * 2^8. */
#define W52 (2.22044605e-16)
#define W55 (2.77555756e-17)
#define W58 (3.46944695e-18)
#define W59 (1.73472348e-18)
#define W60 (8.67361738e-19)
const float __exp_deltatable[178] = {
0*W60, 16558714*W60, -10672149*W59, 1441652*W60,
-15787963*W55, 462888*W60, 7291806*W60, 1698880*W60,
-14375103*W58, -2021016*W60, 728829*W60, -3759654*W60,
3202123*W60, -10916019*W58, -251570*W60, -1043086*W60,
8207536*W60, -409964*W60, -5993931*W60, -475500*W60,
2237522*W60, 324170*W60, -244117*W60, 32077*W60,
123907*W60, -1019734*W60, -143*W60, 813077*W60,
743345*W60, 462461*W60, 629794*W60, 2125066*W60,
-2339121*W60, -337951*W60, 9922067*W60, -648704*W60,
149407*W60, -2687209*W60, -631608*W60, 2128280*W60,
-4882082*W60, 2001360*W60, 175074*W60, 2923216*W60,
-538947*W60, -1212193*W60, -1920926*W60, -1080577*W60,
3690196*W60, 2643367*W60, 2911937*W60, 671455*W60,
-1128674*W60, 593282*W60, -5219347*W60, -1941490*W60,
11007953*W60, 239609*W60, -2969658*W60, -1183650*W60,
942998*W60, 699063*W60, 450569*W60, -329250*W60,
-7257875*W60, -312436*W60, 51626*W60, 555877*W60,
-641761*W60, 1565666*W60, 884327*W60, -10960035*W60,
-2004679*W60, -995793*W60, -2229051*W60, -146179*W60,
-510327*W60, 1453482*W60, -3778852*W60, -2238056*W60,
-4895983*W60, 3398883*W60, -252738*W60, 1230155*W60,
346918*W60, 1109352*W60, 268941*W60, -2930483*W60,
-1036263*W60, -1159280*W60, 1328176*W60, 2937642*W60,
-9371420*W60, -6902650*W60, -1419134*W60, 1442904*W60,
-1319056*W60, -16369*W60, 696555*W60, -279987*W60,
-7919763*W60, 252741*W60, 459711*W60, -1709645*W60,
354913*W60, 6025867*W60, -421460*W60, -853103*W60,
-338649*W60, 962151*W60, 955965*W60, 784419*W60,
-3633653*W60, 2277133*W60, -8847927*W52, 1223028*W60,
5907079*W60, 623167*W60, 5142888*W60, 2599099*W60,
1214280*W60, 4870359*W60, 593349*W60, -57705*W60,
7761209*W60, -5564097*W60, 2051261*W60, 6216869*W60,
4692163*W60, 601691*W60, -5264906*W60, 1077872*W60,
-3205949*W60, 1833082*W60, 2081746*W60, -987363*W60,
-1049535*W60, 2015244*W60, 874230*W60, 2168259*W60,
-1740124*W60, -10068269*W60, -18242*W60, -3013583*W60,
580601*W60, -2547161*W60, -535689*W60, 2220815*W60,
1285067*W60, 2806933*W60, -983086*W60, -1729097*W60,
-1162985*W60, -2561904*W60, 801988*W60, 244351*W60,
1441893*W60, -7517981*W60, 271781*W60, -15021588*W60,
-2341588*W60, -919198*W60, 1642232*W60, 4771771*W60,
-1220099*W60, -3062372*W60, 628624*W60, 1278114*W60,
13083513*W60, -10521925*W60, 3180310*W60, -1659307*W60,
3543773*W60, 2501203*W60, 4151*W60, -340748*W60,
-2285625*W60, 2495202*W60
};
const double __exp_atable[355] /* __attribute__((mode(DF))) */ = {
0.707722561055888932371, /* 0x0.b52d4e46605c27ffd */
0.709106182438804188967, /* 0x0.b587fb96f75097ffb */
0.710492508843861281234, /* 0x0.b5e2d649899167ffd */
0.711881545564593931623, /* 0x0.b63dde74d36bdfffe */
0.713273297897442870573, /* 0x0.b699142f945f87ffc */
0.714667771153751463236, /* 0x0.b6f477909c4ea0001 */
0.716064970655995725059, /* 0x0.b75008aec758f8004 */
0.717464901723956938193, /* 0x0.b7abc7a0eea7e0002 */
0.718867569715736398602, /* 0x0.b807b47e1586c7ff8 */
0.720272979947266023271, /* 0x0.b863cf5d10e380003 */
0.721681137825144314297, /* 0x0.b8c01855195c37ffb */
0.723092048691992950199, /* 0x0.b91c8f7d213740004 */
0.724505717938892290800, /* 0x0.b97934ec5002d0007 */
0.725922150953176470431, /* 0x0.b9d608b9c92ea7ffc */
0.727341353138962865022, /* 0x0.ba330afcc29e98003 */
0.728763329918453162104, /* 0x0.ba903bcc8618b7ffc */
0.730188086709957051568, /* 0x0.baed9b40591ba0000 */
0.731615628948127705309, /* 0x0.bb4b296f931e30002 */
0.733045962086486091436, /* 0x0.bba8e671a05617ff9 */
0.734479091556371366251, /* 0x0.bc06d25dd49568001 */
0.735915022857225542529, /* 0x0.bc64ed4bce8f6fff9 */
0.737353761441304711410, /* 0x0.bcc33752f915d7ff9 */
0.738795312814142124419, /* 0x0.bd21b08af98e78005 */
0.740239682467211168593, /* 0x0.bd80590b65e9a8000 */
0.741686875913991849885, /* 0x0.bddf30ebec4a10000 */
0.743136898669507939299, /* 0x0.be3e38443c84e0007 */
0.744589756269486091620, /* 0x0.be9d6f2c1d32a0002 */
0.746045454254026796384, /* 0x0.befcd5bb59baf8004 */
0.747503998175051087583, /* 0x0.bf5c6c09ca84c0003 */
0.748965393601880857739, /* 0x0.bfbc322f5b18b7ff8 */
0.750429646104262104698, /* 0x0.c01c2843f776fffff */
0.751896761271877989160, /* 0x0.c07c4e5fa18b88002 */
0.753366744698445112140, /* 0x0.c0dca49a5fb18fffd */
0.754839601988627206827, /* 0x0.c13d2b0c444db0005 */
0.756315338768691947122, /* 0x0.c19de1cd798578006 */
0.757793960659406629066, /* 0x0.c1fec8f623723fffd */
0.759275473314173443536, /* 0x0.c25fe09e8a0f47ff8 */
0.760759882363831851927, /* 0x0.c2c128dedc88f8000 */
0.762247193485956486805, /* 0x0.c322a1cf7d6e7fffa */
0.763737412354726363781, /* 0x0.c3844b88cb9347ffc */
0.765230544649828092739, /* 0x0.c3e626232bd8f7ffc */
0.766726596071518051729, /* 0x0.c44831b719bf18002 */
0.768225572321911687194, /* 0x0.c4aa6e5d12d078001 */
0.769727479119219348810, /* 0x0.c50cdc2da64a37ffb */
0.771232322196981678892, /* 0x0.c56f7b41744490001 */
0.772740107296721268087, /* 0x0.c5d24bb1259e70004 */
0.774250840160724651565, /* 0x0.c6354d95640dd0007 */
0.775764526565368872643, /* 0x0.c6988106fec447fff */
0.777281172269557396602, /* 0x0.c6fbe61eb1bd0ffff */
0.778800783068235302750, /* 0x0.c75f7cf560942fffc */
0.780323364758801041312, /* 0x0.c7c345a3f1983fffe */
0.781848923151573727006, /* 0x0.c8274043594cb0002 */
0.783377464064598849602, /* 0x0.c88b6cec94b3b7ff9 */
0.784908993312207869935, /* 0x0.c8efcbb89cba27ffe */
0.786443516765346961618, /* 0x0.c9545cc0a88c70003 */
0.787981040257604625744, /* 0x0.c9b9201dc643bfffa */
0.789521569657452682047, /* 0x0.ca1e15e92a5410007 */
0.791065110849462849192, /* 0x0.ca833e3c1ae510005 */
0.792611669712891875319, /* 0x0.cae8992fd84667ffd */
0.794161252150049179450, /* 0x0.cb4e26ddbc207fff8 */
0.795713864077794763584, /* 0x0.cbb3e75f301b60003 */
0.797269511407239561694, /* 0x0.cc19dacd978cd8002 */
0.798828200086368567220, /* 0x0.cc8001427e55d7ffb */
0.800389937624300440456, /* 0x0.cce65ade24d360006 */
0.801954725261124767840, /* 0x0.cd4ce7a5de839fffb */
0.803522573691593189330, /* 0x0.cdb3a7c79a678fffd */
0.805093487311204114563, /* 0x0.ce1a9b563965ffffc */
0.806667472122675088819, /* 0x0.ce81c26b838db8000 */
0.808244534127439906441, /* 0x0.cee91d213f8428002 */
0.809824679342317166307, /* 0x0.cf50ab9144d92fff9 */
0.811407913793616542005, /* 0x0.cfb86dd5758c2ffff */
0.812994243520784198882, /* 0x0.d0206407c20e20005 */
0.814583674571603966162, /* 0x0.d0888e4223facfff9 */
0.816176213022088536960, /* 0x0.d0f0ec9eb3f7c8002 */
0.817771864936188586101, /* 0x0.d1597f377d6768002 */
0.819370636400374108252, /* 0x0.d1c24626a46eafff8 */
0.820972533518165570298, /* 0x0.d22b41865ff1e7ff9 */
0.822577562404315121269, /* 0x0.d2947170f32ec7ff9 */
0.824185729164559344159, /* 0x0.d2fdd60097795fff8 */
0.825797039949601741075, /* 0x0.d3676f4fb796d0001 */
0.827411500902565544264, /* 0x0.d3d13d78b5f68fffb */
0.829029118181348834154, /* 0x0.d43b40960546d8001 */
0.830649897953322891022, /* 0x0.d4a578c222a058000 */
0.832273846408250750368, /* 0x0.d50fe617a3ba78005 */
0.833900969738858188772, /* 0x0.d57a88b1218e90002 */
0.835531274148056613016, /* 0x0.d5e560a94048f8006 */
0.837164765846411529371, /* 0x0.d6506e1aac8078003 */
0.838801451086016225394, /* 0x0.d6bbb1204074e0001 */
0.840441336100884561780, /* 0x0.d72729d4c28518004 */
0.842084427144139224814, /* 0x0.d792d8530e12b0001 */
0.843730730487052604790, /* 0x0.d7febcb61273e7fff */
0.845380252404570153833, /* 0x0.d86ad718c308dfff9 */
0.847032999194574087728, /* 0x0.d8d727962c69d7fff */
0.848688977161248581090, /* 0x0.d943ae49621ce7ffb */
0.850348192619261200615, /* 0x0.d9b06b4d832ef8005 */
0.852010651900976245816, /* 0x0.da1d5ebdc22220005 */
0.853676361342631029337, /* 0x0.da8a88b555baa0006 */
0.855345327311054837175, /* 0x0.daf7e94f965f98004 */
0.857017556155879489641, /* 0x0.db6580a7c98f7fff8 */
0.858693054267390953857, /* 0x0.dbd34ed9617befff8 */
0.860371828028939855647, /* 0x0.dc4153ffc8b65fff9 */
0.862053883854957292436, /* 0x0.dcaf90368bfca8004 */
0.863739228154875360306, /* 0x0.dd1e0399328d87ffe */
0.865427867361348468455, /* 0x0.dd8cae435d303fff9 */
0.867119807911702289458, /* 0x0.ddfb9050b1cee8006 */
0.868815056264353846599, /* 0x0.de6aa9dced8448001 */
0.870513618890481399881, /* 0x0.ded9fb03db7320006 */
0.872215502247877139094, /* 0x0.df4983e1380657ff8 */
0.873920712852848668986, /* 0x0.dfb94490ffff77ffd */
0.875629257204025623884, /* 0x0.e0293d2f1cb01fff9 */
0.877341141814212965880, /* 0x0.e0996dd786fff0007 */
0.879056373217612985183, /* 0x0.e109d6a64f5d57ffc */
0.880774957955916648615, /* 0x0.e17a77b78e72a7ffe */
0.882496902590150900078, /* 0x0.e1eb5127722cc7ff8 */
0.884222213673356738383, /* 0x0.e25c63121fb0c8006 */
0.885950897802399772740, /* 0x0.e2cdad93ec5340003 */
0.887682961567391237685, /* 0x0.e33f30c925fb97ffb */
0.889418411575228162725, /* 0x0.e3b0ecce2d05ffff9 */
0.891157254447957902797, /* 0x0.e422e1bf727718006 */
0.892899496816652704641, /* 0x0.e4950fb9713fc7ffe */
0.894645145323828439008, /* 0x0.e50776d8b0e60fff8 */
0.896394206626591749641, /* 0x0.e57a1739c8fadfffc */
0.898146687421414902124, /* 0x0.e5ecf0f97c5798007 */
0.899902594367530173098, /* 0x0.e660043464e378005 */
0.901661934163603406867, /* 0x0.e6d3510747e150006 */
0.903424713533971135418, /* 0x0.e746d78f06cd97ffd */
0.905190939194458810123, /* 0x0.e7ba97e879c91fffc */
0.906960617885092856864, /* 0x0.e82e92309390b0007 */
0.908733756358986566306, /* 0x0.e8a2c6845544afffa */
0.910510361377119825629, /* 0x0.e9173500c8abc7ff8 */
0.912290439722343249336, /* 0x0.e98bddc30f98b0002 */
0.914073998177417412765, /* 0x0.ea00c0e84bc4c7fff */
0.915861043547953501680, /* 0x0.ea75de8db8094fffe */
0.917651582652244779397, /* 0x0.eaeb36d09d3137ffe */
0.919445622318405764159, /* 0x0.eb60c9ce4ed3dffff */
0.921243169397334638073, /* 0x0.ebd697a43995b0007 */
0.923044230737526172328, /* 0x0.ec4ca06fc7768fffa */
0.924848813220121135342, /* 0x0.ecc2e44e865b6fffb */
0.926656923710931002014, /* 0x0.ed39635df34e70006 */
0.928468569126343790092, /* 0x0.edb01dbbc2f5b7ffa */
0.930283756368834757725, /* 0x0.ee2713859aab57ffa */
0.932102492359406786818, /* 0x0.ee9e44d9342870004 */
0.933924784042873379360, /* 0x0.ef15b1d4635438005 */
0.935750638358567643520, /* 0x0.ef8d5a94f60f50007 */
0.937580062297704630580, /* 0x0.f0053f38f345cffff */
0.939413062815381727516, /* 0x0.f07d5fde3a2d98001 */
0.941249646905368053689, /* 0x0.f0f5bca2d481a8004 */
0.943089821583810716806, /* 0x0.f16e55a4e497d7ffe */
0.944933593864477061592, /* 0x0.f1e72b028a2827ffb */
0.946780970781518460559, /* 0x0.f2603cd9fb5430001 */
0.948631959382661205081, /* 0x0.f2d98b497d2a87ff9 */
0.950486566729423554277, /* 0x0.f353166f63e3dffff */
0.952344799896018723290, /* 0x0.f3ccde6a11ae37ffe */
0.954206665969085765512, /* 0x0.f446e357f66120000 */
0.956072172053890279009, /* 0x0.f4c12557964f0fff9 */
0.957941325265908139014, /* 0x0.f53ba48781046fffb */
0.959814132734539637840, /* 0x0.f5b66106555d07ffa */
0.961690601603558903308, /* 0x0.f6315af2c2027fffc */
0.963570739036113010927, /* 0x0.f6ac926b8aeb80004 */
0.965454552202857141381, /* 0x0.f728078f7c5008002 */
0.967342048278315158608, /* 0x0.f7a3ba7d66a908001 */
0.969233234469444204768, /* 0x0.f81fab543e1897ffb */
0.971128118008140250896, /* 0x0.f89bda33122c78007 */
0.973026706099345495256, /* 0x0.f9184738d4cf97ff8 */
0.974929006031422851235, /* 0x0.f994f284d3a5c0008 */
0.976835024947348973265, /* 0x0.fa11dc35bc7820002 */
0.978744770239899142285, /* 0x0.fa8f046b4fb7f8007 */
0.980658249138918636210, /* 0x0.fb0c6b449ab1cfff9 */
0.982575468959622777535, /* 0x0.fb8a10e1088fb7ffa */
0.984496437054508843888, /* 0x0.fc07f5602d79afffc */
0.986421160608523028820, /* 0x0.fc8618e0e55e47ffb */
0.988349647107594098099, /* 0x0.fd047b83571b1fffa */
0.990281903873210800357, /* 0x0.fd831d66f4c018002 */
0.992217938695037382475, /* 0x0.fe01fead3320bfff8 */
0.994157757657894713987, /* 0x0.fe811f703491e8006 */
0.996101369488558541238, /* 0x0.ff007fd5744490005 */
0.998048781093141101932, /* 0x0.ff801ffa9b9280007 */
1.000000000000000000000, /* 0x1.00000000000000000 */
1.001955033605393285965, /* 0x1.0080200565d29ffff */
1.003913889319761887310, /* 0x1.0100802aa0e80fff0 */
1.005876574715736104818, /* 0x1.01812090377240007 */
1.007843096764807100351, /* 0x1.020201541aad7fff6 */
1.009813464316352327214, /* 0x1.0283229c4c9820007 */
1.011787683565730677817, /* 0x1.030484836910a000e */
1.013765762469146736174, /* 0x1.0386272b9c077fffe */
1.015747708536026694351, /* 0x1.04080ab526304fff0 */
1.017733529475172815584, /* 0x1.048a2f412375ffff0 */
1.019723232714418781378, /* 0x1.050c94ef7ad5e000a */
1.021716825883923762690, /* 0x1.058f3be0f1c2d0004 */
1.023714316605201180057, /* 0x1.06122436442e2000e */
1.025715712440059545995, /* 0x1.06954e0fec63afff2 */
1.027721021151397406936, /* 0x1.0718b98f41c92fff6 */
1.029730250269221158939, /* 0x1.079c66d49bb2ffff1 */
1.031743407506447551857, /* 0x1.082056011a9230009 */
1.033760500517691527387, /* 0x1.08a487359ebd50002 */
1.035781537016238873464, /* 0x1.0928fa93490d4fff3 */
1.037806524719013578963, /* 0x1.09adb03b3e5b3000d */
1.039835471338248051878, /* 0x1.0a32a84e9e5760004 */
1.041868384612101516848, /* 0x1.0ab7e2eea5340ffff */
1.043905272300907460835, /* 0x1.0b3d603ca784f0009 */
1.045946142174331239262, /* 0x1.0bc3205a042060000 */
1.047991002016745332165, /* 0x1.0c4923682a086fffe */
1.050039859627715177527, /* 0x1.0ccf698898f3a000d */
1.052092722826109660856, /* 0x1.0d55f2dce5d1dfffb */
1.054149599440827866881, /* 0x1.0ddcbf86b09a5fff6 */
1.056210497317612961855, /* 0x1.0e63cfa7abc97fffd */
1.058275424318780855142, /* 0x1.0eeb23619c146fffb */
1.060344388322010722446, /* 0x1.0f72bad65714bffff */
1.062417397220589476718, /* 0x1.0ffa9627c38d30004 */
1.064494458915699715017, /* 0x1.1082b577d0eef0003 */
1.066575581342167566880, /* 0x1.110b18e893a90000a */
1.068660772440545025953, /* 0x1.1193c09c267610006 */
1.070750040138235936705, /* 0x1.121cacb4959befff6 */
1.072843392435016474095, /* 0x1.12a5dd543cf36ffff */
1.074940837302467588937, /* 0x1.132f529d59552000b */
1.077042382749654914030, /* 0x1.13b90cb250d08fff5 */
1.079148036789447484528, /* 0x1.14430bb58da3dfff9 */
1.081257807444460983297, /* 0x1.14cd4fc984c4a000e */
1.083371702785017154417, /* 0x1.1557d910df9c7000e */
1.085489730853784307038, /* 0x1.15e2a7ae292d30002 */
1.087611899742884524772, /* 0x1.166dbbc422d8c0004 */
1.089738217537583819804, /* 0x1.16f9157586772ffff */
1.091868692357631731528, /* 0x1.1784b4e533cacfff0 */
1.094003332327482702577, /* 0x1.18109a360fc23fff2 */
1.096142145591650907149, /* 0x1.189cc58b155a70008 */
1.098285140311341168136, /* 0x1.1929370751ea50002 */
1.100432324652149906842, /* 0x1.19b5eecdd79cefff0 */
1.102583706811727015711, /* 0x1.1a42ed01dbdba000e */
1.104739294993289488947, /* 0x1.1ad031c69a2eafff0 */
1.106899097422573863281, /* 0x1.1b5dbd3f66e120003 */
1.109063122341542140286, /* 0x1.1beb8f8fa8150000b */
1.111231377994659874592, /* 0x1.1c79a8dac6ad0fff4 */
1.113403872669181282605, /* 0x1.1d0809445a97ffffc */
1.115580614653132185460, /* 0x1.1d96b0effc9db000e */
1.117761612217810673898, /* 0x1.1e25a001332190000 */
1.119946873713312474002, /* 0x1.1eb4d69bdb2a9fff1 */
1.122136407473298902480, /* 0x1.1f4454e3bfae00006 */
1.124330221845670330058, /* 0x1.1fd41afcbb48bfff8 */
1.126528325196519908506, /* 0x1.2064290abc98c0001 */
1.128730725913251964394, /* 0x1.20f47f31c9aa7000f */
1.130937432396844410880, /* 0x1.21851d95f776dfff0 */
1.133148453059692917203, /* 0x1.2216045b6784efffa */
1.135363796355857157764, /* 0x1.22a733a6692ae0004 */
1.137583470716100553249, /* 0x1.2338ab9b3221a0004 */
1.139807484614418608939, /* 0x1.23ca6c5e27aadfff7 */
1.142035846532929888057, /* 0x1.245c7613b7f6c0004 */
1.144268564977221958089, /* 0x1.24eec8e06b035000c */
1.146505648458203463465, /* 0x1.258164e8cea85fff8 */
1.148747105501412235671, /* 0x1.26144a5180d380009 */
1.150992944689175123667, /* 0x1.26a7793f5de2efffa */
1.153243174560058870217, /* 0x1.273af1d712179000d */
1.155497803703682491111, /* 0x1.27ceb43d81d42fff1 */
1.157756840726344771440, /* 0x1.2862c097a3d29000c */
1.160020294239811677834, /* 0x1.28f7170a74cf4fff1 */
1.162288172883275239058, /* 0x1.298bb7bb0faed0004 */
1.164560485298402170388, /* 0x1.2a20a2ce920dffff4 */
1.166837240167474476460, /* 0x1.2ab5d86a4631ffff6 */
1.169118446164539637555, /* 0x1.2b4b58b36d5220009 */
1.171404112007080167155, /* 0x1.2be123cf786790002 */
1.173694246390975415341, /* 0x1.2c7739e3c0aac000d */
1.175988858069749065617, /* 0x1.2d0d9b15deb58fff6 */
1.178287955789017793514, /* 0x1.2da4478b627040002 */
1.180591548323240091978, /* 0x1.2e3b3f69fb794fffc */
1.182899644456603782686, /* 0x1.2ed282d76421d0004 */
1.185212252993012693694, /* 0x1.2f6a11f96c685fff3 */
1.187529382762033236513, /* 0x1.3001ecf60082ffffa */
1.189851042595508889847, /* 0x1.309a13f30f28a0004 */
1.192177241354644978669, /* 0x1.31328716a758cfff7 */
1.194507987909589896687, /* 0x1.31cb4686e1e85fffb */
1.196843291137896336843, /* 0x1.32645269dfd04000a */
1.199183159977805113226, /* 0x1.32fdaae604c39000f */
1.201527603343041317132, /* 0x1.339750219980dfff3 */
1.203876630171082595692, /* 0x1.3431424300e480007 */
1.206230249419600664189, /* 0x1.34cb8170b3fee000e */
1.208588470077065268869, /* 0x1.35660dd14dbd4fffc */
1.210951301134513435915, /* 0x1.3600e78b6bdfc0005 */
1.213318751604272271958, /* 0x1.369c0ec5c38ebfff2 */
1.215690830512196507537, /* 0x1.373783a718d29000f */
1.218067546930756250870, /* 0x1.37d3465662f480007 */
1.220448909901335365929, /* 0x1.386f56fa770fe0008 */
1.222834928513994334780, /* 0x1.390bb5ba5fc540004 */
1.225225611877684750397, /* 0x1.39a862bd3c7a8fff3 */
1.227620969111500981433, /* 0x1.3a455e2a37bcafffd */
1.230021009336254911271, /* 0x1.3ae2a8287dfbefff6 */
1.232425741726685064472, /* 0x1.3b8040df76f39fffa */
1.234835175450728295084, /* 0x1.3c1e287682e48fff1 */
1.237249319699482263931, /* 0x1.3cbc5f151b86bfff8 */
1.239668183679933477545, /* 0x1.3d5ae4e2cc0a8000f */
1.242091776620540377629, /* 0x1.3df9ba07373bf0006 */
1.244520107762172811399, /* 0x1.3e98deaa0d8cafffe */
1.246953186383919165383, /* 0x1.3f3852f32973efff0 */
1.249391019292643401078, /* 0x1.3fd816ffc72b90001 */
1.251833623164381181797, /* 0x1.40782b17863250005 */
1.254280999953110153911, /* 0x1.41188f42caf400000 */
1.256733161434815393410, /* 0x1.41b943b42945bfffd */
1.259190116985283935980, /* 0x1.425a4893e5f10000a */
1.261651875958665236542, /* 0x1.42fb9e0a2df4c0009 */
1.264118447754797758244, /* 0x1.439d443f608c4fff9 */
1.266589841787181258708, /* 0x1.443f3b5bebf850008 */
1.269066067469190262045, /* 0x1.44e183883e561fff7 */
1.271547134259576328224, /* 0x1.45841cecf7a7a0001 */
1.274033051628237434048, /* 0x1.462707b2c43020009 */
1.276523829025464573684, /* 0x1.46ca44023aa410007 */
1.279019475999373156531, /* 0x1.476dd2045d46ffff0 */
1.281520002043128991825, /* 0x1.4811b1e1f1f19000b */
1.284025416692967214122, /* 0x1.48b5e3c3edd74fff4 */
1.286535729509738823464, /* 0x1.495a67d3613c8fff7 */
1.289050950070396384145, /* 0x1.49ff3e396e19d000b */
1.291571087985403654081, /* 0x1.4aa4671f5b401fff1 */
1.294096152842774794011, /* 0x1.4b49e2ae56d19000d */
1.296626154297237043484, /* 0x1.4befb10fd84a3fff4 */
1.299161101984141142272, /* 0x1.4c95d26d41d84fff8 */
1.301701005575179204100, /* 0x1.4d3c46f01d9f0fff3 */
1.304245874766450485904, /* 0x1.4de30ec21097d0003 */
1.306795719266019562007, /* 0x1.4e8a2a0ccce3d0002 */
1.309350548792467483458, /* 0x1.4f3198fa10346fff5 */
1.311910373099227200545, /* 0x1.4fd95bb3be8cffffd */
1.314475201942565174546, /* 0x1.50817263bf0e5fffb */
1.317045045107389400535, /* 0x1.5129dd3418575000e */
1.319619912422941299109, /* 0x1.51d29c4f01c54ffff */
1.322199813675649204855, /* 0x1.527bafde83a310009 */
1.324784758729532718739, /* 0x1.5325180cfb8b3fffd */
1.327374757430096474625, /* 0x1.53ced504b2bd0fff4 */
1.329969819671041886272, /* 0x1.5478e6f02775e0001 */
1.332569955346704748651, /* 0x1.55234df9d8a59fff8 */
1.335175174370685002822, /* 0x1.55ce0a4c5a6a9fff6 */
1.337785486688218616860, /* 0x1.56791c1263abefff7 */
1.340400902247843806217, /* 0x1.57248376aef21fffa */
1.343021431036279800211, /* 0x1.57d040a420c0bfff3 */
1.345647083048053138662, /* 0x1.587c53c5a630f0002 */
1.348277868295411074918, /* 0x1.5928bd063fd7bfff9 */
1.350913796821875845231, /* 0x1.59d57c9110ad60006 */
1.353554878672557082439, /* 0x1.5a8292913d68cfffc */
1.356201123929036356254, /* 0x1.5b2fff3212db00007 */
1.358852542671913132777, /* 0x1.5bddc29edcc06fff3 */
1.361509145047255398051, /* 0x1.5c8bdd032ed16000f */
1.364170941142184734180, /* 0x1.5d3a4e8a5bf61fff4 */
1.366837941171020309735, /* 0x1.5de9176042f1effff */
1.369510155261156381121, /* 0x1.5e9837b062f4e0005 */
1.372187593620959988833, /* 0x1.5f47afa69436cfff1 */
1.374870266463378287715, /* 0x1.5ff77f6eb3f8cfffd */
1.377558184010425845733, /* 0x1.60a7a734a9742fff9 */
1.380251356531521533853, /* 0x1.6158272490016000c */
1.382949794301995272203, /* 0x1.6208ff6a8978a000f */
1.385653507605306700170, /* 0x1.62ba3032c0a280004 */
1.388362506772382154503, /* 0x1.636bb9a994784000f */
1.391076802081129493127, /* 0x1.641d9bfb29a7bfff6 */
1.393796403973427855412, /* 0x1.64cfd7545928b0002 */
1.396521322756352656542, /* 0x1.65826be167badfff8 */
1.399251568859207761660, /* 0x1.663559cf20826000c */
1.401987152677323100733, /* 0x1.66e8a14a29486fffc */
1.404728084651919228815, /* 0x1.679c427f5a4b6000b */
1.407474375243217723560, /* 0x1.68503d9ba0add000f */
1.410226034922914983815, /* 0x1.690492cbf6303fff9 */
1.412983074197955213304, /* 0x1.69b9423d7b548fff6 */
};

View file

@ -1,301 +1,352 @@
/* These values are accurate to 23+9 bits when represented as
a float. */
static const float exp2_accuratetable[256] = {
0.70711034541 /* 0x0.b5052f003 */,
0.70903021104 /* 0x0.b58301004 */,
0.71092861900 /* 0x0.b5ff6b006 */,
0.71286851176 /* 0x0.b67e8d006 */,
0.71481245762 /* 0x0.b6fdf3004 */,
0.71673321725 /* 0x0.b77bd4001 */,
0.71868461379 /* 0x0.b7fbb7006 */,
0.72064983853 /* 0x0.b87c82006 */,
0.72258073096 /* 0x0.b8fb0d003 */,
0.72456008199 /* 0x0.b97cc5002 */,
0.72652846578 /* 0x0.b9fdc5002 */,
0.72848570353 /* 0x0.ba7e0a004 */,
0.73046034578 /* 0x0.baff73003 */,
0.73244112730 /* 0x0.bb8143000 */,
0.73443359139 /* 0x0.bc03d7002 */,
0.73646944762 /* 0x0.bc8943000 */,
0.73839598903 /* 0x0.bd0785006 */,
0.74041211608 /* 0x0.bd8ba6002 */,
0.74243509775 /* 0x0.be103a004 */,
0.74444299943 /* 0x0.be93d1004 */,
0.74646854405 /* 0x0.bf1890003 */,
0.74849390993 /* 0x0.bf9d4c006 */,
0.75051373248 /* 0x0.c021ab003 */,
0.75252974037 /* 0x0.c0a5ca002 */,
0.75460278996 /* 0x0.c12da6006 */,
0.75663453342 /* 0x0.c1b2cd001 */,
0.75867807874 /* 0x0.c238ba006 */,
0.76072299481 /* 0x0.c2bebe000 */,
0.76271909478 /* 0x0.c3418f002 */,
0.76482868204 /* 0x0.c3cbd0006 */,
0.76694220311 /* 0x0.c45653004 */,
0.76902121311 /* 0x0.c4de93003 */,
0.77110719688 /* 0x0.c56748005 */,
0.77314376835 /* 0x0.c5ecc0003 */,
0.77531152970 /* 0x0.c67ad1004 */,
0.77739948042 /* 0x0.c703a7005 */,
0.77948719274 /* 0x0.c78c79007 */,
0.78161448246 /* 0x0.c817e3004 */,
0.78381162885 /* 0x0.c8a7e1002 */,
0.78587090971 /* 0x0.c92ed6001 */,
0.78799921275 /* 0x0.c9ba51001 */,
0.79011362800 /* 0x0.ca44e3006 */,
0.79225623615 /* 0x0.cad14e005 */,
0.79441082487 /* 0x0.cb5e82006 */,
0.79654645924 /* 0x0.cbea78003 */,
0.79873132707 /* 0x0.cc79a8001 */,
0.80093026168 /* 0x0.cd09c4005 */,
0.80304825308 /* 0x0.cd9492001 */,
0.80526113516 /* 0x0.ce2598004 */,
0.80742740634 /* 0x0.ceb390002 */,
0.80963188410 /* 0x0.cf4409000 */,
0.81180763254 /* 0x0.cfd2a0006 */,
0.81401169308 /* 0x0.d06312005 */,
0.81622666121 /* 0x0.d0f43b000 */,
0.81843453653 /* 0x0.d184ed005 */,
0.82070738078 /* 0x0.d219e1001 */,
0.82289630179 /* 0x0.d2a955003 */,
0.82509487868 /* 0x0.d3396b000 */,
0.82737630616 /* 0x0.d3ceef007 */,
0.82961845408 /* 0x0.d461e0007 */,
0.83179849386 /* 0x0.d4f0bf000 */,
0.83408612023 /* 0x0.d586ab007 */,
0.83636939536 /* 0x0.d61c4e007 */,
0.83862531186 /* 0x0.d6b026000 */,
0.84094470740 /* 0x0.d74827000 */,
0.84316509971 /* 0x0.d7d9ab006 */,
0.84546715027 /* 0x0.d87089004 */,
0.84781247378 /* 0x0.d90a3d000 */,
0.85004067431 /* 0x0.d99c44007 */,
0.85237431530 /* 0x0.da3534003 */,
0.85468208790 /* 0x0.dacc72000 */,
0.85696077349 /* 0x0.db61c8002 */,
0.85931611062 /* 0x0.dbfc24000 */,
0.86171466122 /* 0x0.dc9955007 */,
0.86397939929 /* 0x0.dd2dc1006 */,
0.86633706098 /* 0x0.ddc844004 */,
0.86868536481 /* 0x0.de622a006 */,
0.87101131681 /* 0x0.defa99002 */,
0.87337517739 /* 0x0.df9584000 */,
0.87576484682 /* 0x0.e03220001 */,
0.87814646969 /* 0x0.e0ce35007 */,
0.88050335648 /* 0x0.e168ab002 */,
0.88291734457 /* 0x0.e206df000 */,
0.88522624975 /* 0x0.e29e30004 */,
0.88768237833 /* 0x0.e33f27003 */,
0.89007008077 /* 0x0.e3dba2001 */,
0.89250904327 /* 0x0.e47b79004 */,
0.89490824949 /* 0x0.e518b5007 */,
0.89735335113 /* 0x0.e5b8f3001 */,
0.89977204799 /* 0x0.e65776000 */,
0.90221023561 /* 0x0.e6f740001 */,
0.90468037137 /* 0x0.e79922006 */,
0.90711551909 /* 0x0.e838b9003 */,
0.90958660844 /* 0x0.e8daab002 */,
0.91205561170 /* 0x0.e97c7a006 */,
0.91451990614 /* 0x0.ea1dfa006 */,
0.91699457179 /* 0x0.eac028007 */,
0.91948717833 /* 0x0.eb6383000 */,
0.92201787240 /* 0x0.ec095d004 */,
0.92446959027 /* 0x0.ecaa0a006 */,
0.92700457577 /* 0x0.ed502c003 */,
0.92946064473 /* 0x0.edf122000 */,
0.93202102187 /* 0x0.ee98ee001 */,
0.93454003345 /* 0x0.ef3e04007 */,
0.93707615143 /* 0x0.efe439004 */,
0.93964391957 /* 0x0.f08c81007 */,
0.94217014323 /* 0x0.f13210007 */,
0.94470518835 /* 0x0.f1d833005 */,
0.94727593667 /* 0x0.f280ad004 */,
0.94985383753 /* 0x0.f3299f002 */,
0.95245110992 /* 0x0.f3d3d6002 */,
0.95500063903 /* 0x0.f47aec004 */,
0.95758175857 /* 0x0.f52414004 */,
0.96018302447 /* 0x0.f5ce8e004 */,
0.96279788024 /* 0x0.f679ec005 */,
0.96541762355 /* 0x0.f7259c002 */,
0.96803289660 /* 0x0.f7d101005 */,
0.97066921004 /* 0x0.f87dc7006 */,
0.97328519823 /* 0x0.f92938001 */,
0.97589331867 /* 0x0.f9d425001 */,
0.97858297827 /* 0x0.fa846a001 */,
0.98121380814 /* 0x0.fb30d4005 */,
0.98389244083 /* 0x0.fbe060002 */,
0.98657202723 /* 0x0.fc8ffc001 */,
0.98919564488 /* 0x0.fd3bed001 */,
0.99194401506 /* 0x0.fdf00b002 */,
0.99460238224 /* 0x0.fe9e43004 */,
0.99728542574 /* 0x0.ff4e19005 */,
1.00000000000 /* 0x1.000000000 */,
1.00271666054 /* 0x1.00b20a003 */,
1.00544095058 /* 0x1.01649400c */,
1.00819313547 /* 0x1.0218f200e */,
1.01089513312 /* 0x1.02ca06007 */,
1.01363527782 /* 0x1.037d9a005 */,
1.01635849497 /* 0x1.04301200e */,
1.01918780808 /* 0x1.04e97e003 */,
1.02182090297 /* 0x1.05960e00a */,
1.02468311789 /* 0x1.0651a2002 */,
1.02744102491 /* 0x1.070660009 */,
1.03019988541 /* 0x1.07bb2e002 */,
1.03300857552 /* 0x1.087340005 */,
1.03580951708 /* 0x1.092ad000b */,
1.03865504271 /* 0x1.09e54c004 */,
1.04145348082 /* 0x1.0a9cb2007 */,
1.04426109801 /* 0x1.0b54b2007 */,
1.04706287389 /* 0x1.0c0c50003 */,
1.04996109020 /* 0x1.0cca40007 */,
1.05282557024 /* 0x1.0d85fa009 */,
1.05564439314 /* 0x1.0e3eb600c */,
1.05850863475 /* 0x1.0efa6c00c */,
1.06137108805 /* 0x1.0fb604001 */,
1.06423723713 /* 0x1.1071da00a */,
1.06716394429 /* 0x1.1131a8003 */,
1.07004547127 /* 0x1.11ee80005 */,
1.07294559497 /* 0x1.12ac9000c */,
1.07586789139 /* 0x1.136c14005 */,
1.07873940478 /* 0x1.142844007 */,
1.08172726651 /* 0x1.14ec1400e */,
1.08459246171 /* 0x1.15a7da008 */,
1.08752059939 /* 0x1.1667c0001 */,
1.09050178536 /* 0x1.172b20005 */,
1.09349620361 /* 0x1.17ef5e00d */,
1.09634935875 /* 0x1.18aa5a00d */,
1.09940552720 /* 0x1.1972a4006 */,
1.10237383858 /* 0x1.1a352c00a */,
1.10530221471 /* 0x1.1af516006 */,
1.10838031771 /* 0x1.1bbed0001 */,
1.11137616648 /* 0x1.1c8326009 */,
1.11441528816 /* 0x1.1d4a5200d */,
1.11741960066 /* 0x1.1e0f3600c */,
1.12044525152 /* 0x1.1ed580003 */,
1.12346303485 /* 0x1.1f9b4600f */,
1.12655401230 /* 0x1.2065d8000 */,
1.12955987463 /* 0x1.212ad6007 */,
1.13263440148 /* 0x1.21f45400b */,
1.13567769541 /* 0x1.22bbc6009 */,
1.13877141483 /* 0x1.238686005 */,
1.14189016826 /* 0x1.2452ea004 */,
1.14495265504 /* 0x1.251b9e00e */,
1.14807951452 /* 0x1.25e88a001 */,
1.15118837366 /* 0x1.26b448006 */,
1.15428590795 /* 0x1.277f4800e */,
1.15744590761 /* 0x1.284e60001 */,
1.16055941596 /* 0x1.291a6c00a */,
1.16371822369 /* 0x1.29e970008 */,
1.16683173193 /* 0x1.2ab57c009 */,
1.17002511035 /* 0x1.2b86c4007 */,
1.17321026344 /* 0x1.2c578200d */,
1.17639815811 /* 0x1.2d286e002 */,
1.17961537856 /* 0x1.2dfb4600c */,
1.18278920671 /* 0x1.2ecb4600e */,
1.18602204342 /* 0x1.2f9f2400d */,
1.18924140952 /* 0x1.30722000f */,
1.19246912021 /* 0x1.3145a800c */,
1.19566547881 /* 0x1.321722007 */,
1.19890022298 /* 0x1.32eb2000e */,
1.20205938816 /* 0x1.33ba2a000 */,
1.20533752458 /* 0x1.34910000b */,
1.20865476136 /* 0x1.356a66003 */,
1.21195018302 /* 0x1.36425e007 */,
1.21525228034 /* 0x1.371ac6007 */,
1.21851313125 /* 0x1.37f07a007 */,
1.22183310988 /* 0x1.38ca0e001 */,
1.22516608253 /* 0x1.39a47c00a */,
1.22848713419 /* 0x1.3a7e2200f */,
1.23174583912 /* 0x1.3b53b2000 */,
1.23522067082 /* 0x1.3c376c008 */,
1.23849928397 /* 0x1.3d0e4a00c */,
1.24181902431 /* 0x1.3de7da00f */,
1.24523758889 /* 0x1.3ec7e4001 */,
1.24859035038 /* 0x1.3fa39e00f */,
1.25193393249 /* 0x1.407ebe00d */,
1.25539278994 /* 0x1.41616c007 */,
1.25880420214 /* 0x1.4240fe004 */,
1.26223969480 /* 0x1.43222400e */,
1.26558542253 /* 0x1.43fd68001 */,
1.26904225354 /* 0x1.44dff4003 */,
1.27251851576 /* 0x1.45c3c600c */,
1.27593302748 /* 0x1.46a38c00f */,
1.27941727649 /* 0x1.4787e4007 */,
1.28286683578 /* 0x1.4869f600d */,
1.28636789342 /* 0x1.494f6800e */,
1.28982734693 /* 0x1.4a3220009 */,
1.29335498813 /* 0x1.4b1950002 */,
1.29684555547 /* 0x1.4bfe1200b */,
1.30039131655 /* 0x1.4ce672009 */,
1.30388665216 /* 0x1.4dcb8400b */,
1.30738770972 /* 0x1.4eb0f6007 */,
1.31095492852 /* 0x1.4f9abe008 */,
1.31452167056 /* 0x1.50847e00f */,
1.31807971017 /* 0x1.516dac00b */,
1.32168746004 /* 0x1.525a1c006 */,
1.32518649117 /* 0x1.533f6c00b */,
1.32884454737 /* 0x1.542f28007 */,
1.33244597914 /* 0x1.551b2e002 */,
1.33601069461 /* 0x1.5604cc007 */,
1.33969032765 /* 0x1.56f5f2000 */,
1.34328985233 /* 0x1.57e1d800d */,
1.34692609319 /* 0x1.58d026006 */,
1.35055744648 /* 0x1.59be22000 */,
1.35424625891 /* 0x1.5aafe200c */,
1.35795569436 /* 0x1.5ba2fc00b */,
1.36158764384 /* 0x1.5c910200e */,
1.36525344864 /* 0x1.5d814000a */,
1.36908590815 /* 0x1.5e7c6a00e */,
1.37272357954 /* 0x1.5f6ad0009 */,
1.37639832498 /* 0x1.605ba4001 */,
1.38020527377 /* 0x1.615522009 */,
1.38388323800 /* 0x1.62462c00b */,
1.38770687583 /* 0x1.6340c2002 */,
1.39144265656 /* 0x1.643596003 */,
1.39518976211 /* 0x1.652b28000 */,
1.39905631551 /* 0x1.66288e006 */,
1.40280294419 /* 0x1.671e18000 */,
1.40661609194 /* 0x1.6817fe00e */,
1.41035604489 /* 0x1.690d18008 */
/* Accurate tables for exp2f().
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
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. */
/* This table has the property that, for all integers -128 <= i <= 127,
exp(i/256.0 + __exp2f_deltatable[i-128]) == __exp2f_atable[i+128] + r
for some -2^-35 < r < 2^-35 (abs(r) < 2^-36 if i <= 0); and that
__exp2f_deltatable[i+128] == t * 2^-30
for integer t so that abs(t) <= 43447 * 2^0. */
#define W30 (9.31322575e-10)
static const float __exp2f_deltatable[256] = {
-810*W30, 283*W30, -1514*W30, 1304*W30,
-1148*W30, -98*W30, -744*W30, -156*W30,
-419*W30, -155*W30, 474*W30, 167*W30,
-1984*W30, -826*W30, 692*W30, 781*W30,
-578*W30, -411*W30, -129*W30, -1500*W30,
654*W30, -141*W30, -816*W30, -53*W30,
148*W30, 493*W30, -2214*W30, 760*W30,
260*W30, 750*W30, -1300*W30, 1424*W30,
-1445*W30, -339*W30, -680*W30, -349*W30,
-922*W30, 531*W30, 193*W30, -2892*W30,
290*W30, -2145*W30, -276*W30, 485*W30,
-695*W30, 215*W30, -7093*W30, 412*W30,
-4596*W30, 367*W30, 592*W30, -615*W30,
-97*W30, -1066*W30, 972*W30, -226*W30,
-625*W30, -374*W30, -5647*W30, -180*W30,
20349*W30, -447*W30, 111*W30, -4164*W30,
-87*W30, -21*W30, -251*W30, 66*W30,
-517*W30, 2093*W30, -263*W30, 182*W30,
-601*W30, 475*W30, -483*W30, -1251*W30,
-373*W30, 1471*W30, -92*W30, -215*W30,
-97*W30, -190*W30, 0*W30, -290*W30,
-2647*W30, 1940*W30, -582*W30, 28*W30,
833*W30, 1493*W30, 34*W30, 321*W30,
3327*W30, -35*W30, 177*W30, -135*W30,
-796*W30, -428*W30, 129*W30, 9332*W30,
-12*W30, -69*W30, -1743*W30, 6508*W30,
-60*W30, 359*W30, 43447*W30, 15*W30,
-23*W30, -305*W30, -375*W30, -652*W30,
667*W30, 269*W30, -1575*W30, 185*W30,
-329*W30, 200*W30, 6002*W30, 163*W30,
-647*W30, 19*W30, -603*W30, -755*W30,
742*W30, -438*W30, 3587*W30, 2560*W30,
0*W30, -520*W30, -241*W30, -299*W30,
-1270*W30, -991*W30, -1138*W30, 255*W30,
-1192*W30, 1722*W30, 1023*W30, 3700*W30,
-1388*W30, -1551*W30, -2549*W30, 27*W30,
282*W30, 673*W30, 113*W30, 1561*W30,
72*W30, 873*W30, 87*W30, -395*W30,
-433*W30, 629*W30, 3440*W30, -284*W30,
-592*W30, -103*W30, -46*W30, -3844*W30,
1712*W30, 303*W30, 1555*W30, -631*W30,
-1400*W30, -961*W30, -854*W30, -276*W30,
407*W30, 833*W30, -345*W30, -1501*W30,
121*W30, -1581*W30, 400*W30, 150*W30,
1224*W30, -139*W30, -563*W30, 879*W30,
933*W30, 2939*W30, 788*W30, 211*W30,
530*W30, -192*W30, 706*W30, -13347*W30,
1065*W30, 3*W30, 111*W30, -208*W30,
-360*W30, -532*W30, -291*W30, 483*W30,
987*W30, -33*W30, -1373*W30, -166*W30,
-1174*W30, -3955*W30, 1601*W30, -280*W30,
1405*W30, 600*W30, -1659*W30, -23*W30,
390*W30, 449*W30, 570*W30, -13143*W30,
-9*W30, -1646*W30, 1201*W30, 294*W30,
2181*W30, -1173*W30, 1388*W30, -4504*W30,
190*W30, -2304*W30, 211*W30, 239*W30,
48*W30, -817*W30, 1018*W30, 1828*W30,
-663*W30, 1408*W30, 408*W30, -36*W30,
1295*W30, -230*W30, 1341*W30, 9*W30,
40*W30, 705*W30, 186*W30, 376*W30,
557*W30, 5866*W30, 363*W30, -1558*W30,
718*W30, 669*W30, 1369*W30, -2972*W30,
-468*W30, -121*W30, -219*W30, 667*W30,
29954*W30, 366*W30, 48*W30, -203*W30
};
#define S (1.0/8388608.0) /* 2^-23 */
static const float exp2_deltatable[256] = {
61*S, 107*S, -301*S, -91*S, 98*S, -194*S, -57*S, 223*S,
-162*S, 176*S, 241*S, 32*S, 24*S, 29*S, 138*S, 871*S,
-280*S, -49*S, 204*S, 122*S, 238*S, 262*S, 108*S, -195*S,
330*S, 103*S, -23*S, -215*S, -1269*S, -610*S, 19*S, 13*S,
28*S, -819*S, 298*S, 78*S, -233*S, -18*S, 1186*S, 172*S,
135*S, -203*S, -197*S, -97*S, -374*S, 8*S, 512*S, -295*S,
240*S, -15*S, 214*S, -75*S, -30*S, 88*S, 12*S, 806*S,
273*S, -204*S, 445*S, 429*S, -579*S, -109*S, 207*S, 38*S,
695*S, -161*S, 68*S, 825*S, -178*S, 233*S, 187*S, -358*S,
91*S, 1056*S, 53*S, 265*S, 257*S, -150*S, -118*S, 182*S,
281*S, -49*S, 317*S, -844*S, -80*S, -339*S, 10*S, -269*S,
-16*S, -208*S, -226*S, 95*S, -141*S, 14*S, 52*S, -61*S,
-125*S, -41*S, 454*S, -176*S, 196*S, -550*S, -26*S, -129*S,
-99*S, 250*S, -25*S, -274*S, -154*S, -32*S, 247*S, -169*S,
-272*S, -209*S, -64*S, 53*S, 25*S, 171*S, -25*S, -406*S,
135*S, -141*S, 84*S, 231*S, -396*S, 414*S, 36*S, -129*S,
0*S, 65*S, 133*S, 447*S, 70*S, 62*S, -236*S, 639*S,
-903*S, 181*S, -58*S, -373*S, -191*S, -189*S, 244*S, 39*S,
-147*S, -488*S, 196*S, 400*S, -9*S, 15*S, -70*S, -201*S,
267*S, 133*S, 121*S, 270*S, -240*S, 466*S, -289*S, -428*S,
-66*S, 352*S, -880*S, 41*S, -96*S, -758*S, 130*S, 29*S,
310*S, 124*S, 81*S, -135*S, 348*S, -172*S, -44*S, -338*S,
-183*S, 148*S, -206*S, 32*S, -9*S, -257*S, 61*S, -196*S,
-69*S, -501*S, -193*S, -60*S, 12*S, 296*S, 46*S, 311*S,
349*S, 383*S, 11*S, -60*S, -980*S, -789*S, -296*S, -112*S,
49*S, -289*S, -128*S, 72*S, 65*S, -643*S, 682*S, -6*S,
-378*S, 124*S, -103*S, -506*S, 116*S, 190*S, 406*S, -326*S,
-83*S, 255*S, -83*S, 152*S, -30*S, 185*S, -80*S, 206*S,
56*S, 332*S, 50*S, -266*S, -58*S, 56*S, 1*S, 313*S,
-458*S, 135*S, 122*S, -312*S, 206*S, -89*S, -141*S, -325*S,
-83*S, 253*S, -190*S, -419*S, 738*S, 83*S, -331*S, 328*S,
-233*S, 391*S, 159*S, -62*S, 663*S, 261*S, 345*S, -288*S
static const float __exp2f_atable[256] /* __attribute__((mode(SF))) */ = {
0.707106411447, /* 0x0.b504ecfff */
0.709024071690, /* 0x0.b58299fff */
0.710945606239, /* 0x0.b60088000 */
0.712874472142, /* 0x0.b67ef1000 */
0.714806139464, /* 0x0.b6fd88fff */
0.716744661340, /* 0x0.b77c94000 */
0.718687653549, /* 0x0.b7fbea000 */
0.720636486992, /* 0x0.b87ba1fff */
0.722590208040, /* 0x0.b8fbabfff */
0.724549472323, /* 0x0.b97c12fff */
0.726514220228, /* 0x0.b9fcd5fff */
0.728483855735, /* 0x0.ba7deb000 */
0.730457961549, /* 0x0.baff4afff */
0.732438981522, /* 0x0.bb811efff */
0.734425544748, /* 0x0.bc0350000 */
0.736416816713, /* 0x0.bc85d0000 */
0.738412797450, /* 0x0.bd089efff */
0.740414917465, /* 0x0.bd8bd4fff */
0.742422521111, /* 0x0.be0f66fff */
0.744434773914, /* 0x0.be9346fff */
0.746454179287, /* 0x0.bf179f000 */
0.748477637755, /* 0x0.bf9c3afff */
0.750506639473, /* 0x0.c02133fff */
0.752541840064, /* 0x0.c0a694fff */
0.754582285889, /* 0x0.c12c4e000 */
0.756628334525, /* 0x0.c1b265000 */
0.758678436269, /* 0x0.c238bffff */
0.760736882681, /* 0x0.c2bfa6fff */
0.762799203401, /* 0x0.c346cf000 */
0.764867603790, /* 0x0.c3ce5d000 */
0.766940355298, /* 0x0.c45633fff */
0.769021093841, /* 0x0.c4de90fff */
0.771104693409, /* 0x0.c5671dfff */
0.773195922364, /* 0x0.c5f02afff */
0.775292098512, /* 0x0.c6798afff */
0.777394294745, /* 0x0.c70350000 */
0.779501736166, /* 0x0.c78d6d000 */
0.781615912910, /* 0x0.c817fafff */
0.783734917628, /* 0x0.c8a2d9fff */
0.785858273516, /* 0x0.c92e02000 */
0.787990570071, /* 0x0.c9b9c0000 */
0.790125787245, /* 0x0.ca45aefff */
0.792268991467, /* 0x0.cad223fff */
0.794417440881, /* 0x0.cb5ef0fff */
0.796570718287, /* 0x0.cbec0efff */
0.798730909811, /* 0x0.cc79a0fff */
0.800892710672, /* 0x0.cd074dfff */
0.803068041795, /* 0x0.cd95ddfff */
0.805242776881, /* 0x0.ce2464000 */
0.807428598393, /* 0x0.ceb3a3fff */
0.809617877002, /* 0x0.cf431dfff */
0.811812341211, /* 0x0.cfd2eefff */
0.814013659956, /* 0x0.d06333000 */
0.816220164311, /* 0x0.d0f3ce000 */
0.818434238424, /* 0x0.d184e7fff */
0.820652604094, /* 0x0.d21649fff */
0.822877407074, /* 0x0.d2a818000 */
0.825108587751, /* 0x0.d33a51000 */
0.827342867839, /* 0x0.d3ccbdfff */
0.829588949684, /* 0x0.d45ff1000 */
0.831849217401, /* 0x0.d4f411fff */
0.834093391880, /* 0x0.d58724fff */
0.836355149750, /* 0x0.d61b5f000 */
0.838620424257, /* 0x0.d6afd3fff */
0.840896368027, /* 0x0.d744fc000 */
0.843176305293, /* 0x0.d7da66fff */
0.845462262643, /* 0x0.d87037000 */
0.847754716864, /* 0x0.d90673fff */
0.850052893157, /* 0x0.d99d10fff */
0.852359056469, /* 0x0.da3433fff */
0.854668736446, /* 0x0.dacb91fff */
0.856986224651, /* 0x0.db6373000 */
0.859309315673, /* 0x0.dbfbb1fff */
0.861639738080, /* 0x0.dc946bfff */
0.863975346095, /* 0x0.dd2d7d000 */
0.866317391394, /* 0x0.ddc6f9fff */
0.868666708472, /* 0x0.de60f1000 */
0.871022939695, /* 0x0.defb5c000 */
0.873383641229, /* 0x0.df9611fff */
0.875751554968, /* 0x0.e03141000 */
0.878126025200, /* 0x0.e0ccde000 */
0.880506813521, /* 0x0.e168e4fff */
0.882894217966, /* 0x0.e2055afff */
0.885287821299, /* 0x0.e2a239000 */
0.887686729423, /* 0x0.e33f6ffff */
0.890096127973, /* 0x0.e3dd56fff */
0.892507970338, /* 0x0.e47b67000 */
0.894928157336, /* 0x0.e51a03000 */
0.897355020043, /* 0x0.e5b90efff */
0.899788379682, /* 0x0.e65888000 */
0.902227103705, /* 0x0.e6f85afff */
0.904673457151, /* 0x0.e798ae000 */
0.907128036008, /* 0x0.e8398afff */
0.909585535528, /* 0x0.e8da99000 */
0.912051796915, /* 0x0.e97c3a000 */
0.914524436003, /* 0x0.ea1e46000 */
0.917003571999, /* 0x0.eac0bf000 */
0.919490039339, /* 0x0.eb63b2fff */
0.921983361257, /* 0x0.ec071a000 */
0.924488604054, /* 0x0.ecab48fff */
0.926989555360, /* 0x0.ed4f30000 */
0.929502844812, /* 0x0.edf3e6000 */
0.932021975503, /* 0x0.ee98fdfff */
0.934553921208, /* 0x0.ef3eecfff */
0.937083780759, /* 0x0.efe4b8fff */
0.939624726786, /* 0x0.f08b3f000 */
0.942198514924, /* 0x0.f133ebfff */
0.944726586343, /* 0x0.f1d99a000 */
0.947287976728, /* 0x0.f28176fff */
0.949856162070, /* 0x0.f329c5fff */
0.952431440345, /* 0x0.f3d28bfff */
0.955013573175, /* 0x0.f47bc5000 */
0.957603693021, /* 0x0.f52584000 */
0.960199773321, /* 0x0.f5cfa7000 */
0.962801992906, /* 0x0.f67a31000 */
0.965413510788, /* 0x0.f72556fff */
0.968030691152, /* 0x0.f7d0dc000 */
0.970655620084, /* 0x0.f87ce2fff */
0.973290979849, /* 0x0.f92998fff */
0.975926160805, /* 0x0.f9d64bfff */
0.978571653370, /* 0x0.fa83ac000 */
0.981225252139, /* 0x0.fb3193fff */
0.983885228626, /* 0x0.fbdfe6fff */
0.986552715296, /* 0x0.fc8eb7fff */
0.989228487027, /* 0x0.fd3e14000 */
0.991909801964, /* 0x0.fdedcd000 */
0.994601726545, /* 0x0.fe9e38000 */
0.997297704209, /* 0x0.ff4ee6fff */
1.000000000000, /* 0x1.000000000 */
1.002710938457, /* 0x1.00b1aa000 */
1.005429744692, /* 0x1.0163d7ffe */
1.008155703526, /* 0x1.02167dffe */
1.010888457284, /* 0x1.02c995fff */
1.013629436498, /* 0x1.037d38000 */
1.016377568250, /* 0x1.043152000 */
1.019134163841, /* 0x1.04e5f9ffe */
1.021896362316, /* 0x1.059b00000 */
1.024668931945, /* 0x1.0650b3ffe */
1.027446627635, /* 0x1.0706be001 */
1.030234098408, /* 0x1.07bd6bffe */
1.033023953416, /* 0x1.087441ffe */
1.035824656494, /* 0x1.092bce000 */
1.038632392900, /* 0x1.09e3d0001 */
1.041450142840, /* 0x1.0a9c79ffe */
1.044273972530, /* 0x1.0b558a001 */
1.047105550795, /* 0x1.0c0f1c001 */
1.049944162390, /* 0x1.0cc924001 */
1.052791833895, /* 0x1.0d83c4001 */
1.055645227426, /* 0x1.0e3ec3fff */
1.058507919326, /* 0x1.0efa60001 */
1.061377286898, /* 0x1.0fb66bfff */
1.064254641510, /* 0x1.1072fdffe */
1.067140102389, /* 0x1.113018000 */
1.070034146304, /* 0x1.11edc1fff */
1.072937250162, /* 0x1.12ac04001 */
1.075843691823, /* 0x1.136a7dfff */
1.078760385496, /* 0x1.1429a3ffe */
1.081685543070, /* 0x1.14e958000 */
1.084618330005, /* 0x1.15a98c000 */
1.087556362176, /* 0x1.166a18001 */
1.090508937863, /* 0x1.172b98001 */
1.093464612954, /* 0x1.17ed4bfff */
1.096430182434, /* 0x1.18afa5ffe */
1.099401354802, /* 0x1.19725e000 */
1.102381587017, /* 0x1.1a35adfff */
1.105370759965, /* 0x1.1af994000 */
1.108367800686, /* 0x1.1bbdfdffe */
1.111373305331, /* 0x1.1c82f6000 */
1.114387035385, /* 0x1.1d4878001 */
1.117408752440, /* 0x1.1e0e7ffff */
1.120437502874, /* 0x1.1ed4fe000 */
1.123474478729, /* 0x1.1f9c06000 */
1.126521706601, /* 0x1.2063ba001 */
1.129574775716, /* 0x1.212bd0001 */
1.132638812065, /* 0x1.21f49e000 */
1.135709524130, /* 0x1.22bddbffe */
1.138789534565, /* 0x1.2387b5fff */
1.141876101508, /* 0x1.2451fe000 */
1.144971728301, /* 0x1.251cddffe */
1.148077130296, /* 0x1.25e861ffe */
1.151189923305, /* 0x1.26b462001 */
1.154312610610, /* 0x1.278107ffe */
1.157440662410, /* 0x1.284e08001 */
1.160578370109, /* 0x1.291baa001 */
1.163725256932, /* 0x1.29e9e6000 */
1.166879892324, /* 0x1.2ab8a3ffe */
1.170044302935, /* 0x1.2b8805fff */
1.173205971694, /* 0x1.2c5739ffe */
1.176397800428, /* 0x1.2d2867ffe */
1.179586529747, /* 0x1.2df962001 */
1.182784795737, /* 0x1.2ecafbffe */
1.185991406414, /* 0x1.2f9d21ffe */
1.189206838636, /* 0x1.306fdc001 */
1.192430973067, /* 0x1.314328000 */
1.195664167430, /* 0x1.32170c001 */
1.198906540890, /* 0x1.32eb8a001 */
1.202157497408, /* 0x1.33c098000 */
1.205416083326, /* 0x1.349625fff */
1.208683252332, /* 0x1.356c43fff */
1.211961269402, /* 0x1.364318001 */
1.215246438983, /* 0x1.371a64000 */
1.218539118740, /* 0x1.37f22dffe */
1.221847295770, /* 0x1.38cafc000 */
1.225158572187, /* 0x1.39a3fdfff */
1.228481650325, /* 0x1.3a7dc5ffe */
1.231811761846, /* 0x1.3b5803fff */
1.235149741144, /* 0x1.3c32c5ffe */
1.238499879811, /* 0x1.3d0e53ffe */
1.241858124726, /* 0x1.3dea69fff */
1.245225191102, /* 0x1.3ec713fff */
1.248601436624, /* 0x1.3fa458000 */
1.251975655584, /* 0x1.40817a001 */
1.255380749731, /* 0x1.4160a2001 */
1.258783102010, /* 0x1.423f9bffe */
1.262198328973, /* 0x1.431f6e000 */
1.265619754780, /* 0x1.43ffa7fff */
1.269052743928, /* 0x1.44e0a4001 */
1.272490739830, /* 0x1.45c1f4000 */
1.275942921659, /* 0x1.46a432001 */
1.279397487615, /* 0x1.478697ffe */
1.282870173427, /* 0x1.486a2dffe */
1.286346316319, /* 0x1.494dfdffe */
1.289836049094, /* 0x1.4a32b2001 */
1.293333172770, /* 0x1.4b17e1ffe */
1.296839594835, /* 0x1.4bfdadfff */
1.300354957560, /* 0x1.4ce40fffe */
1.303882122055, /* 0x1.4dcb38001 */
1.307417988757, /* 0x1.4eb2f1ffe */
1.310960650439, /* 0x1.4f9b1dfff */
1.314516782746, /* 0x1.50842bfff */
1.318079948424, /* 0x1.516daffff */
1.321653246888, /* 0x1.5257de000 */
1.325237751030, /* 0x1.5342c8001 */
1.328829526907, /* 0x1.542e2c000 */
1.332433700535, /* 0x1.551a5fffe */
1.336045145966, /* 0x1.56070dffe */
1.339667558645, /* 0x1.56f473ffe */
1.343300342533, /* 0x1.57e287ffe */
1.346941947961, /* 0x1.58d130001 */
1.350594043714, /* 0x1.59c087ffe */
1.354256033883, /* 0x1.5ab085fff */
1.357932448365, /* 0x1.5ba175ffe */
1.361609339707, /* 0x1.5c926dfff */
1.365299344044, /* 0x1.5d8441ffe */
1.369003057507, /* 0x1.5e76fc001 */
1.372714757920, /* 0x1.5f6a3c000 */
1.376437187179, /* 0x1.605e2fffe */
1.380165219333, /* 0x1.615282001 */
1.383909463864, /* 0x1.6247e3ffe */
1.387661933907, /* 0x1.633dd0000 */
1.391424179060, /* 0x1.64345fffe */
1.395197510706, /* 0x1.652ba9fff */
1.399006724329, /* 0x1.66254dffe */
1.402773022651, /* 0x1.671c22000 */
1.406576037403, /* 0x1.68155dfff */
1.410389423392, /* 0x1.690f48001 */
};
/* Maximum magnitude in above table: 1269 */
#undef S
#define EXP2_TSIZE 8
#define EXP2_TTOL 9
#define EXP2_FSIZE 23
#define EXP2_FNAME float

View file

@ -1,6 +1,5 @@
fenv_const.c
fenv_libc.h
ppc-mcount.S
quad_float.h
fe_nomask.c
t_sqrt.c

View file

@ -1,15 +1,5 @@
ifeq ($(subdir),math)
libm-support += fenv_const fe_nomask t_sqrt
# These routines have not been tested, so it's probable they don't work;
# and they don't provide the complete list of FP routines. So there's
# no point in compiling them.
#sysdep_routines += q_feq q_fne q_utoq q_dtoq q_itoq q_stoq q_neg q_ulltoq \
# q_lltoq q_qtou q_qtoi q_qtoull q_qtoll q_qtos
tests += test-arith test-arithf
LDLIBS-test-arith = libm
LDLIBS-test-arithf = libm
endif
ifeq ($(subdir),gmon)

View file

@ -1,5 +1,5 @@
/* Inline math functions for powerpc.
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.
The GNU C Library is free software; you can redistribute it and/or
@ -17,9 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef __GNUC__
#if defined __GNUC__ && !defined _SOFT_FLOAT
#if __USE_ISOC9X && !defined _SOFT_FLOAT
#ifdef __USE_ISOC9X
# define __unordered_cmp(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
@ -53,7 +53,7 @@ lrint (double __x)
double __d;
long int __ll[2];
} __u;
asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
}
@ -65,7 +65,7 @@ lrintf (float __x)
double __d;
long int __ll[2];
} __u;
asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
}
@ -85,4 +85,4 @@ fdimf (float __x, float __y)
#endif /* __USE_ISOC9X */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
#endif /* __GNUC__ */
#endif /* __GNUC__ && !_SOFT_FLOAT */

View file

@ -1,549 +0,0 @@
/* Add or subtract two 128-bit floating point values. C prototype.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* Add 'a' to 'b' and put the result in 'result', but treat a[0]=axx,
b[0]=bxx. bxx differs from b[0] only in the high bit, similarly axx. */
/* Exceptions to raise:
- Invalid (SNaN)
- Invalid (Inf-Inf)
- Overflow
- Underflow
- Inexact
*/
/* Handle cases where exponent of a or b is maximum. */
static void
handle_max_exponent(unsigned result[4],
const unsigned a[4], const unsigned b[4],
const unsigned axx, /* Treat as a[0]. */
const unsigned bxx, /* Treat as b[0]. */
const unsigned ax, /* axx >> 16 & 0x7fff. */
const unsigned bx) /* bxx >> 16 & 0x7fff. */
{
int ax_ismax, bx_ismax;
unsigned a1,a2,a3, b1,b2,b3;
int a_zeromant, b_zeromant;
ax_ismax = ax == 0x7fff;
bx_ismax = bx == 0x7fff;
assert(ax_ismax || bx_ismax);
a1 = a[1]; a2 = a[2]; a3 = a[3];
b1 = b[1]; b2 = b[2]; b3 = b[3];
a_zeromant = (axx & 0xffff | a1 | a2 | a3) == 0;
b_zeromant = (bxx & 0xffff | b1 | b2 | b3) == 0;
/* Deal with SNaNs. */
if ( ax_ismax && !a_zeromant && (axx & 0x8000) == 0
|| bx_ismax && !b_zeromant && (bxx & 0x8000) == 0)
{
set_fpscr_bit(FPSCR_VXSNAN);
axx |= 0x8000; /* Demote the SNaN to a QNaN (whichever of */
bxx |= 0x8000; /* a or b it was). */
}
/* Deal with Inf-Inf. */
else if (a_zeromant && b_zeromant && (axx ^ bxx) == 0x80000000)
{
set_fpscr_bit(FPSCR_VXISI);
bxx |= 0x8000; /* Return an appropriate QNaN. */
}
/* Return the lexicographically larger of a or b, ignoring the sign
bits. */
if ((axx & 0x7fffffff) > (bxx & 0x7fffffff)) goto return_a;
else if ((axx & 0x7fffffff) < (bxx & 0x7fffffff)) goto return_b;
else if (a1 > b1) goto return_a;
else if (a1 < b1) goto return_b;
else if (a2 > b2) goto return_a;
else if (a2 < b2) goto return_b;
else if (a3 > b3) goto return_a; /* I've clearly been writing too */
else if (a3 < b3) goto return_b; /* much Fortran... */
/* If they are equal except for the sign bits, return 'b'. */
return_b:
result[0] = bxx; result[1] = b1; result[2] = b2; result[3] = b3;
return;
return_a:
result[0] = axx; result[1] = a1; result[2] = a2; result[3] = a3;
return;
}
/* Renormalise and output a FP number. */
static void
renormalise_value(unsigned result[4],
const unsigned axx,
unsigned ax,
unsigned r0,
unsigned r1,
unsigned r2,
unsigned r3)
{
int rshift;
if (r0 != 0 || cntlzw(a1) < 16 || 32 > ax-1)
{
rshift = cntlzw(r0)-15 + (-(cntlzw(r0) >> 5) & cntlzw(a1));
assert(rshift < 32);
if (rshift > ax-1)
{
ax--;
rshift = ax;
}
result[0] = (axx & 0x80000000
| ax-rshift << 16
| r0 << rshift & 0xffff
| a1 >> 32-rshift & 0xffff);
result[1] = a1 << rshift | a2 >> 32-rshift;
result[2] = a2 << rshift | a3 >> 32-rshift;
result[3] = a3 << rshift;
return;
}
result[3] = 0;
/* Special case for zero. */
if (a1 == 0 && a2 == 0 && a3 == 0)
{
result[0] = axx & 0x80000000;
result[1] = result[2] = 0;
return;
}
while (a1 != 0 && cntlzw(a2) >= 16 && 64 <= ax-1)
{
ax -= 32;
a1 = a2; a2 = a3; a3 = 0;
}
rshift = cntlzw(a1)-15 + (-(cntlzw(a1) >> 5) & cntlzw(a2));
assert(rshift < 32);
if (rshift > ax-1-32)
{
ax--;
rshift = ax-32;
}
result[0] = (axx & 0x80000000
| ax-rshift-32 << 16
| a1 << rshift & 0xffff
| a2 >> 32-rshift & 0xffff);
result[1] = a2 << rshift | a3 >> 32-rshift;
result[2] = a3 << rshift;
return;
}
/* Handle the case where one or both numbers are denormalised or zero.
This case almost never happens, so we don't slow the main code
with it. */
static void
handle_min_exponent(unsigned result[4],
const unsigned a[4], const unsigned b[4],
const unsigned axx, /* Treat as a[0]. */
const unsigned bxx, /* Treat as b[0]. */
const unsigned ax, /* axx >> 16 & 0x7fff. */
const unsigned bx) /* bxx >> 16 & 0x7fff. */
{
int ax_denorm, bx_denorm;
unsigned a1,a2,a3, b1,b2,b3;
int a_zeromant, b_zeromant;
ax_denorm = ax == 0;
bx_denorm = bx == 0;
assert(ax_denorm || bx_denorm);
a1 = a[1]; a2 = a[2]; a3 = a[3];
b1 = b[1]; b2 = b[2]; b3 = b[3];
}
/* Add a+b+cin modulo 2^32, put result in 'r' and carry in 'cout'. */
#define addc(r,cout,a,b,cin) \
do { \
unsigned long long addc_tmp = (a)+(b)+(cin);
(cout) = addc_tmp >> 32;
(r) = addc_tmp;
}
/* Calculate a+~b+cin modulo 2^32, put result in 'r' and carry in 'cout'. */
#define subc(r,cout,a,b,cin) \
do { \
unsigned long long addc_tmp = (a)-(b)+(cin)-1;
(cout) = addc_tmp >> 63;
(r) = addc_tmp;
}
/* Handle the case where both exponents are the same. This requires quite
a different algorithm than the general case. */
static void
handle_equal_exponents(unsigned result[4],
const unsigned a[4], const unsigned b[4],
const unsigned axx, /* Treat as a[0]. */
const unsigned bxx, /* Treat as b[0]. */
unsigned ax) /* [ab]xx >> 16 & 0x7fff. */
{
unsigned a1,a2,a3, b1,b2,b3;
int roundmode;
unsigned carry, r0;
a1 = a[1]; a2 = a[2]; a3 = a[3];
b1 = b[1]; b2 = b[2]; b3 = b[3];
if ((int)(axx ^ bxx) >= 0)
{
int roundmode;
/* Adding. */
roundmode = fegetround();
/* What about overflow? */
if (ax == 0x7ffe)
{
/* Oh no! Too big! */
/* Result:
rounding result
-------- ------
nearest return Inf with sign of a,b
zero return nearest possible non-Inf value with
sign of a,b
+Inf return +Inf if a,b>0, otherwise return
value just before -Inf.
-Inf return +Inf if a,b>0, otherwise return
value just before -Inf.
*/
set_fpscr_bit(FPSCR_OX);
/* Overflow always produces inexact result. */
set_fpscr_bit(FPSCR_XX);
if ( roundmode == FE_TONEAREST
|| roundmode == FE_UPWARD && (int)axx >= 0
|| roundmode == FE_DOWNWARD && (int)axx < 0)
{
result[3] = result[2] = result[1] = 0;
result[0] = axx & 0xffff0000 | 0x7fff0000;
}
else
{
result[3] = result[2] = result[1] = 0xffffffff;
result[0] = axx & 0xfffe0000 | 0x7ffeffff;
}
return;
}
/* We need to worry about rounding/inexact here. Do it like this: */
if (a3 + b3 & 1)
{
/* Need to round. Upwards? */
set_fpscr_bit(FPSCR_XX);
carry = ( roundmode == FE_NEAREST && (a3 + b3 & 2) != 0
|| roundmode == FE_UPWARD && (int)axx >= 0
|| roundmode == FE_DOWNWARD && (int)axx < 0);
}
else
carry = 0; /* Result will be exact. */
/* Perform the addition. */
addc(a3,carry,a3,b3,carry);
addc(a2,carry,a2,b2,carry);
addc(a1,carry,a1,b1,carry);
r0 = (axx & 0xffff) + (bxx & 0xffff) + carry;
/* Shift right by 1. */
result[3] = a3 >> 1 | a2 << 31;
result[2] = a2 >> 1 | a1 << 31;
result[1] = a1 >> 1 | r0 << 31;
/* Exponent of result is exponent of inputs plus 1.
Sign of result is common sign of inputs. */
result[0] = r0 >> 1 & 0xffff | axx + 0x10000 & 0xffff0000;
}
else
{
/* Subtracting. */
/* Perform the subtraction, a-b. */
subc(a3,carry,a3,b3,0);
subc(a2,carry,a2,b2,carry);
subc(a1,carry,a1,b1,carry);
subc(r0,carry,a0&0xffff,b0&0xffff,carry);
/* Maybe we should have calculated b-a... */
if (carry)
{
subc(a3,carry,0,a3,0);
subc(a2,carry,0,a2,carry);
subc(a1,carry,0,a1,carry);
subc(r0,carry,0,r0,carry);
axx ^= 0x80000000;
}
renormalise_value(result, axx, ax, r0, a1, a2, a3);
}
}
static void
add(unsigned result[4], const unsigned a[4], const unsigned b[4],
unsigned axx, unsigned bxx)
{
int ax, bx, diff, carry;
unsigned a0,a1,a2,a3, b0,b1,b2,b3,b4, sdiff;
ax = axx >> 16 & 0x7fff;
bx = bxx >> 16 & 0x7fff;
/* Deal with NaNs and Inf. */
if (ax == 0x7fff || bx == 0x7fff)
{
handle_max_exponent(result, a, b, axx, bxx, ax, bx);
return;
}
/* Deal with denorms and zero. */
if (ax == 0 || bx == 0)
{
handle_min_exponent(result, a, b, axx, bxx, ax, bx);
return;
}
/* Finally, one special case, when both exponents are equal. */
if (ax == bx)
{
handle_equal_exponents(result, a, b, axx, bxx, ax);
return;
}
sdiff = axx ^ bxx;
/* Swap a and b if b has a larger magnitude than a, so that a will have
the larger magnitude. */
if (ax < bx)
{
const unsigned *t;
t = b; b = a; a = t;
diff = bx - ax;
ax = bx;
axx = bxx;
}
else
diff = ax - bx;
a0 = a[0] & 0xffff | 0x10000; a1 = a[1]; a2 = a[2]; a3 = a[3];
b0 = b[0] & 0xffff | 0x10000; b1 = b[1]; b2 = b[2]; b3 = b[3];
if (diff < 32)
{
b4 = b3 << 32-diff;
b3 = b3 >> diff | b2 << 32-biff;
b2 = b2 >> diff | b1 << 32-diff;
b1 = b1 >> diff | b0 << 32-diff;
b0 = b0 >> diff;
}
else if (diff < 64)
{
diff -= 32;
b4 = b3 & 1 | b3 >> (diff == 32) | b2 << 32-biff;
b3 = b2 >> diff | b1 << 32-diff;
b2 = b1 >> diff | b0 << 32-diff;
b1 = b0 >> diff;
b0 = 0;
}
else if (diff < 96)
{
b4 = b2 | b3 | b1 << 32-diff;
b3 = b1 >> diff | b0 << 32-diff;
b2 = b0 >> diff;
b1 = b0 = 0;
}
else if (diff < 128)
{
b4 = b1 | b2 | b3 | b0 << 32-diff;
b3 = b0 >> diff;
b2 = b1 = b0 = 0;
}
else
{
b4 = b0|b1|b2|b3;
b3 = b2 = b1 = b0 = 0;
}
/* Now, two cases: one for addition, one for subtraction. */
if ((int)sdiff >= 0)
{
/* Addition. */
/*
/* Perform the addition. */
addc(a3,carry,a3,b3,0);
addc(a2,carry,a2,b2,carry);
addc(a1,carry,a1,b1,carry);
addc(a0,carry,a0,b0,carry);
if (a0 & 0x20000)
{
/* Need to renormalise by shifting right. */
/* Shift right by 1. */
b4 = b4 | a3 << 31;
a3 = a3 >> 1 | a2 << 31;
a2 = a2 >> 1 | a1 << 31;
result[1] = a1 >> 1 | r0 << 31;
/* Exponent of result is exponent of inputs plus 1.
Sign of result is common sign of inputs. */
result[0] = r0 >> 1 & 0xffff | axx + 0x10000 & 0xffff0000;
}
}
else
{
/* Subtraction. */
}
}
/* Add the absolute values of two 128-bit floating point values,
give the result the sign of one of them. The only exception this
can raise is for SNaN. */
static void
aadd(unsigned result[4], const unsigned a[4], const unsigned b[4])
{
unsigned ax, bx, xd;
const unsigned *sml;
unsigned t0,t1,t2,t3,tx, s0,s1,s2,s3,s4, carry;
int rmode, xdelta, shift;
ax = a[0] >> 16 & 0x7fff;
bx = b[0] >> 16 & 0x7fff;
/* Deal with . */
if (ax == 0x7fff)
{
t0 = a[0]; t1 = a[1]; t2 = a[2]; t3 = a[3];
/* Check for SNaN. */
if ((t0 & 0x8000) == 0
&& (t0 & 0x7fff | t1 | t2 | t3) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Return b. */
result[0] = t0; result[1] = t1; result[2] = t2; result[3] = t3;
return;
}
/* Deal with b==Inf or b==NaN. */
if (bx == 0x7fff)
{
t0 = b[0]; t1 = b[1]; t2 = b[2]; t3 = b[3];
/* Check for SNaN. */
if ((t0 & 0x8000) == 0
&& (t0 & 0x7fff | t1 | t2 | t3) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Return b. */
result[0] = t0; result[1] = t1; result[2] = t2; result[3] = t3;
return;
}
/* Choose the larger of the two to be 't', and the smaller to be 's'. */
if (ax > bx)
{
t0 = a[0] & 0xffff | (ax != 0) << 16;
t1 = a[1]; t2 = a[2]; t3 = a[3]; tx = ax;
s0 = b[0] & 0xffff | (bx != 0) << 16;
s1 = b[1]; s2 = b[2]; s3 = b[3];
xd = ax-bx;
}
else
{
t0 = b[0] & 0xffff | (bx != 0) << 16;
t1 = b[1]; t2 = b[2]; t3 = b[3]; tx = bx;
s0 = a[0] & 0xffff | (ax != 0) << 16;
s1 = a[1]; s2 = a[2]; s3 = a[3];
sml = a;
xd = bx-ax;
}
/* Shift 's2' right by 'xd' bits. */
switch (xd >> 5)
{
case 0:
s4 = 0;
break;
case 1:
s4 = s3; s3 = s2; s2 = s1; s1 = s0; s0 = 0;
break;
case 2:
s4 = s2 | s3 != 0;
s3 = s1; s2 = s0; s1 = s0 = 0;
break;
case 3:
s4 = s1 | (s3|s2) != 0;
s3 = s0; s2 = s1 = s0 = 0;
break;
default:
s4 = s0 | (s3|s2|s1) != 0;
s3 = s2 = s1 = s0 = 0;
}
xd = xd & 0x1f;
if (xd != 0)
{
s4 = s4 >> xd | (s4 << 32-xd) != 0 | s3 << 32-xd;
s3 = s3 >> xd | s2 << 32-xd;
s2 = s2 >> xd | s1 << 32-xd;
s1 = s1 >> xd | s0 << 32-xd;
s0 = s0 >> xd;
}
/* Do the addition. */
#define addc(r,cout,a,b,cin) \
do { \
unsigned long long addc_tmp = (a)+(b)+(cin);
(cout) = addc_tmp >> 32;
(r) = addc_tmp;
}
addc(t3,carry,t3,s3,0);
addc(t2,carry,t2,s2,carry);
addc(t1,carry,t1,s1,carry);
t0 = t0 + s0 + carry;
/* Renormalise. */
xdelta = 15-cntlzw(t0);
if (tx + xdelta <= 0x7fff)
shift = xdelta;
else
{
}
}
/* Add two 128-bit floating point values. */
void
__q_add(unsigned result[4], const unsigned a[4], const unsigned b[4])
{
if ((a[0] ^ b[0]) >= 0)
aadd(result, a, b);
else
asubtract(result, a, b);
}
/* Subtract two 128-bit floating point values. */
void
__q_sub(unsigned result[4], const unsigned a[4], const unsigned b[4])
{
if ((a[0] ^ b[0]) < 0)
aadd(result, a, b);
else
asubtract(result, a, b);
}

View file

@ -1,66 +0,0 @@
/* 64-bit floating point to 128-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_dtoq(double a);
Convert 'a' to long double. Don't raise exceptions.
*/
void
__q_dtoq(unsigned long long result[2], double a)
{
unsigned ux, rx;
union {
double d;
unsigned long long u;
} u;
u.d = a;
result[1] = u.u << 64-4;
result[0] = u.u >> 4;
/* correct exponent bias */
rx = ((long long)u.u >> 52 & 0x87ff) + 16383-1023;
ux = u.u >> 52 & 0x7ff;
if (ux == 0)
{
if ((u.u & 0x7fffffffffffffffULL) == 0)
{
/* +0.0 or -0.0. */
rx &= 0x8000;
}
else
{
/* Denormalised number. Renormalise. */
unsigned long long um = u.u & 0x000fffffffffffffULL;
int cs = cntlzd(um) - 12 + 1;
rx -= cs;
um <<= cs;
result[0] = um >> 4;
result[1] = um << 64-4;
}
}
else if (ux == 0x7ff)
{
/* Inf or NaN. */
rx |= 0x7fff;
}
*(unsigned short *)result = rx;
}

View file

@ -1,65 +0,0 @@
/* 128-bit floating point unordered equality.
Copyright (C) 1997 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. */
#include <fenv_libc.h>
/* int _q_feq(const long double *a, const long double *b);
Returns nonzero if a==b, 0 otherwise.
Special cases:
NaNs are never equal to anything;
-0 == +0;
If either argument is a SNaN, we set FPSCR_VXSNAN to cause an
'invalid operation' exception.
*/
int
__q_feq(const unsigned a[4], const unsigned b[4])
{
unsigned a0, b0;
a0 = a[0]; b0 = b[0];
if ((a0 >> 16 & 0x7fff) != 0x7fff &&
(b0 >> 16 & 0x7fff) != 0x7fff)
{
unsigned a3,b3,a2,b2,a1,b1;
unsigned z, result;
a3 = a[3]; b3 = b[3]; a2 = a[2];
b2 = b[2]; a1 = a[1]; b1 = b[1];
result = ~(a3 ^ b3);
result &= ~(a2 ^ b2);
result &= ~(a1 ^ b1);
z = a3 | a2;
z |= a1;
z = (z >> 1 | z | a0) & 0x7fffffff;
/* 'z' is 0 iff a==0.0, otherwise between 1 and 0x7fffffff */
return (result & ~(a0^b0 & ~(-z & 0x80000000)))+1;
}
else
{
/* Deal with SNaNs */
if (((a0|b0) & 0x8000) == 0)
{
set_fpscr_bit(FPSCR_VXSNAN);
}
return 0;
}
}

View file

@ -1,70 +0,0 @@
/* 128-bit floating point unordered not-equality.
Copyright (C) 1997 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. */
#include <fenv_libc.h>
/* int _q_fne(const long double *a, const long double *b);
Returns 0 if a==b
Special cases:
NaNs return 1 always;
-0 == +0;
If either argument is a SNaN, we set FPSCR_VXSNAN to cause an
'invalid operation' exception.
*/
int
__q_fne(const unsigned a[4], const unsigned b[4])
{
unsigned a0, b0;
a0 = a[0]; b0 = b[0];
if ((a0 >> 16 & 0x7fff) != 0x7fff &&
(b0 >> 16 & 0x7fff) != 0x7fff)
{
unsigned a3,b3,a2,b2,a1,b1;
unsigned z, result;
a3 = a[3]; b3 = b[3]; a2 = a[2];
result = a3 ^ b3;
b2 = b[2];
if (result != 0)
return result;
a1 = a[1]; b1 = b[1];
result = a2 ^ b2;
result |= a1 ^ b1;
z = a3 | a2;
if (result != 0)
return result;
z |= a1;
z = (z >> 1 | z | a0) & 0x7fffffff;
/* 'z' is 0 iff a==0.0, otherwise between 1 and 0x7fffffff */
return (a0^b0) & ~(-z & 0x80000000);
}
else
{
/* Deal with SNaNs */
if (((a0|b0) & 0x8000) == 0)
{
set_fpscr_bit(FPSCR_VXSNAN);
}
return 1;
}
}

View file

@ -1,50 +0,0 @@
/* 32-bit fixed point signed integer to 128-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_itoq(int a);
Convert 'a' to long double.
*/
void
__q_itoq(unsigned int result[4], int a)
{
unsigned rx;
int cs, css;
/* Note that if a==-2^31, then ua will be 2^31. */
unsigned int ua = abs(a);
/* Normalize. */
cs = cntlzw(ua);
ua <<= cs+1;
/* Calculate the exponent, in 4 easy instructions. */
css = 31-cs;
rx = 16383+css << 16 & ~css;
/* Copy the sign bit from 'a'. */
asm ("rlwimi %0,%1,0,0,0": "=r"(rx) : "r"(a), "0"(rx));
/* Put it all together. */
result[2] = result[3] = 0;
asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(ua), "0"(rx));
result[1] = ua << 16;
}

View file

@ -1,52 +0,0 @@
/* 64-bit fixed point signed integer to 128-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_ulltoq(long long a);
Convert 'a' to long double.
*/
void
__q_lltoq(unsigned int result[4], long long a)
{
unsigned rx;
int cs, css;
/* Calculate absolute value of 'a'. */
unsigned long long ua = (a ^ a >> 63) - (a >> 63);
/* Normalize. */
cs = cntlzd(a);
ua <<= cs+1;
/* Calculate the exponent, in 4 easy instructions. */
css = 63-cs;
rx = 16383+css << 16 & ~css;
/* Copy the sign bit from 'a'. */
asm ("rlwimi %0,%1,0,0,0": "=r"(rx) : "r"(a >> 32), "0"(rx));
/* Put it all together. */
result[3] = 0;
asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(ua >> 32), "0"(rx));
ua <<= 16;
result[2] = ua;
result[1] = ua >> 32;
}

View file

@ -1,38 +0,0 @@
/* Negate a 128-bit floating point value.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_neg(const long double *a);
Negate 'a'. Don't raise exceptions.
*/
void
__q_neg(unsigned int result[4], unsigned int a[4])
{
unsigned int t1,t2;
t1 = a[0];
t2 = a[1];
result[0] = t1 ^ 0x80000000;
t1 = a[2];
result[1] = t2;
t2 = a[3];
result[2] = t1;
result[3] = t2;
}

View file

@ -1,65 +0,0 @@
/* 128-bit floating point to 32-bit fixed point signed integer.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* int _q_qtoi(const long double *a);
Convert 'a' to signed int by truncation.
Special cases:
NaN: raise VXCVI, return 0x80000000
SNaN: raise VXSNAN, VXCVI, and return 0x80000000
>= 2^32: raise VXCVI, return 0x7fffffff
<= -2^32: raise VXCVI, return 0x80000000
*/
int
__q_qtoi(const unsigned long long a[2])
{
int ax, sgn;
unsigned long long a0;
a0 = a[0];
/* 'sgn' is -1 if 'a' is negative, 0 if positive. */
sgn = (long long)a0 >> 63;
ax = (a0 >> 48 & 0x7fff) - 16383;
/* Deal with non-special cases. */
if (ax <= 30)
/* If we had a '>>' operator that behaved properly with respect to
large shifts, we wouldn't need the '& -(ax >> 31)' term, which
clears 'result' if ax is negative. The '^ sgn) - sgn' part is
equivalent in this case to multiplication by 'sgn', but usually
faster. */
return (((unsigned)(a0 >> 17 | 0x80000000) >> 31-ax & -(ax >> 31))
^ sgn) - sgn;
/* Check for SNaN, if so raise VXSNAN. */
if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
&& (a[1] | a0 & 0x00007fffffffffffULL) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Treat all NaNs as large negative numbers. */
sgn |= -cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
/* All the specials raise VXCVI. */
set_fpscr_bit(FPSCR_VXCVI);
/* Return 0x7fffffff (if a < 0) or 0x80000000 (otherwise). */
return sgn ^ 0x7fffffff;
}

View file

@ -1,64 +0,0 @@
/* 128-bit floating point to 64-bit fixed point signed integer.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long long _q_qtoll(const long double *a);
Convert 'a' to signed long long by truncation.
Special cases:
NaN: raise VXCVI, return 0x8000000000000000
SNaN: raise VXSNAN, VXCVI, and return 0x8000000000000000
>= 2^32: raise VXCVI, return 0x7fffffffffffffff
<= -2^32: raise VXCVI, return 0x8000000000000000
*/
long long
__q_qtoll(const unsigned long long a[2])
{
int ax, sgn;
unsigned long long a0, a1;
a0 = a[0]; a1 = a[1];
/* 'sgn' is -1 if 'a' is negative, 0 if positive. */
sgn = (long long)a0 >> 63;
ax = (a0 >> 48 & 0x7fff) - 16383;
/* Deal with non-special cases. */
if (ax <= 62)
/* If we had a '>>' operator that behaved properly with respect to
large shifts, we wouldn't need the '& -(ax >> 31)' term, which
clears 'result' if ax is negative. The '^ sgn) - sgn' part is
equivalent in this case to multiplication by 'sgn', but faster. */
return (((a0 << 15 | a1 >> 64-15 | 0x8000000000000000ULL) >> 63-ax
& -(unsigned long long)(ax >> 31))
^ (long long)sgn) - sgn;
/* Check for SNaN, if so raise VXSNAN. */
if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
&& (a1 | a0 & 0x00007fffffffffffULL) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Treat all NaNs as large negative numbers. */
sgn |= -cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
/* All the specials raise VXCVI. */
set_fpscr_bit(FPSCR_VXCVI);
return (long long)sgn ^ 0x7fffffffffffffffLL;
}

View file

@ -1,84 +0,0 @@
/* 128-bit floating point to 32-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* float _q_qtos(const long double *a);
Convert 'a' to float. Round as per current rounding flags.
Input Rounding Output
+/-0 * +/-0
+/-Inf * +/-Inf
+/-NaN * +/-NaN (with mantissa truncated)
+/-SNaN * +/-NaN (with mantissa truncated, MSB of mantissa <- 1)
&& raise VXSNAN
[Note: just truncating the mantissa may not give you
a SNaN!]
|a|>=2^128 Nearest +/-Inf && raise overflow && raise inexact
|a|>=2^128 Truncate +/-(2^128-2^104) && raise overflow && raise inexact
a>=2^128 +Inf +Inf && raise overflow && raise inexact
a<=-2^128 +Inf -(2^128-2^104) && raise overflow && raise inexact
a>=2^128 -Inf +(2^128-2^104) && raise overflow && raise inexact
a<=-2^128 -Inf -Inf && raise overflow && raise inexact
We also need to raise 'inexact' if the result will be inexact, which
depends on the current rounding mode.
To avoid having to deal with all that, we convert to a 'double'
that will round correctly (but is not itself rounded correctly),
and convert that to a float. This makes this procedure much
simpler and much faster. */
float
__q_qtos(const unsigned long long a[2])
{
unsigned long long a0,d;
union {
double d;
unsigned long long ull;
} u;
a0 = a[0];
/* Truncate the mantissa to 48 bits. */
d = a0 << 4;
/* Set the low bit in the mantissa if any of the bits we are dropping
were 1. This ensures correct rounding, and also distinguishes
0 and Inf from denormalised numbers and SNaN (respectively). */
d |= a[1] != 0;
/* Copy the sign bit. */
d = d & 0x7fffffffffffffffULL | a0 & 0x8000000000000000ULL;
/* Now, we need to fix the exponent. If the exponent of a was in
the range +127 to -152, or was +16384 or -16383, it is already
correct in 'd'. Otherwise, we need to ensure that the new
exponent is in the range +1023 to +128, or -153 to -1022, with
the same sign as the exponent of 'a'. We can do this by setting
bits 1-3 (the second through fourth-most significant bit) of 'd'
to 101 if bit 1 of 'a' is 1, or 010 if bit 1 of 'a' is 0. */
if ((a0 >> 56 & 0x7f) - 0x3f > 1)
{
unsigned t = (a0 >> 32+2 & 2 << 31-1-2)*3 + (2 << 31-2);
d = (d & 0x8fffffffffffffffULL
| (unsigned long long)t<<32 & 0x7000000000000000ULL);
}
u.ull = d;
return (float)u.d;
}

View file

@ -1,64 +0,0 @@
/* 128-bit floating point to 32-bit fixed point unsigned integer.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* unsigned int _q_qtou(const long double *a);
Convert 'a' to unsigned int by truncation.
Special cases:
-0: return 0
NaN: raise VXCVI, return 0
SNaN: raise VXSNAN, VXCVI, and return 0
Negative numbers (other than -0, but including -Inf): raise VXCVI, return 0
>= 2^32: raise VXCVI, return 0xffffffff
*/
unsigned int
__q_qtou(const unsigned long long a[2])
{
int ax;
unsigned result;
unsigned long long a0;
/* Deal with non-special cases. */
a0 = a[0];
ax = (a0 >> 48) - 16383;
if (ax <= 31)
/* If we had a '>>' operator that behaved properly with respect to
large shifts, we wouldn't need the '& -(ax >> 31)' term, which
clears 'result' if ax is negative. */
return (unsigned)(a0 >> 17 | 0x80000000) >> 31-ax & -(ax >> 31);
/* 'result' is 1 if a is negative, 0 otherwise. */
result = a0 >> 63;
/* Check for -0, otherwise raise VXCVI. */
if (a0 != 0x8000000000000000ULL || a[1] != 0)
{
/* Check for SNaN, if so raise VXSNAN. */
if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
&& (a[1] | a0 & 0x00007fffffffffffULL) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Treat all NaNs as large negative numbers. */
result |= cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
set_fpscr_bit(FPSCR_VXCVI);
}
return result-1;
}

View file

@ -1,65 +0,0 @@
/* 128-bit floating point to 64-bit fixed point unsigned integer.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* unsigned long long _q_qtoull(const long double *a);
Convert 'a' to unsigned long long by truncation.
Special cases:
-0: return 0
NaN: raise VXCVI, return 0
SNaN: raise VXSNAN, VXCVI, and return 0
Negative numbers (other than -0, but including -Inf): raise VXCVI, return 0
>= 2^32: raise VXCVI, return 0xffffffffffffffff
*/
unsigned long long
__q_qtoull(const unsigned long long a[2])
{
int ax;
unsigned result;
unsigned long long a0, a1;
/* Deal with non-special cases. */
a0 = a[0]; a1 = a[1];
ax = (a0 >> 48) - 16383;
if (ax <= 63)
/* If we had a '>>' operator that behaved properly with respect to
large shifts, we wouldn't need the '& -(ax >> 31)' term, which
clears 'result' if ax is negative. */
return ((a0 << 15 | a1 >> 64-15 | 0x8000000000000000ULL) >> 63-ax
& -(unsigned long long)(ax >> 31));
/* 'result' is 1 if a is negative, 0 otherwise. */
result = a0 >> 63;
/* Check for -0, otherwise raise VXCVI. */
if (a0 != 0x8000000000000000ULL || a[1] != 0)
{
/* Check for SNaN, if so raise VXSNAN. */
if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
&& (a1 | a0 & 0x00007fffffffffffULL) != 0)
set_fpscr_bit(FPSCR_VXSNAN);
/* Treat all NaNs as large negative numbers. */
result |= cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
set_fpscr_bit(FPSCR_VXCVI);
}
return result-1LL;
}

View file

@ -1,65 +0,0 @@
/* 32-bit floating point to 128-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_stoq(float a);
Convert 'a' to long double. Don't raise exceptions.
*/
void
__q_stoq(unsigned long long result[2], float a)
{
unsigned ux, rx;
union {
float d;
unsigned u;
} u;
u.d = a;
result[1] = 0;
result[0] = u.u << 32-7;
/* correct exponent bias */
rx = ((int)u.u >> 23 & 0x80ff) + 16383-127;
ux = u.u >> 23 & 0xff;
if (ux == 0)
{
if ((u.u & 0x7fffffff) == 0)
{
/* +0.0 or -0.0. */
rx &= 0x8000;
}
else
{
/* Denormalised number. Renormalise. */
unsigned um = u.u & 0x007fffff;
int cs = cntlzw(um) - 9 + 1;
rx -= cs;
um <<= cs;
result[0] = um << 32-7;
}
}
else if (ux == 0xff)
{
/* Inf or NaN. */
rx |= 0x7fff;
}
*(unsigned short *)result = rx;
}

View file

@ -1,46 +0,0 @@
/* 64-bit fixed point unsigned integer to 128-bit floating point.
Copyright (C) 1997 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. */
#include <quad_float.h>
/* long double _q_ulltoq(unsigned long long a);
Convert 'a' to long double.
*/
void
__q_ulltoq(unsigned int result[4], unsigned long long a)
{
unsigned rx;
int cs, css;
/* Normalize. */
cs = cntlzd(a);
a <<= cs+1;
/* Calculate the exponent, in 4 easy instructions. */
css = 63-cs;
rx = 16383+css << 16 & ~css;
/* Put it all together. */
result[3] = 0;
result[0] = rx & 0xffff0000 | a >> 48 & 0x0000ffff;
a <<= 16;
result[2] = a;
result[1] = a >> 32;
}

View file

@ -1,44 +0,0 @@
/* Internal libc stuff for 128-bit IEEE FP emulation routines.
Copyright (C) 1997 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 _QUAD_FLOAT_H
#define _QUAD_FLOAT_H 1
#include <fenv_libc.h>
/* Returns the number of leading zero bits in 'x' (between 0 and 32
inclusive). 'x' is treated as being 32 bits long. */
#define cntlzw(x) \
({ unsigned p = (x); \
unsigned r; \
asm ("cntlzw %0,%1" : "=r"(r) : "r"(p)); \
r; })
/* Returns the number of leading zero bits in 'x' (between 0 and 64
inclusive). 'x' is treated as being 64 bits long. */
#define cntlzd(x) \
({ unsigned long long q = (x); \
unsigned int c1, c2; \
c1 = cntlzw(q >> 32); \
c2 = cntlzw(q); \
c1 + (-(c1 >> 5) & c2); })
#define shift_and_or
#endif /* quad_float.h */

View file

@ -73,8 +73,8 @@ EOF
for name in $weak; do
case $name in
*@@*)
base=`echo $name | sed 's/@.*//'`
ver=`echo $name | sed 's/@.*//'`
base=`echo $name | sed 's/@@.*//'`
ver=`echo $name | sed 's/.*@@//'`
if test -z "$vcount" ; then
source=$strong
vcount=1

View file

@ -8,6 +8,7 @@
#include <bits/types.h>
#define __need_size_t
#define __need_wchar_t
#define __need_wint_t
#define __need_NULL
#include <stddef.h>
@ -27,6 +28,7 @@ typedef unsigned int wint_t;
#define _G_off64_t __off64_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

View file

@ -25,12 +25,14 @@
it somewhere else.
...and this place is here. */
.data
.bss
.globl errno
.type errno,@object
.size errno,4
errno:
.space 4
.globl _errno
_errno:
.long 4
_errno = errno
/* The following code is only used in the shared library when we
compile the reentrant version. Otherwise each system call defines

View file

@ -1,5 +1,5 @@
/* Operating system support for run-time dynamic linker. Linux/PPC version.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 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
@ -23,11 +23,11 @@
#define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \
do { \
void **_tmp; \
char **_tmp; \
(argc) = *(long *) cookie; \
(argv) = (char **) cookie + 1; \
(envp) = (argv) + (argc) + 1; \
for (_tmp = (void **) (envp); *_tmp; ++_tmp) \
for (_tmp = (envp); *_tmp; ++_tmp) \
continue; \
/* The following '++' is important! */ \
++_tmp; \
@ -35,9 +35,15 @@
{ \
size_t _test = (size_t)_tmp; \
_test = _test + 0xf & ~0xf; \
_tmp = (void **)_test; \
/* When ld.so is being run directly, there is no \
alignment (and no argument vector), so we make a \
basic sanity check of the argument vector. Of \
course, this means that in future, the argument \
vector will have to be laid out to allow for this \
test :-(. */ \
if (((ElfW(auxv_t) *)_test)->a_type <= AT_PHDR) \
} \
(auxp) = (void *) _tmp; \
(auxp) = (ElfW(auxv_t) *) _tmp; \
} while (0)

View file

@ -1,6 +1,11 @@
/* Define errno */
.common errno,4,4
.bss
.globl errno
.align 4
errno: .space 4
.type errno, @object
.size errno, 4
.globl _errno
_errno = errno

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
/* Copyright (C) 1991,92,93,94,95,96,97,98 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
@ -17,13 +17,15 @@
Boston, MA 02111-1307, USA. */
#include "version.h"
const char __libc_release[] = RELEASE;
const char __libc_version[] = VERSION;
#include <gnu/libc-version.h>
static const char __libc_release[] = RELEASE;
static const char __libc_version[] = VERSION;
static const char banner[] =
"GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\
Compiled by GNU CC version "__VERSION__".\n\
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.\n\
Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n"
@ -38,6 +40,20 @@ __libc_print_version (void)
__write (STDOUT_FILENO, banner, sizeof banner - 1);
}
const char *
__gnu_get_libc_release (void)
{
return __libc_release;
}
weak_alias (__gnu_get_libc_release, gnu_get_libc_release)
const char *
__gnu_get_libc_version (void)
{
return __libc_version;
}
weak_alias (__gnu_get_libc_version, gnu_get_libc_version)
#ifdef HAVE_ELF
/* This function is the entry point for the shared object.
Running the library as a program will get here. */

View file

@ -24,12 +24,12 @@
int
iswblank (wint_t wc)
{
return __iswctype (wc, _ISblank);
return __iswctype (wc, _ISwblank);
}
int
(__iswblank_l) (wint_t wc, __locale_t locale)
{
return __iswctype_l (wc, _ISblank, locale);
return __iswctype_l (wc, _ISwblank, locale);
}

View file

@ -25,17 +25,17 @@
#define func(name, type) \
int name (wc) wint_t wc; { return iswctype (wc, type); }
func (iswalnum, _ISalnum)
func (iswalpha, _ISalpha)
func (iswcntrl, _IScntrl)
func (iswdigit, _ISdigit)
func (iswlower, _ISlower)
func (iswgraph, _ISgraph)
func (iswprint, _ISprint)
func (iswpunct, _ISpunct)
func (iswspace, _ISspace)
func (iswupper, _ISupper)
func (iswxdigit, _ISxdigit)
func (iswalnum, _ISwalnum)
func (iswalpha, _ISwalpha)
func (iswcntrl, _ISwcntrl)
func (iswdigit, _ISwdigit)
func (iswlower, _ISwlower)
func (iswgraph, _ISwgraph)
func (iswprint, _ISwprint)
func (iswpunct, _ISwpunct)
func (iswspace, _ISwspace)
func (iswupper, _ISwupper)
func (iswxdigit, _ISwxdigit)
wint_t
towlower (wc)

View file

@ -25,17 +25,17 @@
int name (wint_t wc, __locale_t locale) \
{ return __iswctype_l (wc, type, locale); }
func (__iswalnum_l, _ISalnum)
func (__iswalpha_l, _ISalpha)
func (__iswcntrl_l, _IScntrl)
func (__iswdigit_l, _ISdigit)
func (__iswlower_l, _ISlower)
func (__iswgraph_l, _ISgraph)
func (__iswprint_l, _ISprint)
func (__iswpunct_l, _ISpunct)
func (__iswspace_l, _ISspace)
func (__iswupper_l, _ISupper)
func (__iswxdigit_l, _ISxdigit)
func (__iswalnum_l, _ISwalnum)
func (__iswalpha_l, _ISwalpha)
func (__iswcntrl_l, _ISwcntrl)
func (__iswdigit_l, _ISwdigit)
func (__iswlower_l, _ISwlower)
func (__iswgraph_l, _ISwgraph)
func (__iswprint_l, _ISwprint)
func (__iswpunct_l, _ISwpunct)
func (__iswspace_l, _ISwspace)
func (__iswupper_l, _ISwupper)
func (__iswxdigit_l, _ISwxdigit)
wint_t
(__towlower_l) (wint_t wc, __locale_t locale)

View file

@ -45,9 +45,9 @@ wctype (const char *property)
#if __BYTE_ORDER == __BIG_ENDIAN
return result;
#else
#define XSWAPU32(w) \
((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8))
# define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
return XSWAPU32 (result);
return SWAPU32 (result);
#endif
}

View file

@ -60,34 +60,34 @@ typedef unsigned int wint_t;
character classifications. */
typedef unsigned long int wctype_t;
# ifndef _ISbit
# ifndef _ISwbit
/* The characteristics are stored always in network byte order (big
endian). We define the bit value interpretations here dependent on the
machine's byte order. */
# include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN
# define _ISbit(bit) (1 << bit)
# define _ISwbit(bit) (1 << bit)
# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
# define _ISbit(bit) (bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
# define _ISwbit(bit) (bit < 8 ? 1UL << (bit + 24) : 1UL << (bit + 8))
# endif
enum
{
_ISupper = _ISbit (0), /* UPPERCASE. */
_ISlower = _ISbit (1), /* lowercase. */
_ISalpha = _ISbit (2), /* Alphabetic. */
_ISdigit = _ISbit (3), /* Numeric. */
_ISxdigit = _ISbit (4), /* Hexadecimal numeric. */
_ISspace = _ISbit (5), /* Whitespace. */
_ISprint = _ISbit (6), /* Printing. */
_ISgraph = _ISbit (7), /* Graphical. */
_ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */
_IScntrl = _ISbit (9), /* Control character. */
_ISpunct = _ISbit (10), /* Punctuation. */
_ISalnum = _ISbit (11) /* Alphanumeric. */
_ISwupper = _ISwbit (0), /* UPPERCASE. */
_ISwlower = _ISwbit (1), /* lowercase. */
_ISwalpha = _ISwbit (2), /* Alphabetic. */
_ISwdigit = _ISwbit (3), /* Numeric. */
_ISwxdigit = _ISwbit (4), /* Hexadecimal numeric. */
_ISwspace = _ISwbit (5), /* Whitespace. */
_ISwprint = _ISwbit (6), /* Printing. */
_ISwgraph = _ISwbit (7), /* Graphical. */
_ISwblank = _ISwbit (8), /* Blank (usually SPC and TAB). */
_ISwcntrl = _ISwbit (9), /* Control character. */
_ISwpunct = _ISwbit (10), /* Punctuation. */
_ISwalnum = _ISwbit (11) /* Alphanumeric. */
};
# endif /* Not _ISbit */
# endif /* Not _ISwbit */
__BEGIN_DECLS
@ -178,20 +178,20 @@ extern wint_t __towctrans __P ((wint_t __wc, wctrans_t __desc));
# ifndef __NO_WCTYPE
# define iswalnum(wc) __iswctype ((wc), _ISalnum)
# define iswalpha(wc) __iswctype ((wc), _ISalpha)
# define iswcntrl(wc) __iswctype ((wc), _IScntrl)
# define iswdigit(wc) __iswctype ((wc), _ISdigit)
# define iswlower(wc) __iswctype ((wc), _ISlower)
# define iswgraph(wc) __iswctype ((wc), _ISgraph)
# define iswprint(wc) __iswctype ((wc), _ISprint)
# define iswpunct(wc) __iswctype ((wc), _ISpunct)
# define iswspace(wc) __iswctype ((wc), _ISspace)
# define iswupper(wc) __iswctype ((wc), _ISupper)
# define iswxdigit(wc) __iswctype ((wc), _ISxdigit)
# define iswalnum(wc) __iswctype ((wc), _ISwalnum)
# define iswalpha(wc) __iswctype ((wc), _ISwalpha)
# define iswcntrl(wc) __iswctype ((wc), _ISwcntrl)
# define iswdigit(wc) __iswctype ((wc), _ISwdigit)
# define iswlower(wc) __iswctype ((wc), _ISwlower)
# define iswgraph(wc) __iswctype ((wc), _ISwgraph)
# define iswprint(wc) __iswctype ((wc), _ISwprint)
# define iswpunct(wc) __iswctype ((wc), _ISwpunct)
# define iswspace(wc) __iswctype ((wc), _ISwspace)
# define iswupper(wc) __iswctype ((wc), _ISwupper)
# define iswxdigit(wc) __iswctype ((wc), _ISwxdigit)
# ifdef __USE_GNU
# define iswblank(wc) __iswctype ((wc), _ISblank)
# define iswblank(wc) __iswctype ((wc), _ISwblank)
# endif
@ -307,19 +307,19 @@ extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
# ifndef __NO_WCTYPE
# define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISalnum, (loc))
# define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISalpha, (loc))
# define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _IScntrl, (loc))
# define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISdigit, (loc))
# define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISlower, (loc))
# define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISgraph, (loc))
# define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISprint, (loc))
# define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISpunct, (loc))
# define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISspace, (loc))
# define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISupper, (loc))
# define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISxdigit, (loc))
# define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISwalnum, (loc))
# define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISwalpha, (loc))
# define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _ISwcntrl, (loc))
# define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISwdigit, (loc))
# define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISwlower, (loc))
# define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISwgraph, (loc))
# define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISwprint, (loc))
# define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISwpunct, (loc))
# define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISwspace, (loc))
# define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISwupper, (loc))
# define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISwxdigit, (loc))
# define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISblank, (loc))
# define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISwblank, (loc))
# define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
(loc))

View file

@ -45,9 +45,9 @@ __wctype_l (const char *property, __locale_t locale)
#if __BYTE_ORDER == __BIG_ENDIAN
return result;
#else
#define XSWAPU32(w) \
((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8))
# define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
return XSWAPU32 (result);
return SWAPU32 (result);
#endif
}