diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-09-24 23:03:42 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-09-24 23:03:42 +0000 |
commit | 650425ceb40e840b2123b6c8cc65389589f41218 (patch) | |
tree | 70ff83fbe8f34a7829b4a0b511d2cb02ccbcbf2a /sysdeps | |
parent | 2604afb1b2d9acc3c70b1214285f996200bf0358 (diff) | |
download | glibc-650425ceb40e840b2123b6c8cc65389589f41218.tar.gz glibc-650425ceb40e840b2123b6c8cc65389589f41218.tar.xz glibc-650425ceb40e840b2123b6c8cc65389589f41218.zip |
Update. cvs/libc-ud-970924
1997-09-25 00:23 Ulrich Drepper <drepper@cygnus.com> * elf/dl-profile.c: Correct implementation. * io/ftwtest-sh: Don't depend on TMPDIR == /tmp. * locale/setlocale.c: Rewrite a bit for more clarity. * math/Makefile (libm-calls): Add w_exp2. * math/math_private.h: Add prototypes for __ieee754_exp2{,f,l}. * sysdeps/libm-i387/s_exp2.S: Change name to __ieee754_exp2. * sysdeps/libm-i387/s_exp2f.S: Likewise. * sysdeps/libm-i387/s_exp2l.S: Likewise. * sysdeps/libm-ieee754/k_standard.c: Add error cases for exp2. * string/bits/string2.h (__strcpy_small): Optimize. (__stpcpy_small): Likewise. (strncpy): Use variable for dest argument since it's used more than once. (strncat): Likewise. (strcmp): Add optimization for this function. * sysdeps/i386/i486/string.h (strlen): Correctly use __builtin_strlen. (__strcpy_small): Optimize. (__stpcpy_small): Likewise. (__stpcpy_c): Correctly use __mempcpy_* macros. (__mempcpy_by2, __mempcpy_by4, __mempcpy_byn): Return pointer to byte following last copied. (strncat): Use variable for dest argument since it's used more than once. (strcmp): Add optimization for this function. * sysdeps/i386/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): Use .text and .previous to select correct section. 1997-09-23 19:56 Philip Blundell <Philip.Blundell@pobox.com> * configure.in: Add `--disable-versioning' option to suppress the use of symbol versions even if binutils claims to support it. 1997-09-24 20:10 Philip Blundell <Philip.Blundell@pobox.com> * csu/Makefile (before-compile): Don't try to build abi-tags.h if not using ELF. 1997-09-21 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/sofini.c [HAVE_DWARF2_UNWIND_INFO]: Supply termination for the frame unwind info section. * elf/soinit.c [HAVE_DWARF2_UNWIND_INFO]: Register and unregister the frame unwind info. * config.h.in (HAVE_DWARF2_UNWIND_INFO): Add #undef. * configure.in: Check whether gcc supports DWARF2 unwind info. * libc.map: Export frame handling tables. 1997-09-10 06:56 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/unix/sysv/linux/powerpc/bits/kernel_termios.h: Use the size of the kernel's termios structure for ioctls. * sysdeps/powerpc/dl-machine.h: Prepare for library profiling. * sysdeps/powerpc/bits/mathinline.h: Add slightly slower versions of the C9X FP comparison macros. Delete 'fabs' and 'sqrt' inline routines, because gcc has them as internals. * sysdeps/powerpc/Makefile (pic-ccflags): Define this instead of CFLAGS-.os. * sysdeps/powerpc/bzero.S: New file. * sysdeps/powerpc/strcat.c: New file. * sysdeps/powerpc/strcpy.S: New file. * sysdeps/powerpc/stpcpy.S: New file. * math/Makefile: Add atest_exp2, test-reduce. * math/atest_exp2.c: New file. * math/test-reduce.c: New file. * sysdeps/libm-ieee754/Dist: New file. * sysdeps/libm-ieee754/s_exp2.c: New file. * sysdeps/libm-ieee754/s_exp2f.c: New file. * sysdeps/libm-ieee754/t_exp2.h: New file. * sysdeps/libm-ieee754/t_exp2f.h: New file. * math/libm-test.c (exp2_test): Add some more tests. * Rules: Use empty.os instead of empty.o, since it gets linked into libc.so... * configure.in: Add --disable-static to disable building .a files. * config.make.in: Substitute the new variable. * Makeconfig: Don't build .o files if not building .a files. * elf/dl-runtime.c (fixup): Factor out call to elf_machine_relplt. (profile_fixup): Likewise. 1997-09-23 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/globtest.c (main): Change to directory passed as first argument. * posix/globtest.sh: Don't cd before running the program, instead pass testdir as argument, so that $common_objpfx remains valid. 1997-09-23 18:01 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nis_call.c (__do_niscall2): Fix multiple Server support. * nis/nis_findserver.c: Save latest working sockaddr_in. 1997-09-17 22:07 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Automatically determine whether as and ld are the GNU versions. (options): --with-gnu-{as,ld,binutils} replaced by single option --with-binutils=PATH specifying a -B option to gcc. * aclocal.m4: Two new macros defined, LIBC_PROG_FOO_GNU and LIBC_PROG_BINUTILS. * configure.in: Allow the user to force configuration for unsupported platforms with an undocumented option. 1997-09-22 16:55 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sunrpc/get_myaddr.c (get_myaddress): Avoid loopback interfaces, return loopback address only if there is no other interface. * nis/Makefile: Add nis_callback libnsl-routines. * nis/nis_add.c: Use new __do_niscall* interface. * nis/nis_cache.c: Likewise. * nis/nis_checkpoint.c: Likewise. * nis/nis_lookup.c: Likewise. * nis/nis_mkdir.c: Likewise. * nis/nis_modify.c: Likewise. * nis/nis_ping.c: Likewise. * nis/nis_remove.c: Likewise. * nis/nis_rmdir.c: Likewise. * nis/nis_server.c: Likewise. * nis/nis_util.c: Likewise. * nis/rpcsvc/nis.h: Make C++ safe. * nis/nss_nisplus/nisplus-publickey.c (getsecretkey): Fix use of variables. * nis/nis_findserv.c: Make thread safe. * nis/nis_call.c: Add support for callback, Fix use of variables. * nis/nis_table.c: Add support for callback, FOLLOW_PATH and ALL_RESULTS. * nis/nis_callback.c: New, callback functions. * nis/nis_intern.h: Add callback declarations. 1997-09-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * string/bits/string2.h: Fix logic in preprocessor directive. (__strsep_1c, __strsep_g): Don't declare __retval as pointing to const, to save a cast and a possible warning. 1997-09-22 04:12 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/i486/atomicity.h (exchange_and_add): Really address memory in xadd not %1. 1997-09-21 13:56 Ulrich Drepper <drepper@cygnus.com> * manual/maint.texi (Supported Configurations): Add SPARC64 to list of supported platforms.
Diffstat (limited to 'sysdeps')
25 files changed, 1732 insertions, 103 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index f9913cf00c..041643ef5a 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -121,6 +121,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) and then redirect to the address it returns. */ #ifndef PROF # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ + .text .globl _dl_runtime_resolve .type _dl_runtime_resolve, @function .align 16 @@ -153,9 +154,11 @@ _dl_runtime_profile: xchgl %eax, (%esp) # Get %eax contents end store function address. ret $8 # Jump to function address. .size _dl_runtime_profile, .-_dl_runtime_profile + .previous "); #else # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ + .text .globl _dl_runtime_resolve .globl _dl_runtime_profile .type _dl_runtime_resolve, @function @@ -179,6 +182,7 @@ _dl_runtime_profile: ret $8 # Jump to function address. .size _dl_runtime_resolve, .-_dl_runtime_resolve .size _dl_runtime_profile, .-_dl_runtime_profile + .previous "); #endif /* The PLT uses Elf32_Rel relocs. */ diff --git a/sysdeps/i386/i486/atomicity.h b/sysdeps/i386/i486/atomicity.h index 7157bc33d8..da4137abe1 100644 --- a/sysdeps/i386/i486/atomicity.h +++ b/sysdeps/i386/i486/atomicity.h @@ -28,7 +28,7 @@ __attribute__ ((unused)) exchange_and_add (volatile uint32_t *mem, int val) { register int result; - __asm__ __volatile__ ("lock; xaddl %0,%1" + __asm__ __volatile__ ("lock; xaddl %0,%2" : "=r" (result) : "0" (val), "m" (*mem) : "memory"); return result; } diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index 10915ced1d..28ca38315e 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -344,7 +344,7 @@ memchr (__const void *__s, int __c, size_t __n) #define _HAVE_STRING_ARCH_strlen 1 #define strlen(str) \ (__extension__ (__builtin_constant_p (str) \ - ? sizeof (str) - 1 \ + ? __builtin_strlen (str) \ : __strlen_g (str))) __STRING_INLINE size_t __strlen_g (__const char *__str) @@ -374,52 +374,51 @@ __strlen_g (__const char *__str) : __strcpy_g (dest, src))) # define __strcpy_small(dest, src, srclen) \ - (__extension__ ({ char *__retval = (dest); \ - char *__cp = __retval; \ + (__extension__ ({ unsigned char *__dest = (unsigned char *) (dest); \ switch (srclen) \ { \ case 1: \ - *((unsigned char *) __cp) = '\0'; \ + *__dest = '\0'; \ break; \ case 2: \ - *((__uint16_t *) __cp) = \ + *((__uint16_t *) __dest) = \ __STRING_SMALL_GET16 (src, 0); \ break; \ case 3: \ - *((__uint16_t *) __cp)++ = \ + *((__uint16_t *) __dest) = \ __STRING_SMALL_GET16 (src, 0); \ - *((unsigned char *) __cp) = '\0'; \ + *(__dest + 2) = '\0'; \ break; \ case 4: \ - *((__uint32_t *) __cp) = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ break; \ case 5: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((unsigned char *) __cp) = '\0'; \ + *(__dest + 4) = '\0'; \ break; \ case 6: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint16_t *) __cp) = \ + *((__uint16_t *) (__dest + 4)) = \ __STRING_SMALL_GET16 (src, 4); \ break; \ case 7: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint16_t *) __cp)++ = \ + *((__uint16_t *) (__dest + 4)) = \ __STRING_SMALL_GET16 (src, 4); \ - *((unsigned char *) __cp) = '\0'; \ + *(__dest + 6) = '\0'; \ break; \ case 8: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint32_t *) __cp) = \ + *((__uint32_t *) (__dest + 4)) = \ __STRING_SMALL_GET32 (src, 4); \ break; \ } \ - __retval; })) + (char *) __dest; })) __STRING_INLINE char * __strcpy_g (char *__dest, __const char *__src) @@ -453,64 +452,65 @@ __strcpy_g (char *__dest, __const char *__src) : __stpcpy_g (dest, src))) # define __stpcpy_c(dest, src, srclen) \ ((srclen) % 4 == 0 \ - ? __mempcpy_by4 (dest, src, srclen) \ + ? __mempcpy_by4 (dest, src, srclen) - 1 \ : ((srclen) % 2 == 0 \ - ? __mempcpy_by2 (dest, src, srclen) \ - : __mempcpy_byn (dest, src, srclen))) + ? __mempcpy_by2 (dest, src, srclen) - 1 \ + : __mempcpy_byn (dest, src, srclen) - 1)) /* In glibc itself we use this symbol for namespace reasons. */ # define stpcpy(dest, src) __stpcpy (dest, src) # define __stpcpy_small(dest, src, srclen) \ - (__extension__ ({ char *__cp = (dest); \ + (__extension__ ({ unsigned char *__dest = (unsigned char *) (dest); \ switch (srclen) \ { \ case 1: \ - *((unsigned char *) __cp) = '\0'; \ + *__dest = '\0'; \ break; \ case 2: \ - *((__uint16_t *) __cp) = \ + *((__uint16_t *) __dest) = \ __STRING_SMALL_GET16 (src, 0); \ - ++__cp; \ + ++__dest; \ break; \ case 3: \ - *((__uint16_t *) __cp)++ = \ + *((__uint16_t *) __dest)++ = \ __STRING_SMALL_GET16 (src, 0); \ - *((unsigned char *) __cp) = '\0'; \ + *__dest = '\0'; \ break; \ case 4: \ - *((__uint32_t *) __cp) = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - __cp += 3; \ + __dest += 3; \ break; \ case 5: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest)++ = \ __STRING_SMALL_GET32 (src, 0); \ - *((unsigned char *) __cp) = '\0'; \ + *__dest = '\0'; \ break; \ case 6: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint16_t *) __cp) = \ + *((__uint16_t *) (__dest + 4)) = \ __STRING_SMALL_GET16 (src, 4); \ - ++__cp; \ + __dest += 5; \ break; \ case 7: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint16_t *) __cp)++ = \ + *((__uint16_t *) (__dest + 4)) = \ __STRING_SMALL_GET16 (src, 4); \ - *((unsigned char *) __cp) = '\0'; \ + __dest += 6; \ + *__dest = '\0'; \ break; \ case 8: \ - *((__uint32_t *) __cp)++ = \ + *((__uint32_t *) __dest) = \ __STRING_SMALL_GET32 (src, 0); \ - *((__uint32_t *) __cp) = \ + *((__uint32_t *) (__dest + 4)) = \ __STRING_SMALL_GET32 (src, 4); \ - __cp += 3; \ + __dest += 7; \ break; \ } \ - __cp; })) + (char *) __dest; })) __STRING_INLINE char * __mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen) @@ -528,7 +528,7 @@ __mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen) : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2) : "1" (__tmp), "2" (__src), "3" (__srclen / 4) : "memory", "cc"); - return __tmp - 1; + return __tmp; } __STRING_INLINE char * @@ -552,7 +552,7 @@ __mempcpy_by2 (char *__dest, __const char *__src, size_t __srclen) : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2) : "1" (__tmp), "2" (__src), "3" (__srclen / 2) : "memory", "cc"); - return __tmp + 1; + return __tmp + 2; } __STRING_INLINE char * @@ -573,7 +573,7 @@ __mempcpy_byn (char *__dest, __const char *__src, size_t __srclen) : "=D" (__tmp) : "c" (__srclen), "0" (__tmp),"S" (__src) : "cx", "di", "si", "memory", "cc"); - return __tmp - 1; + return __tmp; } __STRING_INLINE char * @@ -760,11 +760,12 @@ __strcat_g (char *__dest, __const char *__src) /* Append no more than N characters from SRC onto DEST. */ #define _HAVE_STRING_ARCH_strncat 1 #define strncat(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) < ((size_t) (n)) \ - ? strcat (dest, src) \ - : (memcpy (strchr (dest, '\0'), src, n), dest)) \ - : __strncat_g (dest, src, n))) + (__extension__ ({ char *__dest = (dest); \ + __builtin_constant_p (src) && __builtin_constant_p (n) \ + ? (strlen (src) < ((size_t) (n)) \ + ? strcat (__dest, src) \ + : (memcpy (strchr (__dest, '\0'), src, n), __dest)) \ + : __strncat_g (__dest, src, n); })) __STRING_INLINE char * __strncat_g (char *__dest, __const char __src[], size_t __n) @@ -797,8 +798,52 @@ __strncat_g (char *__dest, __const char __src[], size_t __n) /* Compare S1 and S2. */ #define _HAVE_STRING_ARCH_strcmp 1 +#define strcmp(s1, s2) \ + (__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ + && (sizeof (s1)[0] != 1 || strlen (s1) >= 4) \ + && (sizeof (s2)[0] != 1 || strlen (s2) >= 4) \ + ? memcmp (s1, s2, (strlen (s1) < strlen (s2) \ + ? strlen (s1) : strlen (s2)) + 1) \ + : (__builtin_constant_p (s1) && sizeof (s1)[0] == 1 \ + && sizeof (s2)[0] == 1 && strlen (s1) < 4 \ + ? __strcmp_cg (s1, s2, strlen (s1)) \ + : (__builtin_constant_p (s2) && sizeof (s1)[0] == 1 \ + && sizeof (s2)[0] == 1 && strlen (s2) < 4 \ + ? __strcmp_gc (s1, s2, strlen (s2)) \ + : __strcmp_gg (s1, s2))))) + +#define __strcmp_cg(s1, s2, l1) \ + (__extension__ ({ __const unsigned char *__s2 = (unsigned char *) (s2); \ + register int __result = (unsigned char) (s1)[0] - __s2[0];\ + if (l1 > 0 && __result == 0) \ + { \ + __result = (unsigned char) (s1)[1] - __s2[1]; \ + if (l1 > 1 && __result == 0) \ + { \ + __result = (unsigned char) (s1)[2] - __s2[2]; \ + if (l1 > 2 && __result == 0) \ + __result = (unsigned char) (s1)[3] - __s2[3]; \ + } \ + } \ + __result; })) + +#define __strcmp_gc(s1, s2, l2) \ + (__extension__ ({ __const unsigned char *__s1 = (unsigned char *) (s1); \ + register int __result = __s1[0] - (unsigned char) (s2)[0];\ + if (l2 > 0 && __result == 0) \ + { \ + __result = __s1[1] - (unsigned char) (s2)[1]; \ + if (l2 > 1 && __result == 0) \ + { \ + __result = __s1[2] - (unsigned char) (s2)[2]; \ + if (l2 > 2 && __result == 0) \ + __result = __s1[3] - (unsigned char) (s2)[3]; \ + } \ + } \ + __result; })) + __STRING_INLINE int -strcmp (__const char *__s1, __const char *__s2) +__strcmp_gg (__const char *__s1, __const char *__s2) { register int __res; __asm__ __volatile__ diff --git a/sysdeps/libm-i387/s_exp2.S b/sysdeps/libm-i387/s_exp2.S index 1afacf58cd..778c0c0eb6 100644 --- a/sysdeps/libm-i387/s_exp2.S +++ b/sysdeps/libm-i387/s_exp2.S @@ -6,7 +6,7 @@ #include <machine/asm.h> -ENTRY(__exp2) +ENTRY(__ieee754_exp2) fldl 4(%esp) /* I added the following ugly construct because exp(+-Inf) resulted in NaN. The ugliness results from the bright minds at Intel. @@ -34,5 +34,4 @@ ENTRY(__exp2) fstp %st fldz /* Set result to 0. */ 2: ret -END (__exp2) -weak_alias (__exp2, exp2) +END (__ieee754_exp2) diff --git a/sysdeps/libm-i387/s_exp2f.S b/sysdeps/libm-i387/s_exp2f.S index 896583bf83..c2d1af1af1 100644 --- a/sysdeps/libm-i387/s_exp2f.S +++ b/sysdeps/libm-i387/s_exp2f.S @@ -6,7 +6,7 @@ #include <machine/asm.h> -ENTRY(__exp2f) +ENTRY(__ieee754_exp2f) flds 4(%esp) /* I added the following ugly construct because exp(+-Inf) resulted in NaN. The ugliness results from the bright minds at Intel. @@ -34,5 +34,4 @@ ENTRY(__exp2f) fstp %st fldz /* Set result to 0. */ 2: ret -END (__exp2f) -weak_alias (__exp2f, exp2f) +END (__ieee754_exp2f) diff --git a/sysdeps/libm-i387/s_exp2l.S b/sysdeps/libm-i387/s_exp2l.S index 4b543d06f8..fa1fdc9236 100644 --- a/sysdeps/libm-i387/s_exp2l.S +++ b/sysdeps/libm-i387/s_exp2l.S @@ -6,7 +6,7 @@ #include <machine/asm.h> -ENTRY(__exp2l) +ENTRY(__ieee754_exp2l) fldt 4(%esp) /* I added the following ugly construct because exp(+-Inf) resulted in NaN. The ugliness results from the bright minds at Intel. @@ -34,5 +34,4 @@ ENTRY(__exp2l) fstp %st fldz /* Set result to 0. */ 2: ret -END (__exp2l) -weak_alias (__exp2l, exp2l) +END (__ieee754_exp2l) diff --git a/sysdeps/libm-ieee754/Dist b/sysdeps/libm-ieee754/Dist new file mode 100644 index 0000000000..4b085470f5 --- /dev/null +++ b/sysdeps/libm-ieee754/Dist @@ -0,0 +1,2 @@ +t_exp2.h +t_exp2f.h diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c index 391ab057ca..6c410c4c1a 100644 --- a/sysdeps/libm-ieee754/k_standard.c +++ b/sysdeps/libm-ieee754/k_standard.c @@ -80,6 +80,9 @@ static double zero = 0.0; /* used as const */ * 40-- gamma(finite) overflow * 41-- gamma(-integer) * 42-- pow(NaN,0.0) + * 43-- +0**neg + * 44-- exp2 overflow + * 45-- exp2 underflow */ @@ -865,7 +868,38 @@ static double zero = 0.0; /* used as const */ } break; - /* #### Last used is 43/143/243 ### */ + case 44: + case 144: + case 244: + /* exp(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "exp2" : (type < 200 + ? "exp2f" : "exp2l"); + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 45: + case 145: + case 245: + /* exp(finite) underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "exp2" : (type < 200 + ? "exp2f" : "exp2l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + /* #### Last used is 44/144/244 ### */ } return exc.retval; } diff --git a/sysdeps/libm-ieee754/s_exp2.c b/sysdeps/libm-ieee754/s_exp2.c new file mode 100644 index 0000000000..e10fae5492 --- /dev/null +++ b/sysdeps/libm-ieee754/s_exp2.c @@ -0,0 +1,128 @@ +/* Double-precision floating point 2^x. + Copyright (C) 1997 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. */ + +/* 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. + It has been slightly modified to compute 2^x instead of e^x. + */ +#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 "t_exp2.h" + +static const volatile double TWO1000 = 1.071508607186267320948e+301; +static const volatile double TWOM1000 = 9.3326361850321887899e-302; + +double +__ieee754_exp2 (double x) +{ + static const uint32_t a_inf = 0x7f800000; + /* Check for usual case. */ + if (isless (x, (double) DBL_MAX_EXP) + && isgreater (x, (double) (DBL_MIN_EXP - 1))) + { + static const float TWO43 = 8796093022208.0; + int tval; + double rx, x22; + union ieee754_double ex2_u; + fenv_t oldenv; + + feholdexcept (&oldenv); + fesetround (FE_TONEAREST); + + /* 1. Argument reduction. + Choose integers ex, -256 <= t < 256, and some real + -1/1024 <= x1 <= 1024 so that + x = ex + t/512 + x1. + + First, calculate rx = ex + t/512. */ + if (x >= 0) + { + rx = x + TWO43; + rx -= TWO43; + } + else + { + rx = x - TWO43; + rx += TWO43; + } + x -= rx; /* Compute x=x1. */ + /* Compute tval = (ex*512 + t)+256. + Now, t = (tval mod 512)-256 and ex=tval/512 [that's mod, NOT %; and + /-round-to-nearest not the usual c integer /]. */ + tval = (int) (rx * 512.0 + 256.0); + + /* 2. Adjust for accurate table entry. + Find e so that + x = ex + t/512 + e + x2 + where -1e6 < e < 1e6, and + (double)(2^(t/512+e)) + is accurate to one part in 2^-64. */ + + /* 'tval & 511' is the same as 'tval%512' except that it's always + positive. + Compute x = x2. */ + x -= exp2_deltatable[tval & 511]; + + /* 3. Compute ex2 = 2^(t/512+e+ex). */ + ex2_u.d = exp2_accuratetable[tval & 511]; + ex2_u.ieee.exponent += tval >> 9; + + /* 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. */ + + x22 = (((.0096181291076284772 + * x + .055504108664821580) + * x + .240226506959100712) + * x + .69314718055994531) * 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; + } + /* 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; +} diff --git a/sysdeps/libm-ieee754/s_exp2f.c b/sysdeps/libm-ieee754/s_exp2f.c new file mode 100644 index 0000000000..e50ac77792 --- /dev/null +++ b/sysdeps/libm-ieee754/s_exp2f.c @@ -0,0 +1,126 @@ +/* Single-precision floating point 2^x. + Copyright (C) 1997 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. */ + +/* 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. + It has been slightly modified to compute 2^x instead of e^x, and for + single-precision. + */ +#define _GNU_SOURCE +#include <float.h> +#include <ieee754.h> +#include <math.h> +#include <fenv.h> +#include <inttypes.h> +#include <math_private.h> + +#include "t_exp2f.h" + +static const volatile float TWOM100 = 7.88860905e-31; +static const volatile float huge = 1e+30; + +float +__ieee754_exp2f (float x) +{ + static const uint32_t a_inf = 0x7f800000; + /* Check for usual case. */ + if (isless (x, (float) FLT_MAX_EXP) + && isgreater (x, (float) (FLT_MIN_EXP - 1))) + { + static const float TWO16 = 65536.0; + int tval; + float rx, x22; + union ieee754_float ex2_u; + fenv_t oldenv; + + feholdexcept (&oldenv); + fesetround (FE_TONEAREST); + + /* 1. Argument reduction. + Choose integers ex, -128 <= t < 128, and some real + -1/512 <= x1 <= 1/512 so that + x = ex + t/512 + x1. + + First, calculate rx = ex + t/256. */ + if (x >= 0) + { + rx = x + TWO16; + rx -= TWO16; + } + else + { + rx = x - TWO16; + rx += TWO16; + } + x -= rx; /* Compute x=x1. */ + /* Compute tval = (ex*256 + t)+128. + Now, t = (tval mod 256)-128 and ex=tval/256 [that's mod, NOT %; and + /-round-to-nearest not the usual c integer /]. */ + tval = (int) (rx * 256.0f + 128.0f); + + /* 2. Adjust for accurate table entry. + Find e so that + x = ex + t/256 + e + x2 + where -7e-4 < e < 7e-4, and + (float)(2^(t/256+e)) + is accurate to one part in 2^-64. */ + + /* 'tval & 255' is the same as 'tval%256' except that it's always + positive. + Compute x = x2. */ + 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; + + /* 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. */ + + x22 = (.240226507f * x + .6931471806f) * 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; + } + /* 2^inf == inf, with no error. */ + else if (x == *(const float *)&a_inf) + { + return x; + } + /* 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_DIF))) + 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; +} diff --git a/sysdeps/libm-ieee754/t_exp2.h b/sysdeps/libm-ieee754/t_exp2.h new file mode 100644 index 0000000000..1fd73338cf --- /dev/null +++ b/sysdeps/libm-ieee754/t_exp2.h @@ -0,0 +1,585 @@ +/* These values are accurate to 52+12 bits when represented as + a double. */ +static const double exp2_accuratetable[512] = { +0.707106781187802013759 /* 0x0.b504f333fb3f80007 */, +0.708064712808760599040 /* 0x0.b543baa0f71b38000 */, +0.709023942160304065938 /* 0x0.b58297d3a8d518002 */, +0.709984470998547667624 /* 0x0.b5c18ad39b4ba0001 */, +0.710946301084324217006 /* 0x0.b60093a85e8d30001 */, +0.711909434180505784637 /* 0x0.b63fb25984e628005 */, +0.712873872052760648733 /* 0x0.b67ee6eea3b5f8003 */, +0.713839616467838999908 /* 0x0.b6be316f518c98001 */, +0.714806669195984345523 /* 0x0.b6fd91e328d148007 */, +0.715775032009894562898 /* 0x0.b73d0851c69e20002 */, +0.716744706683768884058 /* 0x0.b77c94c2c9b3d0003 */, +0.717715694995770148178 /* 0x0.b7bc373dd52eb0003 */, +0.718687998724665488852 /* 0x0.b7fbefca8cd530004 */, +0.719661619652575468291 /* 0x0.b83bbe70981da8001 */, +0.720636559564428180758 /* 0x0.b87ba337a194b0006 */, +0.721612820246623098989 /* 0x0.b8bb9e27556508004 */, +0.722590403488338473025 /* 0x0.b8fbaf4762c798006 */, +0.723569311081411870036 /* 0x0.b93bd69f7be1d0000 */, +0.724549544820974333906 /* 0x0.b97c1437567828007 */, +0.725531106502312561633 /* 0x0.b9bc6816a87ae8002 */, +0.726513997924421062181 /* 0x0.b9fcd2452bee00000 */, +0.727498220889519875430 /* 0x0.ba3d52ca9e6148002 */, +0.728483777200401694265 /* 0x0.ba7de9aebe05c8003 */, +0.729470668664712662563 /* 0x0.babe96f94e62a8002 */, +0.730458897090379144517 /* 0x0.baff5ab2134df0004 */, +0.731448464287988597833 /* 0x0.bb4034e0d38ab0000 */, +0.732439372072965166897 /* 0x0.bb81258d5b2d60001 */, +0.733431622260458326859 /* 0x0.bbc22cbf75fd28001 */, +0.734425216668725511232 /* 0x0.bc034a7ef32c00001 */, +0.735420157118880535324 /* 0x0.bc447ed3a50fe0005 */, +0.736416445434497690674 /* 0x0.bc85c9c560b350001 */, +0.737414083433310718618 /* 0x0.bcc72b5bf4b4e0000 */, +0.738413072966152328496 /* 0x0.bd08a39f5417a8007 */, +0.739413415848264365956 /* 0x0.bd4a32974abcd0002 */, +0.740415113911250699637 /* 0x0.bd8bd84bb68300002 */, +0.741418168994518067562 /* 0x0.bdcd94c47ddd30003 */, +0.742422582936659858376 /* 0x0.be0f6809865968006 */, +0.743428357577745613238 /* 0x0.be515222b72530003 */, +0.744435494762383687126 /* 0x0.be935317fc6ba0002 */, +0.745443996335090397492 /* 0x0.bed56af1423de8001 */, +0.746453864145572798553 /* 0x0.bf1799b67a6248007 */, +0.747465100043933849969 /* 0x0.bf59df6f970e70002 */, +0.748477705883256683178 /* 0x0.bf9c3c248dbee8001 */, +0.749491683518965001732 /* 0x0.bfdeafdd568308000 */, +0.750507034813367890373 /* 0x0.c0213aa1f0fc38004 */, +0.751523761622240105153 /* 0x0.c063dc7a559ca0003 */, +0.752541865811731880422 /* 0x0.c0a6956e883ed8000 */, +0.753561349247157341600 /* 0x0.c0e965868bd220006 */, +0.754582213796583967110 /* 0x0.c12c4cca664cb8002 */, +0.755604461332336940791 /* 0x0.c16f4b42225350006 */, +0.756628093726406381068 /* 0x0.c1b260f5ca2c48002 */, +0.757653112855631305506 /* 0x0.c1f58ded6d72d8001 */, +0.758679520599333412360 /* 0x0.c238d2311e7d08001 */, +0.759707318837184453227 /* 0x0.c27c2dc8f00368005 */, +0.760736509456435783249 /* 0x0.c2bfa0bcfd1400000 */, +0.761767094336480043995 /* 0x0.c3032b155818d0000 */, +0.762799075372231349951 /* 0x0.c346ccda248cc0001 */, +0.763832454453522768941 /* 0x0.c38a8613805488005 */, +0.764867233473625618441 /* 0x0.c3ce56c98d1ca8005 */, +0.765903414329434539816 /* 0x0.c4123f04708d80002 */, +0.766940998920452976510 /* 0x0.c4563ecc532dc0001 */, +0.767979989148100838946 /* 0x0.c49a56295f9f88006 */, +0.769020386915772125040 /* 0x0.c4de8523c2b0a0001 */, +0.770062194131770905170 /* 0x0.c522cbc3ae94e0003 */, +0.771105412703856241146 /* 0x0.c5672a1154e6b8004 */, +0.772150044545352520777 /* 0x0.c5aba014ed5f18003 */, +0.773196091570364285606 /* 0x0.c5f02dd6b09288003 */, +0.774243555696622731700 /* 0x0.c634d35edb1260003 */, +0.775292438842697939641 /* 0x0.c67990b5aa5c18004 */, +0.776342742931542928455 /* 0x0.c6be65e360bed8000 */, +0.777394469888802008854 /* 0x0.c70352f0437f50004 */, +0.778447621641124243320 /* 0x0.c74857e498fd00006 */, +0.779502200118583399303 /* 0x0.c78d74c8ab5b60000 */, +0.780558207255445668515 /* 0x0.c7d2a9a4c959f8000 */, +0.781615644985491186966 /* 0x0.c817f681412f80002 */, +0.782674515247667956808 /* 0x0.c85d5b6666c150006 */, +0.783734819983036512536 /* 0x0.c8a2d85c904760003 */, +0.784796561133562109454 /* 0x0.c8e86d6c14f850002 */, +0.785859740645942328471 /* 0x0.c92e1a9d513ec8002 */, +0.786924360469767103536 /* 0x0.c973dff8a4b390007 */, +0.787990422552312885808 /* 0x0.c9b9bd866c6440007 */, +0.789057928854407064640 /* 0x0.c9ffb34f1444b0001 */, +0.790126881326406182996 /* 0x0.ca45c15afcc570001 */, +0.791197281930050233534 /* 0x0.ca8be7b292db38000 */, +0.792269132620954885659 /* 0x0.cad2265e3cbee8000 */, +0.793342435380726906957 /* 0x0.cb187d667d3d38006 */, +0.794417192158282659010 /* 0x0.cb5eecd3b33158006 */, +0.795493404931386649540 /* 0x0.cba574ae5d2e80001 */, +0.796571075671306805268 /* 0x0.cbec14fef2a348004 */, +0.797650206352955137846 /* 0x0.cc32cdcdef0000000 */, +0.798730798954342069432 /* 0x0.cc799f23d11d18000 */, +0.799812855456121796232 /* 0x0.ccc089091abb28004 */, +0.800896377841454287795 /* 0x0.cd078b86505c18003 */, +0.801981368096190028208 /* 0x0.cd4ea6a3f97720007 */, +0.803067828208752554378 /* 0x0.cd95da6aa057b8007 */, +0.804155760170129796375 /* 0x0.cddd26e2d21b28001 */, +0.805245165974338261710 /* 0x0.ce248c151f3330001 */, +0.806336047619038653883 /* 0x0.ce6c0a0a1c1350001 */, +0.807428407102107836855 /* 0x0.ceb3a0ca5d6be0006 */, +0.808522246427078927792 /* 0x0.cefb505e7e2550007 */, +0.809617567597010201484 /* 0x0.cf4318cf18a268002 */, +0.810714372621179513182 /* 0x0.cf8afa24ce1c98004 */, +0.811812663508675536069 /* 0x0.cfd2f4683f9810005 */, +0.812912442272482604912 /* 0x0.d01b07a2126188003 */, +0.814013710929394895825 /* 0x0.d06333daeff618001 */, +0.815116471495287542325 /* 0x0.d0ab791b80d028006 */, +0.816220725993571205593 /* 0x0.d0f3d76c75b330000 */, +0.817326476447408967199 /* 0x0.d13c4ed67f1cf8000 */, +0.818433724883006474832 /* 0x0.d184df6250e3b0001 */, +0.819542473330909460055 /* 0x0.d1cd8918a3a328004 */, +0.820652723822034690935 /* 0x0.d2164c02305fa0002 */, +0.821764478391968422618 /* 0x0.d25f2827b53fb0005 */, +0.822877739077315761840 /* 0x0.d2a81d91f188b8000 */, +0.823992507918612782109 /* 0x0.d2f12c49a8d290005 */, +0.825108786960634610365 /* 0x0.d33a5457a35e40003 */, +0.826226578247117093869 /* 0x0.d38395c4a84848007 */, +0.827345883828319528258 /* 0x0.d3ccf09985d958004 */, +0.828466705754248966560 /* 0x0.d41664df0a1320005 */, +0.829589046080638992111 /* 0x0.d45ff29e094330000 */, +0.830712906863802391671 /* 0x0.d4a999df585a20005 */, +0.831838290163696481037 /* 0x0.d4f35aabd04a60006 */, +0.832965198041969556729 /* 0x0.d53d350c4be258002 */, +0.834093632565442222342 /* 0x0.d5872909aba050007 */, +0.835223595802037643865 /* 0x0.d5d136acd138e8006 */, +0.836355089820669306292 /* 0x0.d61b5dfe9f7780004 */, +0.837488116698010487424 /* 0x0.d6659f0801afa8005 */, +0.838622678508982644113 /* 0x0.d6aff9d1e147d8004 */, +0.839758777333464490056 /* 0x0.d6fa6e652d19e0000 */, +0.840896415254110962690 /* 0x0.d744fccad70d00003 */, +0.842035594355151628676 /* 0x0.d78fa50bd2c3b0000 */, +0.843176316724478125433 /* 0x0.d7da673117e730007 */, +0.844318584453106590905 /* 0x0.d8254343a19038003 */, +0.845462399634695271912 /* 0x0.d870394c6dbf30003 */, +0.846607764365415071965 /* 0x0.d8bb49547d37c0004 */, +0.847754680744707056494 /* 0x0.d9067364d45608003 */, +0.848903150873708822763 /* 0x0.d951b7867953b0006 */, +0.850053176859071113491 /* 0x0.d99d15c2787a30006 */, +0.851204760807439786431 /* 0x0.d9e88e21de11a0003 */, +0.852357904828824897169 /* 0x0.da3420adba1508003 */, +0.853512611037803181642 /* 0x0.da7fcd6f2184d8005 */, +0.854668881550406100980 /* 0x0.dacb946f2afaf8000 */, +0.855826718478671755185 /* 0x0.db1775b6e8ad48000 */, +0.856986123964844970247 /* 0x0.db63714f8e0818006 */, +0.858147100114499461478 /* 0x0.dbaf87422625b8000 */, +0.859309649060962410524 /* 0x0.dbfbb797daa460002 */, +0.860473772936213743282 /* 0x0.dc480259d3a710001 */, +0.861639473872910177676 /* 0x0.dc9467913a0f48006 */, +0.862806754008130227807 /* 0x0.dce0e7473b9b28003 */, +0.863975615481124226159 /* 0x0.dd2d8185086c20006 */, +0.865146060433749419813 /* 0x0.dd7a3653d38168005 */, +0.866318091005120138881 /* 0x0.ddc705bcccd628000 */, +0.867491709362415264210 /* 0x0.de13efc9434100004 */, +0.868666917636779056818 /* 0x0.de60f4825df9b8005 */, +0.869843717989716047624 /* 0x0.deae13f16599c0003 */, +0.871022112578215268471 /* 0x0.defb4e1f9dc388002 */, +0.872202103559697183859 /* 0x0.df48a3164a92f0001 */, +0.873383693097737778847 /* 0x0.df9612deb6e878007 */, +0.874566883362160263365 /* 0x0.dfe39d82348310001 */, +0.875751676517234511901 /* 0x0.e031430a0f0688000 */, +0.876938074732511840819 /* 0x0.e07f037f97e548001 */, +0.878126080186539592654 /* 0x0.e0ccdeec2a75e0006 */, +0.879315695055312818168 /* 0x0.e11ad5591f4078001 */, +0.880506921518618312932 /* 0x0.e168e6cfd2f880004 */, +0.881699761760385225541 /* 0x0.e1b71359a6df60003 */, +0.882894217964411143207 /* 0x0.e2055afffc1178000 */, +0.884090292325693805080 /* 0x0.e253bdcc3ffbb8001 */, +0.885287987031581180559 /* 0x0.e2a23bc7d7a1d8002 */, +0.886487304278189114386 /* 0x0.e2f0d4fc31ab80004 */, +0.887688246263368285778 /* 0x0.e33f8972bea8a8005 */, +0.888890815189881999840 /* 0x0.e38e5934f49010007 */, +0.890095013257492739835 /* 0x0.e3dd444c460bd0007 */, +0.891300842677948068626 /* 0x0.e42c4ac232f380000 */, +0.892508305659222567226 /* 0x0.e47b6ca036f8b8005 */, +0.893717404414979710310 /* 0x0.e4caa9efd40e58002 */, +0.894928141160697743242 /* 0x0.e51a02ba8e2610007 */, +0.896140518115016826430 /* 0x0.e5697709ecab90000 */, +0.897354537501434679237 /* 0x0.e5b906e77c61d0006 */, +0.898570201543732793877 /* 0x0.e608b25cca5ba8005 */, +0.899787512470129891014 /* 0x0.e6587973688ce8002 */, +0.901006472512270728537 /* 0x0.e6a85c34ecadb8000 */, +0.902227083902570559127 /* 0x0.e6f85aaaed4f20006 */, +0.903449348881299796343 /* 0x0.e74874df09a530003 */, +0.904673269686823378091 /* 0x0.e798aadadecba0007 */, +0.905898848559668845585 /* 0x0.e7e8fca80c3ee0001 */, +0.907126087750156795426 /* 0x0.e8396a503c3fe0005 */, +0.908354989505901100354 /* 0x0.e889f3dd1615b0002 */, +0.909585556079328783087 /* 0x0.e8da9958465228007 */, +0.910817789726044213523 /* 0x0.e92b5acb7d0578001 */, +0.912051692703457872481 /* 0x0.e97c38406c3c30003 */, +0.913287267274154990210 /* 0x0.e9cd31c0cbb370001 */, +0.914524515702244578108 /* 0x0.ea1e475654d540000 */, +0.915763440256158633982 /* 0x0.ea6f790ac5cc78001 */, +0.917004043205012497909 /* 0x0.eac0c6e7dd8448007 */, +0.918246326823137892807 /* 0x0.eb1230f760a428007 */, +0.919490293387826285200 /* 0x0.eb63b7431714a8007 */, +0.920735945178816406225 /* 0x0.ebb559d4cb6f30007 */, +0.921983284479243714322 /* 0x0.ec0718b64c0940002 */, +0.923232313574974705626 /* 0x0.ec58f3f16a3910002 */, +0.924483034755387955725 /* 0x0.ecaaeb8ffb3168005 */, +0.925735450311948926408 /* 0x0.ecfcff9bd67078000 */, +0.926989562542820610982 /* 0x0.ed4f301edad1a0007 */, +0.928245373740515189457 /* 0x0.eda17d22e0f9b0001 */, +0.929502886213858126045 /* 0x0.edf3e6b1d37d40001 */, +0.930762102264245716494 /* 0x0.ee466cd594c5c8005 */, +0.932023024199046146183 /* 0x0.ee990f980dcdb0005 */, +0.933285654329454095216 /* 0x0.eeebcf032bc470007 */, +0.934549994971191289044 /* 0x0.ef3eab20e0d3c0001 */, +0.935816048439005676599 /* 0x0.ef91a3fb1e1340004 */, +0.937083817055075818404 /* 0x0.efe4b99bdcc618006 */, +0.938353303143720007819 /* 0x0.f037ec0d1889b8000 */, +0.939624509028518128972 /* 0x0.f08b3b58cc2bb8006 */, +0.940897437041863904384 /* 0x0.f0dea788fc2a90000 */, +0.942172089516254085427 /* 0x0.f13230a7ad21b8003 */, +0.943448468787511540534 /* 0x0.f185d6bee754e0006 */, +0.944726577195256100890 /* 0x0.f1d999d8b73478005 */, +0.946006417082291717338 /* 0x0.f22d79ff2cb130000 */, +0.947287990793413858827 /* 0x0.f281773c59ec48007 */, +0.948571300678290207925 /* 0x0.f2d5919a566268001 */, +0.949856349088629370320 /* 0x0.f329c9233bceb0001 */, +0.951143138379053731954 /* 0x0.f37e1de1272068002 */, +0.952431670908847949364 /* 0x0.f3d28fde3a6728006 */, +0.953721949039916472305 /* 0x0.f4271f249a93f0001 */, +0.955013975135367898520 /* 0x0.f47bcbbe6deab0001 */, +0.956307751564417496418 /* 0x0.f4d095b5e16638004 */, +0.957603280698967163097 /* 0x0.f5257d1524f590006 */, +0.958900564911197350604 /* 0x0.f57a81e668d628000 */, +0.960199606581278120057 /* 0x0.f5cfa433e60e50007 */, +0.961500408088936442422 /* 0x0.f624e407d527a0007 */, +0.962802971817578789903 /* 0x0.f67a416c72b760006 */, +0.964107300155846558292 /* 0x0.f6cfbc6c011458004 */, +0.965413395493874504368 /* 0x0.f7255510c439a8002 */, +0.966721260225105960572 /* 0x0.f77b0b6503c5b8006 */, +0.968030896745834645873 /* 0x0.f7d0df730a7940005 */, +0.969342307458006424716 /* 0x0.f826d145294be8003 */, +0.970655494764855020231 /* 0x0.f87ce0e5b29fd8000 */, +0.971970461071268720958 /* 0x0.f8d30e5efaa8f0004 */, +0.973287208789983648852 /* 0x0.f92959bb5e3c08001 */, +0.974605740331924708124 /* 0x0.f97fc305383028004 */, +0.975926058115625383329 /* 0x0.f9d64a46ebb9f8004 */, +0.977248164559556209435 /* 0x0.fa2cef8adbfc68004 */, +0.978572062087848637573 /* 0x0.fa83b2db7253d0007 */, +0.979897753126343307191 /* 0x0.fada944319fda0005 */, +0.981225240104636631254 /* 0x0.fb3193cc425870002 */, +0.982554525455618277276 /* 0x0.fb88b1815e61d0003 */, +0.983885611617111077747 /* 0x0.fbdfed6ce683e0007 */, +0.985218501026348891812 /* 0x0.fc3747995282f8006 */, +0.986553196127724962867 /* 0x0.fc8ec0112202a0005 */, +0.987889699367056062238 /* 0x0.fce656ded63710002 */, +0.989228013193998778636 /* 0x0.fd3e0c0cf48d50005 */, +0.990568140061241164686 /* 0x0.fd95dfa605c7b0003 */, +0.991910082424819927754 /* 0x0.fdedd1b4965710004 */, +0.993253842749249660216 /* 0x0.fe45e2433bfea0000 */, +0.994599423484053835071 /* 0x0.fe9e115c7c05f0005 */, +0.995946827107488830167 /* 0x0.fef65f0afb4c28006 */, +0.997296056085008264529 /* 0x0.ff4ecb59509cc8001 */, +0.998647112892057764479 /* 0x0.ffa756521dbfd0007 */, +1.000000000000000000000 /* 0x1.00000000000000000 */, +1.001354719891689004659 /* 0x1.0058c86da14aa0005 */, +1.002711275050312211844 /* 0x1.00b1afa5abead0003 */, +1.004069667960743483835 /* 0x1.010ab5b2cc0660009 */, +1.005429901112333324093 /* 0x1.0163da9fb2af30008 */, +1.006791976999887428009 /* 0x1.01bd1e7716f6a0008 */, +1.008155898118476168101 /* 0x1.02168143b03890006 */, +1.009521666967782227439 /* 0x1.027003103ae320002 */, +1.010889286051850133326 /* 0x1.02c9a3e7783030002 */, +1.012258757875921233497 /* 0x1.032363d42aaa8000e */, +1.013630084952214405194 /* 0x1.037d42e11c88d0000 */, +1.015003269791313389451 /* 0x1.03d741191635a0001 */, +1.016378314911229763267 /* 0x1.04315e86e84630008 */, +1.017755222831652872635 /* 0x1.048b9b35652800002 */, +1.019133996077934645224 /* 0x1.04e5f72f65827000b */, +1.020514637175266248212 /* 0x1.0540727fc1cfa0006 */, +1.021897148653734488385 /* 0x1.059b0d3157ebb0002 */, +1.023281533050062419584 /* 0x1.05f5c74f0cfeb0002 */, +1.024667792897328677539 /* 0x1.0650a0e3c22ee0003 */, +1.026055930738840826806 /* 0x1.06ab99fa63e1b0008 */, +1.027445949118511947550 /* 0x1.0706b29ddf2700009 */, +1.028837850584049418178 /* 0x1.0761ead9253ab0009 */, +1.030231637685799839262 /* 0x1.07bd42b72a3f80008 */, +1.031627312979383592802 /* 0x1.0818ba42e824a000c */, +1.033024879021186448496 /* 0x1.0874518759b0b0008 */, +1.034424338374263729911 /* 0x1.08d0088f80ffa0006 */, +1.035825693601787333992 /* 0x1.092bdf66604e30005 */, +1.037228947273990842283 /* 0x1.0987d617019cd000a */, +1.038634101961269928846 /* 0x1.09e3ecac6f199000f */, +1.040041160239590700707 /* 0x1.0a402331b91270002 */, +1.041450124688240164200 /* 0x1.0a9c79b1f37c3000b */, +1.042860997889083929381 /* 0x1.0af8f038352160000 */, +1.044273782427270314011 /* 0x1.0b5586cf986890006 */, +1.045688480893644856116 /* 0x1.0bb23d833dfbf0006 */, +1.047105095879385272564 /* 0x1.0c0f145e46e330007 */, +1.048523629981608529302 /* 0x1.0c6c0b6bdaadc000f */, +1.049944085800634585634 /* 0x1.0cc922b72470a000f */, +1.051366465939483019223 /* 0x1.0d265a4b5238b0007 */, +1.052790773004648849929 /* 0x1.0d83b23395e510002 */, +1.054217009607077093512 /* 0x1.0de12a7b263970006 */, +1.055645178360430591625 /* 0x1.0e3ec32d3cf680000 */, +1.057075281882416506511 /* 0x1.0e9c7c55184f5000e */, +1.058507322794714378170 /* 0x1.0efa55fdfad51000a */, +1.059941303721639416236 /* 0x1.0f58503329fed0003 */, +1.061377227289284297385 /* 0x1.0fb66affed37f0000 */, +1.062815096132297298980 /* 0x1.1014a66f95540000c */, +1.064254912884593951029 /* 0x1.1073028d725850007 */, +1.065696680185205469411 /* 0x1.10d17f64d9ea2000b */, +1.067140400676658718053 /* 0x1.11301d012586a0007 */, +1.068586077004890055886 /* 0x1.118edb6db26ab0003 */, +1.070033711820396415998 /* 0x1.11edbab5e2d6e000b */, +1.071483307775789262099 /* 0x1.124cbae51b5ef0001 */, +1.072934867526001312439 /* 0x1.12abdc06c3240000c */, +1.074388393734249103080 /* 0x1.130b1e264a62e0005 */, +1.075843889063253344684 /* 0x1.136a814f20ccd0003 */, +1.077301356179926061823 /* 0x1.13ca058cbaaed000b */, +1.078760797756675327056 /* 0x1.1429aaea9260e000e */, +1.080222216468626150775 /* 0x1.148971742537c0009 */, +1.081685614993597610617 /* 0x1.14e95934f37e8000b */, +1.083150996013011013776 /* 0x1.1549623881762000d */, +1.084618362213087383633 /* 0x1.15a98c8a58a6a000b */, +1.086087716284427351384 /* 0x1.1609d8360768c0008 */, +1.087559060917626885283 /* 0x1.166a45471c13f0008 */, +1.089032398810997337465 /* 0x1.16cad3c92d7b50009 */, +1.090507732647478578212 /* 0x1.172b83c7c18b5000f */, +1.091985065182095926460 /* 0x1.178c554ead72a000c */, +1.093464399073070136880 /* 0x1.17ed48695befe000c */, +1.094945737045367906172 /* 0x1.184e5d23812500007 */, +1.096429081816546080591 /* 0x1.18af9388c90e40005 */, +1.097914436104650892651 /* 0x1.1910eba4e031a0001 */, +1.099401802629782043408 /* 0x1.19726583755720003 */, +1.100891184121537858001 /* 0x1.19d4013041b860007 */, +1.102382583308144647940 /* 0x1.1a35beb6fd0cd0007 */, +1.103876002922312915544 /* 0x1.1a979e2363fa10000 */, +1.105371445702084232160 /* 0x1.1af99f8139025000e */, +1.106868914387219016199 /* 0x1.1b5bc2dc408b9000e */, +1.108368411723785085252 /* 0x1.1bbe084045eb30002 */, +1.109869940458469095340 /* 0x1.1c206fb91524c000e */, +1.111373503344554869449 /* 0x1.1c82f952817cc0001 */, +1.112879103137133007859 /* 0x1.1ce5a51860344000f */, +1.114386742595953938610 /* 0x1.1d4873168babf000e */, +1.115896424484008608911 /* 0x1.1dab6358e1d4a000f */, +1.117408151567338414664 /* 0x1.1e0e75eb43f9c000c */, +1.118921926613465345265 /* 0x1.1e71aad995078000f */, +1.120437752409564780022 /* 0x1.1ed5022fcd8600003 */, +1.121955631720569668277 /* 0x1.1f387bf9cd88b0000 */, +1.123475567332998359439 /* 0x1.1f9c18438cdec000a */, +1.124997562033035469759 /* 0x1.1fffd71902f970002 */, +1.126521618608448571713 /* 0x1.2063b88629079000e */, +1.128047739853580200284 /* 0x1.20c7bc96ff72a0002 */, +1.129575928566289189112 /* 0x1.212be3578a81e0006 */, +1.131106187546149888259 /* 0x1.21902cd3d05f70007 */, +1.132638519598779369743 /* 0x1.21f49917ddda5000c */, +1.134172927531616359481 /* 0x1.2259282fc1c24000e */, +1.135709414157753949251 /* 0x1.22bdda27911e90007 */, +1.137247982292643566662 /* 0x1.2322af0b638e60007 */, +1.138788634756517259562 /* 0x1.2387a6e755f270000 */, +1.140331374372893558110 /* 0x1.23ecc1c788c890006 */, +1.141876203969685699176 /* 0x1.2451ffb821639000c */, +1.143423126377846266197 /* 0x1.24b760c5486dc0009 */, +1.144972144431494420774 /* 0x1.251ce4fb2a0cc0005 */, +1.146523260971646252006 /* 0x1.25828c65f9fb8000d */, +1.148076478839068270690 /* 0x1.25e85711ebaeb0000 */, +1.149631800883562204903 /* 0x1.264e450b3c8a30008 */, +1.151189229953253789786 /* 0x1.26b4565e281a20003 */, +1.152748768902654319399 /* 0x1.271a8b16f0f000002 */, +1.154310420590433317050 /* 0x1.2780e341de2fc0001 */, +1.155874187878668246681 /* 0x1.27e75eeb3abc90007 */, +1.157440073633736243899 /* 0x1.284dfe1f5633e000a */, +1.159008080725518974322 /* 0x1.28b4c0ea840d90001 */, +1.160578212048386514965 /* 0x1.291ba75932ae60000 */, +1.162150470417516290340 /* 0x1.2982b177796850008 */, +1.163724858777502646494 /* 0x1.29e9df51fdd900001 */, +1.165301379991388053320 /* 0x1.2a5130f50bf34000e */, +1.166880036952526289469 /* 0x1.2ab8a66d10fdc0008 */, +1.168460832550151540268 /* 0x1.2b203fc675b7a000a */, +1.170043769683112966389 /* 0x1.2b87fd0dad7260008 */, +1.171628851252754177681 /* 0x1.2befde4f2e3da000d */, +1.173216080163546060084 /* 0x1.2c57e397719940002 */, +1.174805459325657830448 /* 0x1.2cc00cf2f7491000c */, +1.176396991650083379037 /* 0x1.2d285a6e3ff90000b */, +1.177990680055698513602 /* 0x1.2d90cc15d4ff90005 */, +1.179586527463262646306 /* 0x1.2df961f641c57000c */, +1.181184536796979545103 /* 0x1.2e621c1c157cd000d */, +1.182784710984701836994 /* 0x1.2ecafa93e35af0004 */, +1.184387052960675701386 /* 0x1.2f33fd6a459cb0000 */, +1.185991565661414393112 /* 0x1.2f9d24abd8fd1000e */, +1.187598252026902612178 /* 0x1.300670653e083000a */, +1.189207115003001469262 /* 0x1.306fe0a31bc040008 */, +1.190818157535919796833 /* 0x1.30d9757219895000e */, +1.192431382587621380206 /* 0x1.31432edef01a1000f */, +1.194046793097208292195 /* 0x1.31ad0cf63f0630008 */, +1.195664392040319823392 /* 0x1.32170fc4ce0db000c */, +1.197284182375793593084 /* 0x1.32813757527750005 */, +1.198906167074650808198 /* 0x1.32eb83ba8eef3000f */, +1.200530349107333139048 /* 0x1.3355f4fb457e5000d */, +1.202156731453099647353 /* 0x1.33c08b2641df9000c */, +1.203785317090505513368 /* 0x1.342b46484f07b0005 */, +1.205416109005122526928 /* 0x1.3496266e3fa270005 */, +1.207049110184904572310 /* 0x1.35012ba4e8fa10000 */, +1.208684323627194912036 /* 0x1.356c55f92aabb0004 */, +1.210321752322854882437 /* 0x1.35d7a577dd33f0004 */, +1.211961399276747286580 /* 0x1.36431a2de8748000d */, +1.213603267492579629347 /* 0x1.36aeb4283309e000c */, +1.215247359985374142610 /* 0x1.371a7373b00160000 */, +1.216893679753690671322 /* 0x1.3786581d404e90000 */, +1.218542229828181611183 /* 0x1.37f26231e82e4000c */, +1.220193013225231215567 /* 0x1.385e91be9c2d20002 */, +1.221846032973555429280 /* 0x1.38cae6d05e66f0000 */, +1.223501292099485437962 /* 0x1.393761742e5830001 */, +1.225158793636904830441 /* 0x1.39a401b713cb3000e */, +1.226818540625497444577 /* 0x1.3a10c7a61ceae0007 */, +1.228480536107136034131 /* 0x1.3a7db34e5a4a50003 */, +1.230144783126481566885 /* 0x1.3aeac4bcdf8d60001 */, +1.231811284734168454619 /* 0x1.3b57fbfec6e950008 */, +1.233480043984379381835 /* 0x1.3bc559212e7a2000f */, +1.235151063936380300149 /* 0x1.3c32dc3139f2a0004 */, +1.236824347652524913647 /* 0x1.3ca0853c106ac000e */, +1.238499898199571624970 /* 0x1.3d0e544eddd240003 */, +1.240177718649636107175 /* 0x1.3d7c4976d3fcd0000 */, +1.241857812073360767273 /* 0x1.3dea64c1231f70004 */, +1.243540181554270152039 /* 0x1.3e58a63b099920005 */, +1.245224830175077013244 /* 0x1.3ec70df1c4e46000e */, +1.246911761022835740725 /* 0x1.3f359bf29741c000e */, +1.248600977188942806639 /* 0x1.3fa4504ac7b800009 */, +1.250292481770148400634 /* 0x1.40132b07a330d000a */, +1.251986277866492969263 /* 0x1.40822c367a340000b */, +1.253682368581898742876 /* 0x1.40f153e4a18e0000d */, +1.255380757024939564249 /* 0x1.4160a21f73289000d */, +1.257081446308726757662 /* 0x1.41d016f44deaa000c */, +1.258784439550028944083 /* 0x1.423fb27094c090008 */, +1.260489739869405489991 /* 0x1.42af74a1aec1c0006 */, +1.262197350394008266193 /* 0x1.431f5d950a453000c */, +1.263907274252603851764 /* 0x1.438f6d58176860004 */, +1.265619514578811388761 /* 0x1.43ffa3f84b9eb000d */, +1.267334074511444086425 /* 0x1.44700183221180008 */, +1.269050957191869555296 /* 0x1.44e0860618b930006 */, +1.270770165768063009230 /* 0x1.4551318eb4d20000e */, +1.272491703389059036805 /* 0x1.45c2042a7cc26000b */, +1.274215573211836316547 /* 0x1.4632fde6ffacd000d */, +1.275941778396075143580 /* 0x1.46a41ed1cfac40001 */, +1.277670322103555911043 /* 0x1.471566f8812ac0000 */, +1.279401207505722393185 /* 0x1.4786d668b33260005 */, +1.281134437771823675369 /* 0x1.47f86d3002637000a */, +1.282870016078732078362 /* 0x1.486a2b5c13c00000e */, +1.284607945607987078432 /* 0x1.48dc10fa916bd0004 */, +1.286348229545787758022 /* 0x1.494e1e192aaa30007 */, +1.288090871080605159846 /* 0x1.49c052c5913df000c */, +1.289835873406902644341 /* 0x1.4a32af0d7d8090002 */, +1.291583239722392528754 /* 0x1.4aa532feab5e10002 */, +1.293332973229098792374 /* 0x1.4b17dea6db8010008 */, +1.295085077135345708087 /* 0x1.4b8ab213d57d9000d */, +1.296839554650994097442 /* 0x1.4bfdad53629e10003 */, +1.298596408992440220988 /* 0x1.4c70d0735358a000d */, +1.300355643380135983739 /* 0x1.4ce41b817c99e0001 */, +1.302117261036232376282 /* 0x1.4d578e8bb52cb0003 */, +1.303881265192249561154 /* 0x1.4dcb299fde2920008 */, +1.305647659079073541490 /* 0x1.4e3eeccbd7f4c0003 */, +1.307416445934474813521 /* 0x1.4eb2d81d8a86f000b */, +1.309187629001237640529 /* 0x1.4f26eba2e35a5000e */, +1.310961211525240921493 /* 0x1.4f9b2769d35090009 */, +1.312737196755087820678 /* 0x1.500f8b804e4a30000 */, +1.314515587949291131086 /* 0x1.508417f4530d00009 */, +1.316296388365203462468 /* 0x1.50f8ccd3df1840003 */, +1.318079601265708777911 /* 0x1.516daa2cf60020002 */, +1.319865229921343141607 /* 0x1.51e2b00da3c2b0007 */, +1.321653277603506371251 /* 0x1.5257de83f5512000d */, +1.323443747588034513690 /* 0x1.52cd359dfc7d5000e */, +1.325236643161341820781 /* 0x1.5342b569d6baa000f */, +1.327031967602244177939 /* 0x1.53b85df59921b0000 */, +1.328829724206201046165 /* 0x1.542e2f4f6b17e0006 */, +1.330629916266568235675 /* 0x1.54a4298571b27000e */, +1.332432547083447937938 /* 0x1.551a4ca5d97190009 */, +1.334237619959296017340 /* 0x1.559098bed16bf0008 */, +1.336045138203900251029 /* 0x1.56070dde90c800000 */, +1.337855105129210686631 /* 0x1.567dac13510cd0009 */, +1.339667524053662184301 /* 0x1.56f4736b52e2c000c */, +1.341482398296830025383 /* 0x1.576b63f4d8333000f */, +1.343299731186792467254 /* 0x1.57e27dbe2c40e0003 */, +1.345119526053918823702 /* 0x1.5859c0d59cd37000f */, +1.346941786233264881662 /* 0x1.58d12d497cd9a0005 */, +1.348766515064854010261 /* 0x1.5948c32824b87000c */, +1.350593715891792223641 /* 0x1.59c0827ff03890007 */, +1.352423392064920459908 /* 0x1.5a386b5f43a3e0006 */, +1.354255546937278120764 /* 0x1.5ab07dd485af1000c */, +1.356090183865519494030 /* 0x1.5b28b9ee21085000f */, +1.357927306213322804534 /* 0x1.5ba11fba8816e000b */, +1.359766917346459269620 /* 0x1.5c19af482f8f2000f */, +1.361609020638567812980 /* 0x1.5c9268a594cc00004 */, +1.363453619463660171403 /* 0x1.5d0b4be135916000c */, +1.365300717204201985683 /* 0x1.5d84590998eeb0005 */, +1.367150317245710233754 /* 0x1.5dfd902d494e40001 */, +1.369002422974674892971 /* 0x1.5e76f15ad22c40008 */, +1.370857037789471544224 /* 0x1.5ef07ca0cc166000b */, +1.372714165088220639199 /* 0x1.5f6a320dcf5280006 */, +1.374573808273481745378 /* 0x1.5fe411b0790800009 */, +1.376435970755022220096 /* 0x1.605e1b976e4b1000e */, +1.378300655944092456600 /* 0x1.60d84fd155d15000e */, +1.380167867259843417228 /* 0x1.6152ae6cdf0030003 */, +1.382037608124419003675 /* 0x1.61cd3778bc879000d */, +1.383909881963391264069 /* 0x1.6247eb03a4dc40009 */, +1.385784692209972801544 /* 0x1.62c2c91c56d9b0002 */, +1.387662042298923203992 /* 0x1.633dd1d1930ec0001 */, +1.389541935670444372533 /* 0x1.63b90532200630004 */, +1.391424375772021271329 /* 0x1.6434634ccc4cc0007 */, +1.393309366052102982208 /* 0x1.64afec30677e90008 */, +1.395196909966106124701 /* 0x1.652b9febc8e0f000d */, +1.397087010973788290271 /* 0x1.65a77e8dcc7f10004 */, +1.398979672539331309267 /* 0x1.66238825534170000 */, +1.400874898129892187656 /* 0x1.669fbcc1415600008 */, +1.402772691220124823310 /* 0x1.671c1c708328e000a */, +1.404673055288671035301 /* 0x1.6798a7420988b000d */, +1.406575993818903302975 /* 0x1.68155d44ca77a000f */, +1.408481510297352468121 /* 0x1.68923e87bf70e000a */, +1.410389608216942924956 /* 0x1.690f4b19e8f74000c */, +1.412300291075172076232 /* 0x1.698c830a4c94c0008 */ +}; +#define S (1.0/4503599627370496.0) /* 2^-52 */ +static const float exp2_deltatable[512] = { + 11527*S, -963*S, 884*S, -781*S, -2363*S, -3441*S, 123*S, 526*S, + -6*S, 1254*S, -1138*S, 1519*S, 1576*S, -65*S, 1040*S, 793*S, + -1662*S, -5063*S, -387*S, 968*S, -941*S, 984*S, -2856*S, -545*S, + 495*S, -5246*S, -2109*S, 1281*S, 2075*S, 909*S, -1642*S,-78233*S, +-31653*S, -265*S, 130*S, 430*S, 2482*S, -742*S, 1616*S, -2213*S, + -519*S, 20*S, -3134*S,-13981*S, 1343*S, -1740*S, 247*S, 1679*S, + -1097*S, 3131*S, 871*S, -1480*S, 1936*S, -1827*S, 17325*S, 528*S, + -322*S, 1404*S, -152*S, -1845*S, -212*S, 2639*S, -476*S, 2960*S, + -962*S, -1012*S, -1231*S, 3030*S, 1659*S, -486*S, 2154*S, 1728*S, + -2793*S, 699*S, -1560*S, -2125*S, 2156*S, 142*S, -1888*S, 4426*S, +-13443*S, 1970*S, -50*S, 1771*S,-43399*S, 4979*S, -2448*S, -370*S, + 1414*S, 1075*S, 232*S, 206*S, 873*S, 2141*S, 2970*S, 1279*S, + -2331*S, 336*S, -2595*S, 753*S, -3384*S, -616*S, 89*S, -818*S, + 5755*S, -241*S, -528*S, -661*S, -3777*S, -354*S, 250*S, 3881*S, + 2632*S, -2131*S, 2565*S, -316*S, 1746*S, -2541*S, -1324*S, -50*S, + 2564*S, -782*S, 1176*S, 6452*S, -1002*S, 1288*S, 336*S, -185*S, + 3063*S, 3784*S, 2169*S, 686*S, 328*S, -400*S, 312*S, -4517*S, + -1457*S, 1046*S, -1530*S, -685*S, 1328*S,-49815*S, -895*S, 1063*S, + -2091*S, -672*S, -1710*S, -665*S, 1545*S, 1819*S,-45265*S, 3548*S, + -554*S, -568*S, 4752*S, -1907*S,-13738*S, 675*S, 9611*S, -1115*S, + -815*S, 408*S, -1281*S, -937*S,-16376*S, -4772*S, -1440*S, 992*S, + 788*S, 10364*S, -1602*S, -661*S, -1783*S, -265*S, -20*S, -3781*S, + -861*S, -345*S, -994*S, 1364*S, -5339*S, 1620*S, 9390*S, -1066*S, + -305*S, -170*S, 175*S, 2461*S, -490*S, -769*S, -1450*S, 3315*S, + 2418*S, -45*S, -852*S, -1295*S, -488*S, -96*S, 1142*S, -2639*S, + 7905*S, -9306*S, -3859*S, 760*S, 1057*S, -1570*S, 3977*S, 209*S, + -514*S, 7151*S, 1646*S, 627*S, 599*S, -774*S, -1468*S, 633*S, + -473*S, 851*S, 2406*S, 143*S, 74*S, 4260*S, 1177*S, -913*S, + 2670*S, -3298*S, -1662*S, -120*S, -3264*S, -2148*S, 410*S, 2078*S, + -2098*S, -926*S, 3580*S, -1289*S, 2450*S, -1158*S, 907*S, -590*S, + 986*S, 1801*S, 1145*S, -1677*S, 3455*S, 956*S, 710*S, 144*S, + 153*S, -255*S, -1898*S, 28102*S, 2748*S, 1194*S, -3009*S, 7076*S, + 0*S, -2720*S, 711*S, 1225*S, -3034*S, -473*S, 378*S, -1046*S, + 962*S, -2006*S, 4647*S, 3206*S, 1769*S, -2665*S, 1254*S, 2025*S, + -2430*S, 6193*S, 1224*S, -856*S, -1592*S, -325*S, -1521*S, 1827*S, + -264*S, 2403*S, -1065*S, 967*S, -681*S, -2106*S, -474*S, 1333*S, + -893*S, 2296*S, 592*S, -1220*S, -326*S, 990*S, 139*S, 206*S, + -779*S, -1683*S, 1238*S, 6098*S, 136*S, 1197*S, 790*S, -107*S, + -1004*S, -2449*S, 939*S, 5568*S, 156*S, 1812*S, 2792*S, -1094*S, + -2677*S, -251*S, 2297*S, 943*S, -1329*S, 2883*S, -853*S, -2626*S, +-105929*S, -6552*S, 1095*S, -1508*S, 1003*S, 5039*S, -2600*S, -749*S, + 1790*S, 890*S, 2016*S, -1073*S, 624*S, -2084*S, -1536*S, -1330*S, + 358*S, 2444*S, -179*S,-25759*S, -243*S, -552*S, -124*S, 3766*S, + 1192*S, -1614*S, 6*S, -1227*S, 345*S, -981*S, -295*S, -1006*S, + -995*S, -1195*S, 706*S, 2512*S, -1758*S, -734*S, -6286*S, -922*S, + 1530*S, 1542*S, 1223*S, 61*S, -83*S, 522*S,116937*S, -914*S, + -418*S, -7339*S, 249*S, -520*S, -762*S, 426*S, -505*S, 2664*S, + -1093*S, -1035*S, 2130*S, 4878*S, 1982*S, 1551*S, 2304*S, 193*S, + 1532*S, -7268*S, 24357*S, 531*S, 2676*S, -1170*S, 1465*S, -1917*S, + 2143*S, 1466*S, -7*S, -7300*S, 3297*S, -1197*S, -289*S, -1548*S, + 26226*S, 4401*S, 4123*S, -1588*S, 4243*S, 4069*S, -1276*S, -2010*S, + 1407*S, 1478*S, 488*S, -2366*S, -2909*S, -2534*S, -1285*S, 7095*S, + -645*S, -2089*S, -944*S, -40*S, -1363*S, -833*S, 917*S, 1609*S, + 1286*S, 1677*S, 1613*S, -2295*S, -1248*S, 40*S, 26*S, 2038*S, + 698*S, 2675*S, -1755*S, -3522*S, -1614*S, -6111*S, 270*S, 1822*S, + -234*S, -2844*S, -1201*S, -830*S, 1193*S, 2354*S, 47*S, 1522*S, + -78*S, -640*S, 2425*S, -1596*S, 1563*S, 1169*S, -1006*S, -83*S, + 2362*S, -3521*S, -314*S, 1814*S, -1751*S, 305*S, 1715*S, -3741*S, + 7847*S, 1291*S, 1206*S, 36*S, 1397*S, -1419*S, -1194*S, -2014*S, + 1742*S, -578*S, -207*S, 875*S, 1539*S, 2826*S, -1165*S, -909*S, + 1849*S, 927*S, 2018*S, -981*S, 1637*S, -463*S, 905*S, 6618*S, + 400*S, 630*S, 2614*S, 900*S, 2323*S, -1094*S, -1858*S, -212*S, + -2069*S, 747*S, 1845*S, -1450*S, 444*S, -213*S, -438*S, 1158*S, + 4738*S, 2497*S, -370*S, -2016*S, -518*S, -1160*S, -1510*S, 123*S +}; +/* Maximum magnitude in above table: 116937 */ +#undef S diff --git a/sysdeps/libm-ieee754/t_exp2f.h b/sysdeps/libm-ieee754/t_exp2f.h new file mode 100644 index 0000000000..0f7674cefb --- /dev/null +++ b/sysdeps/libm-ieee754/t_exp2f.h @@ -0,0 +1,301 @@ +/* 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 */ +}; +#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 +}; +/* Maximum magnitude in above table: 1269 */ +#undef S +#define EXP2_TSIZE 8 +#define EXP2_TTOL 9 +#define EXP2_FSIZE 23 +#define EXP2_FNAME float diff --git a/sysdeps/libm-ieee754/w_exp2.c b/sysdeps/libm-ieee754/w_exp2.c new file mode 100644 index 0000000000..126aa090bc --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp2.c @@ -0,0 +1,36 @@ +/* + * wrapper exp2(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const double o_threshold= (double) DBL_MAX_EXP; +static const double u_threshold= (double) DBL_MIN_EXP; + +double +__exp2 (double x) /* wrapper exp2 */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2 (x); +#else + double z; + z = __ieee754_exp2 (x); + if (_LIB_VERSION != _IEEE_ && __finite (x)) + { + if (x > o_threshold) + /* exp2 overflow */ + return __kernel_standard (x, x, 44); + else if (x < u_threshold) + /* exp2 underflow */ + return __kernel_standard (x, x, 45); + } + return z; +#endif +} +weak_alias (__exp2, exp2) +#ifdef NO_LONG_DOUBLE +strong_alias (__exp2, __expl2) +weak_alias (__exp2, expl2) +#endif diff --git a/sysdeps/libm-ieee754/w_exp2f.c b/sysdeps/libm-ieee754/w_exp2f.c new file mode 100644 index 0000000000..d2c340db3f --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp2f.c @@ -0,0 +1,32 @@ +/* + * wrapper exp2f(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const float o_threshold= (float) FLT_MAX_EXP; +static const float u_threshold= (float) FLT_MIN_EXP; + +float +__exp2f (float x) /* wrapper exp2f */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2f (x); +#else + float z; + z = __ieee754_exp2f (x); + if (_LIB_VERSION != _IEEE_ && __finitef (x)) + { + if (x > o_threshold) + /* exp2 overflow */ + return (float) __kernel_standard ((double) x, (double) x, 144); + else if (x < u_threshold) + /* exp2 underflow */ + return (float) __kernel_standard ((double) x, (double) x, 145); + } + return z; +#endif +} +weak_alias (__exp2f, exp2f) diff --git a/sysdeps/libm-ieee754/w_exp2l.c b/sysdeps/libm-ieee754/w_exp2l.c new file mode 100644 index 0000000000..965e9bf3e4 --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp2l.c @@ -0,0 +1,30 @@ +/* + * wrapper exp2l(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const long double o_threshold = (long double) LDBL_MAX_EXP; +static const long double u_threshold = (long double) LDBL_MIN_EXP; + +long double +__exp2l (long double x) /* wrapper exp2l */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2l (x); +#else + long double z; + z = __ieee754_exp2l (x); + if (_LIB_VERSION != _IEEE_ && __finitel (x)) + { + if (x > o_threshold) + return __kernel_standard (x, x, 244); /* exp2l overflow */ + else if (x < u_threshold) + return __kernel_standard (x, x, 245); /* exp2l underflow */ + } + return z; +#endif +} +weak_alias (__exp2l, exp2l) diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index 3e8f22b573..1813c78dd8 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -21,7 +21,7 @@ endif # so that's at least 8192 entries. Since libc only uses about 1200 entries, # we want to use -fpic, because this generates fewer relocs. ifeq (yes,$(build-shared)) -CFLAGS-.os = -fpic -fno-common +pic-ccflag = -fpic endif # The initfini generation code doesn't work in the presence of -fPIC, so @@ -29,3 +29,7 @@ endif ifeq ($(subdir),csu) CFLAGS-initfini.s = -g0 -fpic endif + +ifeq ($(subdir),string) +CFLAGS-memcmp.c += -Wno-uninitialized +endif diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h index d7f2a3ac0d..d7cabaf28b 100644 --- a/sysdeps/powerpc/bits/mathinline.h +++ b/sysdeps/powerpc/bits/mathinline.h @@ -32,34 +32,22 @@ __sgn1 (double __x) { return __x >= 0.0 ? 1.0 : -1.0; } +#endif /* __NO_MATH_INLINES && __OPTIMZE__ */ -/* We'd want to use this if it was implemented in hardware, but - how can we tell? */ -#if 0 -__MATH_INLINE double sqrt (double __x); -__MATH_INLINE double -sqrt (double __x) -{ - register double __value; - __asm - ("fsqrt %0,%1" - : "=f" (__value) : "f" (__x)); - - return __value; -} -#endif - -__MATH_INLINE double fabs (double __x); -__MATH_INLINE double -fabs (double __x) -{ - register double __value; - __asm - ("fabs %0,%1" - : "=f" (__value) : "f" (__x)); - - return __value; -} +#if __USE_ISOC9X +# define __unordered_cmp(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + unsigned __r; \ + __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y)); \ + __r; })) + +# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) +# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) +# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) +# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0) +# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0) +# define isunordered(x, y) (__unordered_cmp (x, y) & 1) +#endif /* __USE_ISOC9X */ -#endif /* __NO_MATH_INLINES && __OPTIMZE__ */ #endif /* __GNUC__ */ diff --git a/sysdeps/powerpc/bzero.S b/sysdeps/powerpc/bzero.S new file mode 100644 index 0000000000..783a91fdcb --- /dev/null +++ b/sysdeps/powerpc/bzero.S @@ -0,0 +1,27 @@ +/* Optimized bzero `implementation' for PowerPC. + 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 <sysdep.h> + +ENTRY(__bzero) + mr %r5,%r4 + li %r4,0 + b memset@local +END(__bzero) +weak_alias (__bzero, bzero) diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index 771b711a14..70a3f20b31 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -199,6 +199,53 @@ _dl_runtime_resolve: bctr 0: .size _dl_runtime_resolve,0b-_dl_runtime_resolve + + .align 2 + .globl _dl_prof_resolve + .type _dl_prof_resolve,@function +_dl_prof_resolve: + # We need to save the registers used to pass parameters, and register 0, + # which is used by _mcount; the registers are saved in a stack frame. + stwu 1,-48(1) + stw 0,12(1) + stw 3,16(1) + stw 4,20(1) + # The code that calls this has put parameters for `fixup' in r12 and r11. + mr 3,12 + stw 5,24(1) + mr 4,11 + stw 6,28(1) + mflr 5 + # We also need to save some of the condition register fields. + stw 7,32(1) + stw 5,52(1) + stw 8,36(1) + mfcr 0 + stw 9,40(1) + stw 10,44(1) + stw 0,8(1) + bl profile_fixup@local + # 'fixup' returns the address we want to branch to. + mtctr 3 + # Put the registers back... + lwz 0,52(1) + lwz 10,44(1) + lwz 9,40(1) + mtlr 0 + lwz 8,36(1) + lwz 0,8(1) + lwz 7,32(1) + lwz 6,28(1) + mtcrf 0xFF,0 + lwz 5,24(1) + lwz 4,20(1) + lwz 3,16(1) + lwz 0,12(1) + # ...unwind the stack frame, and jump to the PLT entry we updated. + addi 1,1,48 + bctr +0: + .size _dl_prof_resolve,0b-_dl_prof_resolve # Undo '.section text'. .previous "); @@ -409,8 +456,14 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) Elf32_Word num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val / sizeof (Elf32_Rela)); Elf32_Word rel_offset_words = PLT_DATA_START_WORDS (num_plt_entries); - extern void _dl_runtime_resolve (void); Elf32_Word size_modified; + extern void _dl_runtime_resolve (void); + extern void _dl_prof_resolve (void); + Elf32_Word dlrr; + + dlrr = (Elf32_Word)(char *)(profile + ? _dl_prof_resolve + : _dl_runtime_resolve); if (lazy) for (i = 0; i < num_plt_entries; i++) @@ -433,8 +486,7 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) /* Multiply index of entry by 3 (in r11). */ plt[0] = OPCODE_SLWI (12, 11, 1); plt[1] = OPCODE_ADD (11, 12, 11); - if ((Elf32_Word) (char *) _dl_runtime_resolve <= 0x01fffffc || - (Elf32_Word) (char *) _dl_runtime_resolve >= 0xfe000000) + if (dlrr <= 0x01fffffc || dlrr >= 0xfe000000) { /* Load address of link map in r12. */ plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) map); @@ -442,15 +494,13 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) + 0x8000) >> 16)); /* Call _dl_runtime_resolve. */ - plt[4] = OPCODE_BA ((Elf32_Word) (char *) _dl_runtime_resolve); + plt[4] = OPCODE_BA (dlrr); } else { /* Get address of _dl_runtime_resolve in CTR. */ - plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) _dl_runtime_resolve); - plt[3] = OPCODE_ADDIS (12, 12, ((((Elf32_Word) (char *) - _dl_runtime_resolve) - + 0x8000) >> 16)); + plt[2] = OPCODE_LI (12, dlrr); + plt[3] = OPCODE_ADDIS (12, 12, (dlrr + 0x8000) >> 16); plt[4] = OPCODE_MTCTR (12); /* Load address of link map in r12. */ @@ -501,7 +551,6 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) static inline void elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc) { - assert (ELF32_R_TYPE (reloc->r_info) == R_PPC_JMP_SLOT); /* elf_machine_runtime_setup handles this. */ } @@ -513,7 +562,7 @@ elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc) LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -static inline void +static void elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, Elf32_Addr *const reloc_addr) @@ -709,4 +758,4 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, #define ELF_MACHINE_NO_REL 1 -#endif +#endif /* RESOLVE */ diff --git a/sysdeps/powerpc/machine-gmon.h b/sysdeps/powerpc/machine-gmon.h index ba53807308..b890dd5c53 100644 --- a/sysdeps/powerpc/machine-gmon.h +++ b/sysdeps/powerpc/machine-gmon.h @@ -1,7 +1,6 @@ /* PowerPC-specific implementation of profiling support. Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. 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 diff --git a/sysdeps/powerpc/stpcpy.S b/sysdeps/powerpc/stpcpy.S new file mode 100644 index 0000000000..58ad5b12b6 --- /dev/null +++ b/sysdeps/powerpc/stpcpy.S @@ -0,0 +1,100 @@ +/* Optimized stpcpy implementation for PowerPC. + 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 <sysdep.h> + +/* See strlen.s for comments on how the end-of-string testing works. */ + +EALIGN(__stpcpy,4,0) +/* char * [r3] stpcpy (char *dest [r3], const char *src [r4]) */ + +/* General register assignments: + r0: temporary + r3: pointer to previous word in dest + r4: pointer to previous word in src + r6: current word from src + r7: 0xfefefeff + r8: 0x7f7f7f7f + r9: ~(word in src | 0x7f7f7f7f) + r10: alternate word from src. */ + + or %r0,%r4,%r3 + clrlwi. %r0,%r0,30 + addi %r3,%r3,-4 + bne L(unaligned) + + lis %r7,0xfeff + lis %r8,0x7f7f + lwz %r6,0(%r4) + addi %r7,%r7,-0x101 + addi %r8,%r8,0x7f7f + b 2f + +0: lwzu %r10,4(%r4) + stwu %r6,4(%r3) + add %r0,%r7,%r10 + nor %r9,%r8,%r10 + and. %r0,%r0,%r9 + bne- 1f + lwzu %r6,4(%r4) + stwu %r10,4(%r3) +2: add %r0,%r7,%r6 + nor %r9,%r8,%r6 + and. %r0,%r0,%r9 + beq+ 0b + + mr %r10,%r6 +/* We've hit the end of the string. Do the rest byte-by-byte. */ +1: rlwinm. %r0,%r10,8,24,31 + stbu %r0,4(%r3) + beqlr- + rlwinm. %r0,%r10,16,24,31 + stbu %r0,1(%r3) + beqlr- + rlwinm. %r0,%r10,24,24,31 + stbu %r0,1(%r3) + beqlr- + stbu %r10,1(%r3) + blr + +/* Oh well. In this case, we just do a byte-by-byte copy. */ + .align 4 + nop +L(unaligned): + lbz %r6,0(%r4) + addi %r3,%r3,3 + cmpwi %r6,0 + beq- 2f + +0: lbzu %r10,1(%r4) + stbu %r6,1(%r3) + cmpwi %r10,0 + beq- 1f + nop /* Let 601 load start of loop. */ + lbzu %r6,1(%r4) + stbu %r10,1(%r3) + cmpwi %r6,0 + bne+ 0b +2: stbu %r6,1(%r3) + blr +1: stbu %r10,1(%r3) + blr +END(__stpcpy) + +weak_alias (__stpcpy, stpcpy) diff --git a/sysdeps/powerpc/strcat.c b/sysdeps/powerpc/strcat.c new file mode 100644 index 0000000000..9d9ab6549a --- /dev/null +++ b/sysdeps/powerpc/strcat.c @@ -0,0 +1,30 @@ +/* strcat version that uses fast strcpy/strlen. + 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 <string.h> + +#undef strcat + +/* Append SRC on the end of DEST. */ +char * +strcat (char *dest, const char *src) +{ + strcpy (dest + strlen (dest), src); + return dest; +} diff --git a/sysdeps/powerpc/strcpy.S b/sysdeps/powerpc/strcpy.S new file mode 100644 index 0000000000..3c0cce7844 --- /dev/null +++ b/sysdeps/powerpc/strcpy.S @@ -0,0 +1,100 @@ +/* Optimized strcpy implementation for PowerPC. + 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 <sysdep.h> + +/* See strlen.s for comments on how the end-of-string testing works. */ + +EALIGN(strcpy,4,0) +/* char * [r3] strcpy (char *dest [r3], const char *src [r4]) */ + +/* General register assignments: + r0: temporary + r3: saved `dest' + r4: pointer to previous word in src + r5: pointer to previous word in dest + r6: current word from src + r7: 0xfefefeff + r8: 0x7f7f7f7f + r9: ~(word in src | 0x7f7f7f7f) + r10: alternate word from src. */ + + or %r0,%r4,%r3 + clrlwi. %r0,%r0,30 + addi %r5,%r3,-4 + bne L(unaligned) + + lis %r7,0xfeff + lis %r8,0x7f7f + lwz %r6,0(%r4) + addi %r7,%r7,-0x101 + addi %r8,%r8,0x7f7f + b 2f + +0: lwzu %r10,4(%r4) + stwu %r6,4(%r5) + add %r0,%r7,%r10 + nor %r9,%r8,%r10 + and. %r0,%r0,%r9 + bne- 1f + lwzu %r6,4(%r4) + stwu %r10,4(%r5) +2: add %r0,%r7,%r6 + nor %r9,%r8,%r6 + and. %r0,%r0,%r9 + beq+ 0b + + mr %r10,%r6 +/* We've hit the end of the string. Do the rest byte-by-byte. */ +1: rlwinm. %r0,%r10,8,24,31 + stb %r0,4(%r5) + beqlr- + rlwinm. %r0,%r10,16,24,31 + stb %r0,5(%r5) + beqlr- + rlwinm. %r0,%r10,24,24,31 + stb %r0,6(%r5) + beqlr- + stb %r10,7(%r5) + blr + +/* Oh well. In this case, we just do a byte-by-byte copy. */ + .align 4 + nop +L(unaligned): + lbz %r6,0(%r4) + addi %r5,%r3,-1 + cmpwi %r6,0 + beq- 2f + +0: lbzu %r10,1(%r4) + stbu %r6,1(%r5) + cmpwi %r10,0 + beq- 1f + nop /* Let 601 load start of loop. */ + lbzu %r6,1(%r4) + stbu %r10,1(%r5) + cmpwi %r6,0 + bne+ 0b +2: stb %r6,1(%r5) + blr +1: stb %r10,1(%r5) + blr + +END(strcpy) diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c index 7a2b0c8279..6b4373db0f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c @@ -1,5 +1,5 @@ /* Operating system support for run-time dynamic linker. Linux/PPC version. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + 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 diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h index 49460661e2..c3908d7080 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h @@ -39,4 +39,16 @@ struct __kernel_termios #define _HAVE_C_ISPEED 1 #define _HAVE_C_OSPEED 1 +/* We have the kernel termios structure, so we can presume this code knows + what it's doing... */ + +#undef TCGETS +#undef TCSETS +#undef TCSETSW +#undef TCSETSF +#define TCGETS _IOR ('t', 19, struct __kernel_termios) +#define TCSETS _IOW ('t', 20, struct __kernel_termios) +#define TCSETSW _IOW ('t', 21, struct __kernel_termios) +#define TCSETSF _IOW ('t', 22, struct __kernel_termios) + #endif /* kernel_termios.h */ |