From cd2edbcb4b0f1e261be91711b16165f78f5a6744 Mon Sep 17 00:00:00 2001 From: Peter Avalos Date: Sun, 30 Jan 2011 20:24:13 -1000 Subject: [PATCH] Remove unneeded files from contrib/gdtoa. Add a README.DELETED while I'm here. --- contrib/gdtoa/README.DELETED | 34 ++++++ contrib/gdtoa/arithchk.c | 183 -------------------------------- contrib/gdtoa/g_Qfmt.c | 119 --------------------- contrib/gdtoa/g__fmt.c | 147 -------------------------- contrib/gdtoa/g_ddfmt.c | 170 ------------------------------ contrib/gdtoa/g_dfmt.c | 95 ----------------- contrib/gdtoa/g_ffmt.c | 93 ---------------- contrib/gdtoa/g_xLfmt.c | 113 -------------------- contrib/gdtoa/g_xfmt.c | 119 --------------------- contrib/gdtoa/makefile | 85 --------------- contrib/gdtoa/qnan.c | 110 ------------------- contrib/gdtoa/strtoIQ.c | 63 ----------- contrib/gdtoa/strtoId.c | 60 ----------- contrib/gdtoa/strtoIdd.c | 66 ------------ contrib/gdtoa/strtoIf.c | 58 ---------- contrib/gdtoa/strtoIg.c | 137 ------------------------ contrib/gdtoa/strtoIx.c | 64 ----------- contrib/gdtoa/strtoIxL.c | 62 ----------- contrib/gdtoa/strtodI.c | 163 ---------------------------- contrib/gdtoa/strtodnrp.c | 87 --------------- contrib/gdtoa/strtopQ.c | 106 ------------------- contrib/gdtoa/strtopd.c | 54 ---------- contrib/gdtoa/strtopdd.c | 183 -------------------------------- contrib/gdtoa/strtopf.c | 78 -------------- contrib/gdtoa/strtopx.c | 109 ------------------- contrib/gdtoa/strtopxL.c | 97 ----------------- contrib/gdtoa/strtorQ.c | 117 -------------------- contrib/gdtoa/strtordd.c | 199 ----------------------------------- contrib/gdtoa/strtorf.c | 89 ---------------- contrib/gdtoa/strtorxL.c | 108 ------------------- 30 files changed, 34 insertions(+), 3134 deletions(-) create mode 100644 contrib/gdtoa/README.DELETED delete mode 100644 contrib/gdtoa/arithchk.c delete mode 100644 contrib/gdtoa/g_Qfmt.c delete mode 100644 contrib/gdtoa/g__fmt.c delete mode 100644 contrib/gdtoa/g_ddfmt.c delete mode 100644 contrib/gdtoa/g_dfmt.c delete mode 100644 contrib/gdtoa/g_ffmt.c delete mode 100644 contrib/gdtoa/g_xLfmt.c delete mode 100644 contrib/gdtoa/g_xfmt.c delete mode 100644 contrib/gdtoa/makefile delete mode 100644 contrib/gdtoa/qnan.c delete mode 100644 contrib/gdtoa/strtoIQ.c delete mode 100644 contrib/gdtoa/strtoId.c delete mode 100644 contrib/gdtoa/strtoIdd.c delete mode 100644 contrib/gdtoa/strtoIf.c delete mode 100644 contrib/gdtoa/strtoIg.c delete mode 100644 contrib/gdtoa/strtoIx.c delete mode 100644 contrib/gdtoa/strtoIxL.c delete mode 100644 contrib/gdtoa/strtodI.c delete mode 100644 contrib/gdtoa/strtodnrp.c delete mode 100644 contrib/gdtoa/strtopQ.c delete mode 100644 contrib/gdtoa/strtopd.c delete mode 100644 contrib/gdtoa/strtopdd.c delete mode 100644 contrib/gdtoa/strtopf.c delete mode 100644 contrib/gdtoa/strtopx.c delete mode 100644 contrib/gdtoa/strtopxL.c delete mode 100644 contrib/gdtoa/strtorQ.c delete mode 100644 contrib/gdtoa/strtordd.c delete mode 100644 contrib/gdtoa/strtorf.c delete mode 100644 contrib/gdtoa/strtorxL.c diff --git a/contrib/gdtoa/README.DELETED b/contrib/gdtoa/README.DELETED new file mode 100644 index 0000000000..07d57f03fe --- /dev/null +++ b/contrib/gdtoa/README.DELETED @@ -0,0 +1,34 @@ +arithchk.c +g_Qfmt.c +g__fmt.c +g_ddfmt.c +g_dfmt.c +g_ffmt.c +g_xLfmt.c +g_xfmt.c +makefile +printf.c +printf.c0 +qnan.c +stdio1.h +strtoIQ.c +strtoId.c +strtoIdd.c +strtoIf.c +strtoIg.c +strtoIx.c +strtoIxL.c +strtodI.c +strtodnrp.c +strtopQ.c +strtopd.c +strtopdd.c +strtopf.c +strtopx.c +strtopxL.c +strtorQ.c +strtordd.c +strtorf.c +strtorxL.c +test/ +xsum0.out diff --git a/contrib/gdtoa/arithchk.c b/contrib/gdtoa/arithchk.c deleted file mode 100644 index 3211aeda42..0000000000 --- a/contrib/gdtoa/arithchk.c +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************** -Copyright (C) 1997, 1998 Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -/* Try to deduce arith.h from arithmetic properties. */ - -#include - - static int dalign; - typedef struct -Akind { - char *name; - int kind; - } Akind; - - static Akind -IEEE_8087 = { "IEEE_8087", 1 }, -IEEE_MC68k = { "IEEE_MC68k", 2 }, -IBM = { "IBM", 3 }, -VAX = { "VAX", 4 }, -CRAY = { "CRAY", 5}; - - static Akind * -Lcheck() -{ - union { - double d; - long L[2]; - } u; - struct { - double d; - long L; - } x[2]; - - if (sizeof(x) > 2*(sizeof(double) + sizeof(long))) - dalign = 1; - u.L[0] = u.L[1] = 0; - u.d = 1e13; - if (u.L[0] == 1117925532 && u.L[1] == -448790528) - return &IEEE_MC68k; - if (u.L[1] == 1117925532 && u.L[0] == -448790528) - return &IEEE_8087; - if (u.L[0] == -2065213935 && u.L[1] == 10752) - return &VAX; - if (u.L[0] == 1267827943 && u.L[1] == 704643072) - return &IBM; - return 0; - } - - static Akind * -icheck() -{ - union { - double d; - int L[2]; - } u; - struct { - double d; - int L; - } x[2]; - - if (sizeof(x) > 2*(sizeof(double) + sizeof(int))) - dalign = 1; - u.L[0] = u.L[1] = 0; - u.d = 1e13; - if (u.L[0] == 1117925532 && u.L[1] == -448790528) - return &IEEE_MC68k; - if (u.L[1] == 1117925532 && u.L[0] == -448790528) - return &IEEE_8087; - if (u.L[0] == -2065213935 && u.L[1] == 10752) - return &VAX; - if (u.L[0] == 1267827943 && u.L[1] == 704643072) - return &IBM; - return 0; - } - -char *emptyfmt = ""; /* avoid possible warning message with printf("") */ - - static Akind * -ccheck() -{ - union { - double d; - long L; - } u; - long Cray1; - - /* Cray1 = 4617762693716115456 -- without overflow on non-Crays */ - Cray1 = printf(emptyfmt) < 0 ? 0 : 4617762; - if (printf(emptyfmt, Cray1) >= 0) - Cray1 = 1000000*Cray1 + 693716; - if (printf(emptyfmt, Cray1) >= 0) - Cray1 = 1000000*Cray1 + 115456; - u.d = 1e13; - if (u.L == Cray1) - return &CRAY; - return 0; - } - - static int -fzcheck() -{ - double a, b; - int i; - - a = 1.; - b = .1; - for(i = 155;; b *= b, i >>= 1) { - if (i & 1) { - a *= b; - if (i == 1) - break; - } - } - b = a * a; - return b == 0.; - } - - int -main() -{ - Akind *a = 0; - int Ldef = 0; - FILE *f; - -#ifdef WRITE_ARITH_H /* for Symantec's buggy "make" */ - f = fopen("arith.h", "w"); - if (!f) { - printf("Cannot open arith.h\n"); - return 1; - } -#else - f = stdout; -#endif - - if (sizeof(double) == 2*sizeof(long)) - a = Lcheck(); - else if (sizeof(double) == 2*sizeof(int)) { - Ldef = 1; - a = icheck(); - } - else if (sizeof(double) == sizeof(long)) - a = ccheck(); - if (a) { - fprintf(f, "#define %s\n#define Arith_Kind_ASL %d\n", - a->name, a->kind); - if (Ldef) - fprintf(f, "#define Long int\n#define Intcast (int)(long)\n"); - if (dalign) - fprintf(f, "#define Double_Align\n"); - if (sizeof(char*) == 8) - fprintf(f, "#define X64_bit_pointers\n"); -#ifndef NO_LONG_LONG - if (sizeof(long long) < 8) -#endif - fprintf(f, "#define NO_LONG_LONG\n"); - if (a->kind <= 2 && fzcheck()) - fprintf(f, "#define Sudden_Underflow\n"); - return 0; - } - fprintf(f, "/* Unknown arithmetic */\n"); - return 1; - } diff --git a/contrib/gdtoa/g_Qfmt.c b/contrib/gdtoa/g_Qfmt.c deleted file mode 100644 index 15d1bdde45..0000000000 --- a/contrib/gdtoa/g_Qfmt.c +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#endif -#ifdef IEEE_8087 -#define _0 3 -#define _1 2 -#define _2 1 -#define _3 0 -#endif - - char* -#ifdef KR_headers -g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; -#else -g_Qfmt(char *buf, void *V, int ndig, size_t bufsize) -#endif -{ - static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; - char *b, *s, *se; - ULong bits[4], *L, sign; - int decpt, ex, i, mode; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - if (ndig < 0) - ndig = 0; - if (bufsize < ndig + 10) - return 0; - - L = (ULong*)V; - sign = L[_0] & 0x80000000L; - bits[3] = L[_0] & 0xffff; - bits[2] = L[_1]; - bits[1] = L[_2]; - bits[0] = L[_3]; - b = buf; - if ( (ex = (L[_0] & 0x7fff0000L) >> 16) !=0) { - if (ex == 0x7fff) { - /* Infinity or NaN */ - if (bits[0] | bits[1] | bits[2] | bits[3]) - b = strcp(b, "NaN"); - else { - b = buf; - if (sign) - *b++ = '-'; - b = strcp(b, "Infinity"); - } - return b; - } - i = STRTOG_Normal; - bits[3] |= 0x10000; - } - else if (bits[0] | bits[1] | bits[2] | bits[3]) { - i = STRTOG_Denormal; - ex = 1; - } - else { -#ifndef IGNORE_ZERO_SIGN - if (sign) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - ex -= 0x3fff + 112; - mode = 2; - if (ndig <= 0) { - if (bufsize < 48) - return 0; - mode = 0; - } - s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign, bufsize); - } diff --git a/contrib/gdtoa/g__fmt.c b/contrib/gdtoa/g__fmt.c deleted file mode 100644 index 6c4b3d26fb..0000000000 --- a/contrib/gdtoa/g__fmt.c +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#ifdef USE_LOCALE -#include "locale.h" -#endif - - char * -#ifdef KR_headers -g__fmt(b, s, se, decpt, sign, blen) char *b; char *s; char *se; int decpt; ULong sign; size_t blen; -#else -g__fmt(char *b, char *s, char *se, int decpt, ULong sign, size_t blen) -#endif -{ - int i, j, k; - char *be, *s0; - size_t len; -#ifdef USE_LOCALE -#ifdef NO_LOCALE_CACHE - char *decimalpoint = localeconv()->decimal_point; - size_t dlen = strlen(decimalpoint); -#else - char *decimalpoint; - static char *decimalpoint_cache; - static size_t dlen; - if (!(s0 = decimalpoint_cache)) { - s0 = localeconv()->decimal_point; - dlen = strlen(s0); - if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { - strcpy(decimalpoint_cache, s0); - s0 = decimalpoint_cache; - } - } - decimalpoint = s0; -#endif -#else -#define dlen 0 -#endif - s0 = s; - len = (se-s) + dlen + 6; /* 6 = sign + e+dd + trailing null */ - if (blen < len) - goto ret0; - be = b + blen - 1; - if (sign) - *b++ = '-'; - if (decpt <= -4 || decpt > se - s + 5) { - *b++ = *s++; - if (*s) { -#ifdef USE_LOCALE - while((*b = *decimalpoint++)) - ++b; -#else - *b++ = '.'; -#endif - while((*b = *s++) !=0) - b++; - } - *b++ = 'e'; - /* sprintf(b, "%+.2d", decpt - 1); */ - if (--decpt < 0) { - *b++ = '-'; - decpt = -decpt; - } - else - *b++ = '+'; - for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10){} - for(;;) { - i = decpt / k; - if (b >= be) - goto ret0; - *b++ = i + '0'; - if (--j <= 0) - break; - decpt -= i*k; - decpt *= 10; - } - *b = 0; - } - else if (decpt <= 0) { -#ifdef USE_LOCALE - while((*b = *decimalpoint++)) - ++b; -#else - *b++ = '.'; -#endif - if (be < b - decpt + (se - s)) - goto ret0; - for(; decpt < 0; decpt++) - *b++ = '0'; - while((*b = *s++) != 0) - b++; - } - else { - while((*b = *s++) != 0) { - b++; - if (--decpt == 0 && *s) { -#ifdef USE_LOCALE - while(*b = *decimalpoint++) - ++b; -#else - *b++ = '.'; -#endif - } - } - if (b + decpt > be) { - ret0: - b = 0; - goto ret; - } - for(; decpt > 0; decpt--) - *b++ = '0'; - *b = 0; - } - ret: - freedtoa(s0); - return b; - } diff --git a/contrib/gdtoa/g_ddfmt.c b/contrib/gdtoa/g_ddfmt.c deleted file mode 100644 index 1256655eb2..0000000000 --- a/contrib/gdtoa/g_ddfmt.c +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg@acm.org). */ - -#include "gdtoaimp.h" -#include - - char * -#ifdef KR_headers -g_ddfmt(buf, dd0, ndig, bufsize) char *buf; double *dd0; int ndig; size_t bufsize; -#else -g_ddfmt(char *buf, double *dd0, int ndig, size_t bufsize) -#endif -{ - FPI fpi; - char *b, *s, *se; - ULong *L, bits0[4], *bits, *zx; - int bx, by, decpt, ex, ey, i, j, mode; - Bigint *x, *y, *z; - U *dd, ddx[2]; -#ifdef Honor_FLT_ROUNDS /*{{*/ - int Rounding; -#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ - Rounding = Flt_Rounds; -#else /*}{*/ - Rounding = 1; - switch(fegetround()) { - case FE_TOWARDZERO: Rounding = 0; break; - case FE_UPWARD: Rounding = 2; break; - case FE_DOWNWARD: Rounding = 3; - } -#endif /*}}*/ -#else /*}{*/ -#define Rounding FPI_Round_near -#endif /*}}*/ - - if (bufsize < 10 || bufsize < ndig + 8) - return 0; - - dd = (U*)dd0; - L = dd->L; - if ((L[_0] & 0x7ff00000L) == 0x7ff00000L) { - /* Infinity or NaN */ - if (L[_0] & 0xfffff || L[_1]) { - nanret: - return strcp(buf, "NaN"); - } - if ((L[2+_0] & 0x7ff00000) == 0x7ff00000) { - if (L[2+_0] & 0xfffff || L[2+_1]) - goto nanret; - if ((L[_0] ^ L[2+_0]) & 0x80000000L) - goto nanret; /* Infinity - Infinity */ - } - infret: - b = buf; - if (L[_0] & 0x80000000L) - *b++ = '-'; - return strcp(b, "Infinity"); - } - if ((L[2+_0] & 0x7ff00000) == 0x7ff00000) { - L += 2; - if (L[_0] & 0xfffff || L[_1]) - goto nanret; - goto infret; - } - if (dval(&dd[0]) + dval(&dd[1]) == 0.) { - b = buf; -#ifndef IGNORE_ZERO_SIGN - if (L[_0] & L[2+_0] & 0x80000000L) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - if ((L[_0] & 0x7ff00000L) < (L[2+_0] & 0x7ff00000L)) { - dval(&ddx[1]) = dval(&dd[0]); - dval(&ddx[0]) = dval(&dd[1]); - dd = ddx; - L = dd->L; - } - z = d2b(dval(&dd[0]), &ex, &bx); - if (dval(&dd[1]) == 0.) - goto no_y; - x = z; - y = d2b(dval(&dd[1]), &ey, &by); - if ( (i = ex - ey) !=0) { - if (i > 0) { - x = lshift(x, i); - ex = ey; - } - else - y = lshift(y, -i); - } - if ((L[_0] ^ L[2+_0]) & 0x80000000L) { - z = diff(x, y); - if (L[_0] & 0x80000000L) - z->sign = 1 - z->sign; - } - else { - z = sum(x, y); - if (L[_0] & 0x80000000L) - z->sign = 1; - } - Bfree(x); - Bfree(y); - no_y: - bits = zx = z->x; - for(i = 0; !*zx; zx++) - i += 32; - i += lo0bits(zx); - if (i) { - rshift(z, i); - ex += i; - } - fpi.nbits = z->wds * 32 - hi0bits(z->x[j = z->wds-1]); - if (fpi.nbits < 106) { - fpi.nbits = 106; - if (j < 3) { - for(i = 0; i <= j; i++) - bits0[i] = bits[i]; - while(i < 4) - bits0[i++] = 0; - bits = bits0; - } - } - mode = 2; - if (ndig <= 0) { - if (bufsize < (int)(fpi.nbits * .301029995664) + 10) { - Bfree(z); - return 0; - } - mode = 0; - } - fpi.emin = 1-1023-53+1; - fpi.emax = 2046-1023-106+1; - fpi.rounding = Rounding; - fpi.sudden_underflow = 0; - i = STRTOG_Normal; - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - b = g__fmt(buf, s, se, decpt, z->sign, bufsize); - Bfree(z); - return b; - } diff --git a/contrib/gdtoa/g_dfmt.c b/contrib/gdtoa/g_dfmt.c deleted file mode 100644 index 8367868f47..0000000000 --- a/contrib/gdtoa/g_dfmt.c +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - char* -#ifdef KR_headers -g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; size_t bufsize; -#else -g_dfmt(char *buf, double *d, int ndig, size_t bufsize) -#endif -{ - static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; - char *b, *s, *se; - ULong bits[2], *L, sign; - int decpt, ex, i, mode; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - if (ndig < 0) - ndig = 0; - if (bufsize < ndig + 10) - return 0; - - L = (ULong*)d; - sign = L[_0] & 0x80000000L; - if ((L[_0] & 0x7ff00000) == 0x7ff00000) { - /* Infinity or NaN */ - if (bufsize < 10) - return 0; - if (L[_0] & 0xfffff || L[_1]) { - return strcp(buf, "NaN"); - } - b = buf; - if (sign) - *b++ = '-'; - return strcp(b, "Infinity"); - } - if (L[_1] == 0 && (L[_0] ^ sign) == 0 /*d == 0.*/) { - b = buf; -#ifndef IGNORE_ZERO_SIGN - if (L[_0] & 0x80000000L) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - bits[0] = L[_1]; - bits[1] = L[_0] & 0xfffff; - if ( (ex = (L[_0] >> 20) & 0x7ff) !=0) - bits[1] |= 0x100000; - else - ex = 1; - ex -= 0x3ff + 52; - mode = 2; - if (ndig <= 0) - mode = 0; - i = STRTOG_Normal; - if (sign) - i = STRTOG_Normal | STRTOG_Neg; - s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign, bufsize); - } diff --git a/contrib/gdtoa/g_ffmt.c b/contrib/gdtoa/g_ffmt.c deleted file mode 100644 index 1c27c602b2..0000000000 --- a/contrib/gdtoa/g_ffmt.c +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - char* -#ifdef KR_headers -g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; size_t bufsize; -#else -g_ffmt(char *buf, float *f, int ndig, size_t bufsize) -#endif -{ - static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; - char *b, *s, *se; - ULong bits[1], *L, sign; - int decpt, ex, i, mode; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - if (ndig < 0) - ndig = 0; - if (bufsize < ndig + 10) - return 0; - - L = (ULong*)f; - sign = L[0] & 0x80000000L; - if ((L[0] & 0x7f800000) == 0x7f800000) { - /* Infinity or NaN */ - if (L[0] & 0x7fffff) { - return strcp(buf, "NaN"); - } - b = buf; - if (sign) - *b++ = '-'; - return strcp(b, "Infinity"); - } - if (*f == 0.) { - b = buf; -#ifndef IGNORE_ZERO_SIGN - if (L[0] & 0x80000000L) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - bits[0] = L[0] & 0x7fffff; - if ( (ex = (L[0] >> 23) & 0xff) !=0) - bits[0] |= 0x800000; - else - ex = 1; - ex -= 0x7f + 23; - mode = 2; - if (ndig <= 0) { - if (bufsize < 16) - return 0; - mode = 0; - } - i = STRTOG_Normal; - s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign, bufsize); - } diff --git a/contrib/gdtoa/g_xLfmt.c b/contrib/gdtoa/g_xLfmt.c deleted file mode 100644 index 6fa1de2dad..0000000000 --- a/contrib/gdtoa/g_xLfmt.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#endif -#ifdef IEEE_8087 -#define _0 2 -#define _1 1 -#define _2 0 -#endif - - char* -#ifdef KR_headers -g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; -#else -g_xLfmt(char *buf, void *V, int ndig, size_t bufsize) -#endif -{ - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; - char *b, *s, *se; - ULong bits[2], *L, sign; - int decpt, ex, i, mode; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - if (ndig < 0) - ndig = 0; - if (bufsize < ndig + 10) - return 0; - - L = (ULong*)V; - sign = L[_0] & 0x80000000L; - bits[1] = L[_1]; - bits[0] = L[_2]; - if ( (ex = (L[_0] >> 16) & 0x7fff) !=0) { - if (ex == 0x7fff) { - /* Infinity or NaN */ - if (bits[0] | bits[1]) - b = strcp(buf, "NaN"); - else { - b = buf; - if (sign) - *b++ = '-'; - b = strcp(b, "Infinity"); - } - return b; - } - i = STRTOG_Normal; - } - else if (bits[0] | bits[1]) { - i = STRTOG_Denormal; - } - else { - b = buf; -#ifndef IGNORE_ZERO_SIGN - if (sign) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - ex -= 0x3fff + 63; - mode = 2; - if (ndig <= 0) { - if (bufsize < 32) - return 0; - mode = 0; - } - s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign, bufsize); - } diff --git a/contrib/gdtoa/g_xfmt.c b/contrib/gdtoa/g_xfmt.c deleted file mode 100644 index 495c7b471e..0000000000 --- a/contrib/gdtoa/g_xfmt.c +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#define _4 4 -#endif -#ifdef IEEE_8087 -#define _0 4 -#define _1 3 -#define _2 2 -#define _3 1 -#define _4 0 -#endif - - char* -#ifdef KR_headers -g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; -#else -g_xfmt(char *buf, void *V, int ndig, size_t bufsize) -#endif -{ - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; - char *b, *s, *se; - ULong bits[2], sign; - UShort *L; - int decpt, ex, i, mode; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - if (ndig < 0) - ndig = 0; - if (bufsize < ndig + 10) - return 0; - - L = (UShort *)V; - sign = L[_0] & 0x8000; - bits[1] = (L[_1] << 16) | L[_2]; - bits[0] = (L[_3] << 16) | L[_4]; - if ( (ex = L[_0] & 0x7fff) !=0) { - if (ex == 0x7fff) { - /* Infinity or NaN */ - if (bits[0] | bits[1]) - b = strcp(buf, "NaN"); - else { - b = buf; - if (sign) - *b++ = '-'; - b = strcp(b, "Infinity"); - } - return b; - } - i = STRTOG_Normal; - } - else if (bits[0] | bits[1]) { - i = STRTOG_Denormal; - ex = 1; - } - else { - b = buf; -#ifndef IGNORE_ZERO_SIGN - if (sign) - *b++ = '-'; -#endif - *b++ = '0'; - *b = 0; - return b; - } - ex -= 0x3fff + 63; - mode = 2; - if (ndig <= 0) { - if (bufsize < 32) - return 0; - mode = 0; - } - s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign, bufsize); - } diff --git a/contrib/gdtoa/makefile b/contrib/gdtoa/makefile deleted file mode 100644 index b1f18cdf10..0000000000 --- a/contrib/gdtoa/makefile +++ /dev/null @@ -1,85 +0,0 @@ -# /**************************************************************** -# Copyright (C) 1998 by Lucent Technologies -# All Rights Reserved -# -# Permission to use, copy, modify, and distribute this software and -# its documentation for any purpose and without fee is hereby -# granted, provided that the above copyright notice appear in all -# copies and that both that the copyright notice and this -# permission notice and warranty disclaimer appear in supporting -# documentation, and that the name of Lucent or any of its entities -# not be used in advertising or publicity pertaining to -# distribution of the software without specific, written prior -# permission. -# -# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -# THIS SOFTWARE. -# -# ****************************************************************/ - -.SUFFIXES: .c .o -CC = cc -CFLAGS = -g - -.c.o: - $(CC) -c $(CFLAGS) $*.c - -# invoke "make Printf" to add printf.o to gdtoa.a (if desired) - -all: arith.h gd_qnan.h gdtoa.a - -arith.h: arithchk.c - $(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c - ./a.out >arith.h - rm -f a.out arithchk.o - -gd_qnan.h: arith.h qnan.c - $(CC) $(CFLAGS) qnan.c - ./a.out >gd_qnan.h - rm -f a.out qnan.o - -gdtoa.a: dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\ - g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c\ - hexnan.c misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c\ - strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c\ - strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c\ - strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\ - strtorx.c strtorxL.c sum.c ulp.c - $(CC) -c $(CFLAGS) $? - x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x - ranlib gdtoa.a || true - -Printf: all printf.c - $(CC) -c $(CFLAGS) printf.c - ar ruv gdtoa.a printf.o - rm printf.o - touch Printf - -# If your system lacks ranlib, you do not need it. - -xs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c\ - g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h\ - gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\ - makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\ - strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\ - strtoIxL.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c\ - strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c\ - strtorQ.c strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c\ - sum.c ulp.c - -# "make -r xsum.out" to check for transmission errors; source for xsum is -# netlib's "xsum.c from f2c", e.g., -# ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz - -xsum.out: xsum0.out $(xs0) - xsum $(xs0) >xsum1.out - cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out - -clean: - rm -f arith.h gd_qnan.h *.[ao] Printf xsum.out xsum1.out diff --git a/contrib/gdtoa/qnan.c b/contrib/gdtoa/qnan.c deleted file mode 100644 index 118e749216..0000000000 --- a/contrib/gdtoa/qnan.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 2005 by David M. Gay -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that the copyright notice and this permission notice and warranty -disclaimer appear in supporting documentation, and that the name of -the author or any of his current or former employers not be used in -advertising or publicity pertaining to distribution of the software -without specific, written prior permission. - -THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN -NO EVENT SHALL THE AUTHOR OR ANY OF HIS CURRENT OR FORMER EMPLOYERS BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -/* Program to compute quiet NaNs of various precisions (float, */ -/* double, and perhaps long double) on the current system, */ -/* provided the system uses binary IEEE (P754) arithmetic. */ -/* Note that one system's quiet NaN may be a signaling NaN on */ -/* another system. The IEEE arithmetic standards (P754, P854) */ -/* do not specify how to distinguish signaling NaNs from quiet */ -/* ones, and this detail varies across systems. The computed */ -/* NaN values are encoded in #defines for values for an */ -/* unsigned 32-bit integer type, called Ulong below, and */ -/* (for long double) perhaps as unsigned short values. Once */ -/* upon a time, there were PC compilers for Intel CPUs that */ -/* had sizeof(long double) = 10. Are such compilers still */ -/* distributed? */ - -#include -#include "arith.h" - -#ifndef Long -#define Long long -#endif - -typedef unsigned Long Ulong; - -#undef HAVE_IEEE -#ifdef IEEE_8087 -#define _0 1 -#define _1 0 -#define HAVE_IEEE -#endif -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define HAVE_IEEE -#endif - -#define UL (unsigned long) - - int -main(void) -{ -#ifdef HAVE_IEEE - typedef union { - float f; - double d; - Ulong L[4]; -#ifndef NO_LONG_LONG - unsigned short u[5]; - long double D; -#endif - } U; - U a, b, c; - int i; - - a.L[0] = b.L[0] = 0x7f800000; - c.f = a.f - b.f; - printf("#define f_QNAN 0x%lx\n", UL c.L[0]); - a.L[_0] = b.L[_0] = 0x7ff00000; - a.L[_1] = b.L[_1] = 0; - c.d = a.d - b.d; /* quiet NaN */ - printf("#define d_QNAN0 0x%lx\n", UL c.L[0]); - printf("#define d_QNAN1 0x%lx\n", UL c.L[1]); -#ifdef NO_LONG_LONG - for(i = 0; i < 4; i++) - printf("#define ld_QNAN%d 0xffffffff\n", i); - for(i = 0; i < 5; i++) - printf("#define ldus_QNAN%d 0xffff\n", i); -#else - b.D = c.D = a.d; - if (printf("") < 0) - c.D = 37; /* never executed; just defeat optimization */ - a.L[2] = a.L[3] = 0; - a.D = b.D - c.D; - for(i = 0; i < 4; i++) - printf("#define ld_QNAN%d 0x%lx\n", i, UL a.L[i]); - for(i = 0; i < 5; i++) - printf("#define ldus_QNAN%d 0x%x\n", i, a.u[i]); -#endif -#endif /* HAVE_IEEE */ - return 0; - } diff --git a/contrib/gdtoa/strtoIQ.c b/contrib/gdtoa/strtoIQ.c deleted file mode 100644 index 9ce5120e6b..0000000000 --- a/contrib/gdtoa/strtoIQ.c +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIQ(s, sp, a, b) CONST char *s; char **sp; void *a; void *b; -#else -strtoIQ(CONST char *s, char **sp, void *a, void *b) -#endif -{ - static FPI fpi = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI }; - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - ULong *L = (ULong *)a, *M = (ULong *)b; - - B[0] = Balloc(2); - B[0]->wds = 4; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtoQ(L, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtoQ(M, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else { - M[0] = L[0]; - M[1] = L[1]; - M[2] = L[2]; - M[3] = L[3]; - } - return k; - } diff --git a/contrib/gdtoa/strtoId.c b/contrib/gdtoa/strtoId.c deleted file mode 100644 index 1c97d382de..0000000000 --- a/contrib/gdtoa/strtoId.c +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoId(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1; -#else -strtoId(CONST char *s, char **sp, double *f0, double *f1) -#endif -{ - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - - B[0] = Balloc(1); - B[0]->wds = 2; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtod((ULong*)f0, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtod((ULong*)f1, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else { - ((ULong*)f1)[0] = ((ULong*)f0)[0]; - ((ULong*)f1)[1] = ((ULong*)f0)[1]; - } - return k; - } diff --git a/contrib/gdtoa/strtoIdd.c b/contrib/gdtoa/strtoIdd.c deleted file mode 100644 index 40b7936bc0..0000000000 --- a/contrib/gdtoa/strtoIdd.c +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIdd(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1; -#else -strtoIdd(CONST char *s, char **sp, double *f0, double *f1) -#endif -{ -#ifdef Sudden_Underflow - static FPI fpi = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; -#else - static FPI fpi = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; -#endif - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - - B[0] = Balloc(2); - B[0]->wds = 4; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtodd((ULong*)f0, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtodd((ULong*)f1, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else { - ((ULong*)f1)[0] = ((ULong*)f0)[0]; - ((ULong*)f1)[1] = ((ULong*)f0)[1]; - ((ULong*)f1)[2] = ((ULong*)f0)[2]; - ((ULong*)f1)[3] = ((ULong*)f0)[3]; - } - return k; - } diff --git a/contrib/gdtoa/strtoIf.c b/contrib/gdtoa/strtoIf.c deleted file mode 100644 index 65ecab2e0b..0000000000 --- a/contrib/gdtoa/strtoIf.c +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIf(s, sp, f0, f1) CONST char *s; char **sp; float *f0, *f1; -#else -strtoIf(CONST char *s, char **sp, float *f0, float *f1) -#endif -{ - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - - B[0] = Balloc(0); - B[0]->wds = 1; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtof((ULong*)f0, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtof((ULong*)f1, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else - *(ULong*)f1 = *(ULong*)f0; - return k; - } diff --git a/contrib/gdtoa/strtoIg.c b/contrib/gdtoa/strtoIg.c deleted file mode 100644 index 6a17760cf5..0000000000 --- a/contrib/gdtoa/strtoIg.c +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIg(s00, se, fpi, exp, B, rvp) CONST char *s00; char **se; FPI *fpi; Long *exp; Bigint **B; int *rvp; -#else -strtoIg(CONST char *s00, char **se, FPI *fpi, Long *exp, Bigint **B, int *rvp) -#endif -{ - Bigint *b, *b1; - int i, nb, nw, nw1, rv, rv1, swap; - unsigned int nb1, nb11; - Long e1; - - b = *B; - rv = strtodg(s00, se, fpi, exp, b->x); - if (!(rv & STRTOG_Inexact)) { - B[1] = 0; - return *rvp = rv; - } - e1 = exp[0]; - rv1 = rv ^ STRTOG_Inexact; - b1 = Balloc(b->k); - Bcopy(b1, b); - nb = fpi->nbits; - nb1 = nb & 31; - nb11 = (nb1 - 1) & 31; - nw = b->wds; - nw1 = nw - 1; - if (rv & STRTOG_Inexlo) { - swap = 0; - b1 = increment(b1); - if ((rv & STRTOG_Retmask) == STRTOG_Zero) { - if (fpi->sudden_underflow) { - b1->x[0] = 0; - b1->x[nw1] = 1L << nb11; - rv1 += STRTOG_Normal - STRTOG_Zero; - rv1 &= ~STRTOG_Underflow; - goto swapcheck; - } - rv1 &= STRTOG_Inexlo | STRTOG_Underflow | STRTOG_Zero; - rv1 |= STRTOG_Inexhi | STRTOG_Denormal; - goto swapcheck; - } - if (b1->wds > nw - || (nb1 && b1->x[nw1] & 1L << nb1)) { - if (++e1 > fpi->emax) - rv1 = STRTOG_Infinite | STRTOG_Inexhi; - rshift(b1, 1); - } - else if ((rv & STRTOG_Retmask) == STRTOG_Denormal) { - if (b1->x[nw1] & 1L << nb11) { - rv1 += STRTOG_Normal - STRTOG_Denormal; - rv1 &= ~STRTOG_Underflow; - } - } - } - else { - swap = STRTOG_Neg; - if ((rv & STRTOG_Retmask) == STRTOG_Infinite) { - b1 = set_ones(b1, nb); - e1 = fpi->emax; - rv1 = STRTOG_Normal | STRTOG_Inexlo; - goto swapcheck; - } - decrement(b1); - if ((rv & STRTOG_Retmask) == STRTOG_Denormal) { - for(i = nw1; !b1->x[i]; --i) - if (!i) { - rv1 = STRTOG_Zero | STRTOG_Inexlo; - break; - } - goto swapcheck; - } - if (!(b1->x[nw1] & 1L << nb11)) { - if (e1 == fpi->emin) { - if (fpi->sudden_underflow) - rv1 += STRTOG_Zero - STRTOG_Normal; - else - rv1 += STRTOG_Denormal - STRTOG_Normal; - rv1 |= STRTOG_Underflow; - } - else { - b1 = lshift(b1, 1); - b1->x[0] |= 1; - --e1; - } - } - } - swapcheck: - if (swap ^ (rv & STRTOG_Neg)) { - rvp[0] = rv1; - rvp[1] = rv; - B[0] = b1; - B[1] = b; - exp[1] = exp[0]; - exp[0] = e1; - } - else { - rvp[0] = rv; - rvp[1] = rv1; - B[1] = b1; - exp[1] = e1; - } - return rv; - } diff --git a/contrib/gdtoa/strtoIx.c b/contrib/gdtoa/strtoIx.c deleted file mode 100644 index 783a631f06..0000000000 --- a/contrib/gdtoa/strtoIx.c +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIx(s, sp, a, b) CONST char *s; char **sp; void *a; void *b; -#else -strtoIx(CONST char *s, char **sp, void *a, void *b) -#endif -{ - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - UShort *L = (UShort *)a, *M = (UShort *)b; - - B[0] = Balloc(1); - B[0]->wds = 2; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtox(L, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtox(M, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else { - M[0] = L[0]; - M[1] = L[1]; - M[2] = L[2]; - M[3] = L[3]; - M[4] = L[4]; - } - return k; - } diff --git a/contrib/gdtoa/strtoIxL.c b/contrib/gdtoa/strtoIxL.c deleted file mode 100644 index 869bfd16fb..0000000000 --- a/contrib/gdtoa/strtoIxL.c +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtoIxL(s, sp, a, b) CONST char *s; char **sp; void *a; void *b; -#else -strtoIxL(CONST char *s, char **sp, void *a, void *b) -#endif -{ - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; - Long exp[2]; - Bigint *B[2]; - int k, rv[2]; - ULong *L = (ULong *)a, *M = (ULong *)b; - - B[0] = Balloc(1); - B[0]->wds = 2; - k = strtoIg(s, sp, &fpi, exp, B, rv); - ULtoxL(L, B[0]->x, exp[0], rv[0]); - Bfree(B[0]); - if (B[1]) { - ULtoxL(M, B[1]->x, exp[1], rv[1]); - Bfree(B[1]); - } - else { - M[0] = L[0]; - M[1] = L[1]; - M[2] = L[2]; - } - return k; - } diff --git a/contrib/gdtoa/strtodI.c b/contrib/gdtoa/strtodI.c deleted file mode 100644 index 0b7b8a45c0..0000000000 --- a/contrib/gdtoa/strtodI.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - static double -#ifdef KR_headers -ulpdown(d) U *d; -#else -ulpdown(U *d) -#endif -{ - double u; - ULong *L = d->L; - - u = ulp(d); - if (!(L[_1] | (L[_0] & 0xfffff)) - && (L[_0] & 0x7ff00000) > 0x00100000) - u *= 0.5; - return u; - } - - int -#ifdef KR_headers -strtodI(s, sp, dd) CONST char *s; char **sp; double *dd; -#else -strtodI(CONST char *s, char **sp, double *dd) -#endif -{ - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; - ULong bits[2], sign; - Long exp; - int j, k; - U *u; - - k = strtodg(s, sp, &fpi, &exp, bits); - u = (U*)dd; - sign = k & STRTOG_Neg ? 0x80000000L : 0; - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - dval(&u[0]) = dval(&u[1]) = 0.; - break; - - case STRTOG_Zero: - dval(&u[0]) = dval(&u[1]) = 0.; -#ifdef Sudden_Underflow - if (k & STRTOG_Inexact) { - if (sign) - word0(&u[0]) = 0x80100000L; - else - word0(&u[1]) = 0x100000L; - } - break; -#else - goto contain; -#endif - - case STRTOG_Denormal: - word1(&u[0]) = bits[0]; - word0(&u[0]) = bits[1]; - goto contain; - - case STRTOG_Normal: - word1(&u[0]) = bits[0]; - word0(&u[0]) = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); - contain: - j = k & STRTOG_Inexact; - if (sign) { - word0(&u[0]) |= sign; - j = STRTOG_Inexact - j; - } - switch(j) { - case STRTOG_Inexlo: -#ifdef Sudden_Underflow - if ((u->L[_0] & 0x7ff00000) < 0x3500000) { - word0(&u[1]) = word0(&u[0]) + 0x3500000; - word1(&u[1]) = word1(&u[0]); - dval(&u[1]) += ulp(&u[1]); - word0(&u[1]) -= 0x3500000; - if (!(word0(&u[1]) & 0x7ff00000)) { - word0(&u[1]) = sign; - word1(&u[1]) = 0; - } - } - else -#endif - dval(&u[1]) = dval(&u[0]) + ulp(&u[0]); - break; - case STRTOG_Inexhi: - dval(&u[1]) = dval(&u[0]); -#ifdef Sudden_Underflow - if ((word0(&u[0]) & 0x7ff00000) < 0x3500000) { - word0(&u[0]) += 0x3500000; - dval(&u[0]) -= ulpdown(u); - word0(&u[0]) -= 0x3500000; - if (!(word0(&u[0]) & 0x7ff00000)) { - word0(&u[0]) = sign; - word1(&u[0]) = 0; - } - } - else -#endif - dval(&u[0]) -= ulpdown(u); - break; - default: - dval(&u[1]) = dval(&u[0]); - } - break; - - case STRTOG_Infinite: - word0(&u[0]) = word0(&u[1]) = sign | 0x7ff00000; - word1(&u[0]) = word1(&u[1]) = 0; - if (k & STRTOG_Inexact) { - if (sign) { - word0(&u[1]) = 0xffefffffL; - word1(&u[1]) = 0xffffffffL; - } - else { - word0(&u[0]) = 0x7fefffffL; - word1(&u[0]) = 0xffffffffL; - } - } - break; - - case STRTOG_NaN: - u->L[0] = (u+1)->L[0] = d_QNAN0; - u->L[1] = (u+1)->L[1] = d_QNAN1; - break; - - case STRTOG_NaNbits: - word0(&u[0]) = word0(&u[1]) = 0x7ff00000 | sign | bits[1]; - word1(&u[0]) = word1(&u[1]) = bits[0]; - } - return k; - } diff --git a/contrib/gdtoa/strtodnrp.c b/contrib/gdtoa/strtodnrp.c deleted file mode 100644 index 19a769f0b4..0000000000 --- a/contrib/gdtoa/strtodnrp.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 2004 by David M. Gay. -All Rights Reserved -Based on material in the rest of /netlib/fp/gdota.tar.gz, -which is copyright (C) 1998, 2000 by Lucent Technologies. - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* This is a variant of strtod that works on Intel ia32 systems */ -/* with the default extended-precision arithmetic -- it does not */ -/* require setting the precision control to 53 bits. */ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - double -#ifdef KR_headers -strtod(s, sp) CONST char *s; char **sp; -#else -strtod(CONST char *s, char **sp) -#endif -{ - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; - ULong bits[2]; - Long exp; - int k; - union { ULong L[2]; double d; } u; - - k = strtodg(s, sp, &fpi, &exp, bits); - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - u.L[0] = u.L[1] = 0; - break; - - case STRTOG_Normal: - u.L[_1] = bits[0]; - u.L[_0] = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); - break; - - case STRTOG_Denormal: - u.L[_1] = bits[0]; - u.L[_0] = bits[1]; - break; - - case STRTOG_Infinite: - u.L[_0] = 0x7ff00000; - u.L[_1] = 0; - break; - - case STRTOG_NaN: - u.L[0] = d_QNAN0; - u.L[1] = d_QNAN1; - break; - - case STRTOG_NaNbits: - u.L[_0] = 0x7ff00000 | bits[1]; - u.L[_1] = bits[0]; - } - if (k & STRTOG_Neg) - u.L[_0] |= 0x80000000L; - return u.d; - } diff --git a/contrib/gdtoa/strtopQ.c b/contrib/gdtoa/strtopQ.c deleted file mode 100644 index 77f3190337..0000000000 --- a/contrib/gdtoa/strtopQ.c +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#endif -#ifdef IEEE_8087 -#define _0 3 -#define _1 2 -#define _2 1 -#define _3 0 -#endif - - int -#ifdef KR_headers -strtopQ(s, sp, V) CONST char *s; char **sp; void *V; -#else -strtopQ(CONST char *s, char **sp, void *V) -#endif -{ - static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI }; - ULong bits[4]; - Long exp; - int k; - ULong *L = (ULong*)V; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - k = strtodg(s, sp, fpi, &exp, bits); - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = L[3] = 0; - break; - - case STRTOG_Normal: - case STRTOG_NaNbits: - L[_3] = bits[0]; - L[_2] = bits[1]; - L[_1] = bits[2]; - L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16); - break; - - case STRTOG_Denormal: - L[_3] = bits[0]; - L[_2] = bits[1]; - L[_1] = bits[2]; - L[_0] = bits[3]; - break; - - case STRTOG_Infinite: - L[_0] = 0x7fff0000; - L[_1] = L[_2] = L[_3] = 0; - break; - - case STRTOG_NaN: - L[0] = ld_QNAN0; - L[1] = ld_QNAN1; - L[2] = ld_QNAN2; - L[3] = ld_QNAN3; - } - if (k & STRTOG_Neg) - L[_0] |= 0x80000000L; - return k; - } diff --git a/contrib/gdtoa/strtopd.c b/contrib/gdtoa/strtopd.c deleted file mode 100644 index 0fb35daeaa..0000000000 --- a/contrib/gdtoa/strtopd.c +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtopd(s, sp, d) char *s; char **sp; double *d; -#else -strtopd(CONST char *s, char **sp, double *d) -#endif -{ - static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; - ULong bits[2]; - Long exp; - int k; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - k = strtodg(s, sp, fpi, &exp, bits); - ULtod((ULong*)d, bits, exp, k); - return k; - } diff --git a/contrib/gdtoa/strtopdd.c b/contrib/gdtoa/strtopdd.c deleted file mode 100644 index 738372d882..0000000000 --- a/contrib/gdtoa/strtopdd.c +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd; -#else -strtopdd(CONST char *s, char **sp, double *dd) -#endif -{ -#ifdef Sudden_Underflow - static FPI fpi0 = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; -#else - static FPI fpi0 = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; -#endif - ULong bits[4]; - Long exp; - int i, j, rv; - typedef union { - double d[2]; - ULong L[4]; - } U; - U *u; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - rv = strtodg(s, sp, fpi, &exp, bits); - u = (U*)dd; - switch(rv & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - u->d[0] = u->d[1] = 0.; - break; - - case STRTOG_Normal: - u->L[_1] = (bits[1] >> 21 | bits[2] << 11) & 0xffffffffL; - u->L[_0] = (bits[2] >> 21) | ((bits[3] << 11) & 0xfffff) - | ((exp + 0x3ff + 105) << 20); - exp += 0x3ff + 52; - if (bits[1] &= 0x1fffff) { - i = hi0bits(bits[1]) - 11; - if (i >= exp) { - i = exp - 1; - exp = 0; - } - else - exp -= i; - if (i > 0) { - bits[1] = bits[1] << i | bits[0] >> (32-i); - bits[0] = bits[0] << i & 0xffffffffL; - } - } - else if (bits[0]) { - i = hi0bits(bits[0]) + 21; - if (i >= exp) { - i = exp - 1; - exp = 0; - } - else - exp -= i; - if (i < 32) { - bits[1] = bits[0] >> (32 - i); - bits[0] = bits[0] << i & 0xffffffffL; - } - else { - bits[1] = bits[0] << (i - 32); - bits[0] = 0; - } - } - else { - u->L[2] = u->L[3] = 0; - break; - } - u->L[2+_1] = bits[0]; - u->L[2+_0] = (bits[1] & 0xfffff) | (exp << 20); - break; - - case STRTOG_Denormal: - if (bits[3]) - goto nearly_normal; - if (bits[2]) - goto partly_normal; - if (bits[1] & 0xffe00000) - goto hardly_normal; - /* completely denormal */ - u->L[2] = u->L[3] = 0; - u->L[_1] = bits[0]; - u->L[_0] = bits[1]; - break; - - nearly_normal: - i = hi0bits(bits[3]) - 11; /* i >= 12 */ - j = 32 - i; - u->L[_0] = ((bits[3] << i | bits[2] >> j) & 0xfffff) - | ((65 - i) << 20); - u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - u->L[2+_0] = bits[1] & ((1L << j) - 1); - u->L[2+_1] = bits[0]; - break; - - partly_normal: - i = hi0bits(bits[2]) - 11; - if (i < 0) { - j = -i; - i += 32; - u->L[_0] = (bits[2] >> j & 0xfffff) | (33 + j) << 20; - u->L[_1] = ((bits[2] << i) | (bits[1] >> j)) & 0xffffffffL; - u->L[2+_0] = bits[1] & ((1L << j) - 1); - u->L[2+_1] = bits[0]; - break; - } - if (i == 0) { - u->L[_0] = (bits[2] & 0xfffff) | (33 << 20); - u->L[_1] = bits[1]; - u->L[2+_0] = 0; - u->L[2+_1] = bits[0]; - break; - } - j = 32 - i; - u->L[_0] = (((bits[2] << i) | (bits[1] >> j)) & 0xfffff) - | ((j + 1) << 20); - u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; - u->L[2+_0] = 0; - u->L[2+_1] = bits[0] & ((1L << j) - 1); - break; - - hardly_normal: - j = 11 - hi0bits(bits[1]); - i = 32 - j; - u->L[_0] = (bits[1] >> j & 0xfffff) | ((j + 1) << 20); - u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; - u->L[2+_0] = 0; - u->L[2+_1] = bits[0] & ((1L << j) - 1); - break; - - case STRTOG_Infinite: - u->L[_0] = u->L[2+_0] = 0x7ff00000; - u->L[_1] = u->L[2+_1] = 0; - break; - - case STRTOG_NaN: - u->L[0] = u->L[2] = d_QNAN0; - u->L[1] = u->L[3] = d_QNAN1; - } - if (rv & STRTOG_Neg) { - u->L[ _0] |= 0x80000000L; - u->L[2+_0] |= 0x80000000L; - } - return rv; - } diff --git a/contrib/gdtoa/strtopf.c b/contrib/gdtoa/strtopf.c deleted file mode 100644 index 23ca5cbe58..0000000000 --- a/contrib/gdtoa/strtopf.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - int -#ifdef KR_headers -strtopf(s, sp, f) CONST char *s; char **sp; float *f; -#else -strtopf(CONST char *s, char **sp, float *f) -#endif -{ - static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; - ULong bits[1], *L; - Long exp; - int k; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - k = strtodg(s, sp, fpi, &exp, bits); - L = (ULong*)f; - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = 0; - break; - - case STRTOG_Normal: - case STRTOG_NaNbits: - L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); - break; - - case STRTOG_Denormal: - L[0] = bits[0]; - break; - - case STRTOG_Infinite: - L[0] = 0x7f800000; - break; - - case STRTOG_NaN: - L[0] = f_QNAN; - } - if (k & STRTOG_Neg) - L[0] |= 0x80000000L; - return k; - } diff --git a/contrib/gdtoa/strtopx.c b/contrib/gdtoa/strtopx.c deleted file mode 100644 index f7a25ff1ac..0000000000 --- a/contrib/gdtoa/strtopx.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#define _4 4 -#endif -#ifdef IEEE_8087 -#define _0 4 -#define _1 3 -#define _2 2 -#define _3 1 -#define _4 0 -#endif - - int -#ifdef KR_headers -strtopx(s, sp, V) CONST char *s; char **sp; void *V; -#else -strtopx(CONST char *s, char **sp, void *V) -#endif -{ - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; - ULong bits[2]; - Long exp; - int k; - UShort *L = (UShort*)V; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - k = strtodg(s, sp, fpi, &exp, bits); - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = L[3] = L[4] = 0; - break; - - case STRTOG_Denormal: - L[_0] = 0; - goto normal_bits; - - case STRTOG_Normal: - case STRTOG_NaNbits: - L[_0] = exp + 0x3fff + 63; - normal_bits: - L[_4] = (UShort)bits[0]; - L[_3] = (UShort)(bits[0] >> 16); - L[_2] = (UShort)bits[1]; - L[_1] = (UShort)(bits[1] >> 16); - break; - - case STRTOG_Infinite: - L[_0] = 0x7fff; - L[_1] = 0x8000; - L[_2] = L[_3] = L[_4] = 0; - break; - - case STRTOG_NaN: - L[0] = ldus_QNAN0; - L[1] = ldus_QNAN1; - L[2] = ldus_QNAN2; - L[3] = ldus_QNAN3; - L[4] = ldus_QNAN4; - } - if (k & STRTOG_Neg) - L[_0] |= 0x8000; - return k; - } diff --git a/contrib/gdtoa/strtopxL.c b/contrib/gdtoa/strtopxL.c deleted file mode 100644 index 6519a41442..0000000000 --- a/contrib/gdtoa/strtopxL.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#endif -#ifdef IEEE_8087 -#define _0 2 -#define _1 1 -#define _2 0 -#endif - - int -#ifdef KR_headers -strtopxL(s, sp, V) CONST char *s; char **sp; void *V; -#else -strtopxL(CONST char *s, char **sp, void *V) -#endif -{ - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; - ULong bits[2]; - Long exp; - int k; - ULong *L = (ULong*)V; -#ifdef Honor_FLT_ROUNDS -#include "gdtoa_fltrnds.h" -#else -#define fpi &fpi0 -#endif - - k = strtodg(s, sp, fpi, &exp, bits); - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = 0; - break; - - case STRTOG_Normal: - case STRTOG_Denormal: - case STRTOG_NaNbits: - L[_2] = bits[0]; - L[_1] = bits[1]; - L[_0] = (exp + 0x3fff + 63) << 16; - break; - - case STRTOG_Infinite: - L[_0] = 0x7fff << 16; - L[_1] = 0x80000000; - L[_2] = 0; - break; - - case STRTOG_NaN: - L[0] = ld_QNAN0; - L[1] = ld_QNAN1; - L[2] = ld_QNAN2; - } - if (k & STRTOG_Neg) - L[_0] |= 0x80000000L; - return k; - } diff --git a/contrib/gdtoa/strtorQ.c b/contrib/gdtoa/strtorQ.c deleted file mode 100644 index a9a07da04e..0000000000 --- a/contrib/gdtoa/strtorQ.c +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#endif -#ifdef IEEE_8087 -#define _0 3 -#define _1 2 -#define _2 1 -#define _3 0 -#endif - - void -#ifdef KR_headers -ULtoQ(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k; -#else -ULtoQ(ULong *L, ULong *bits, Long exp, int k) -#endif -{ - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = L[3] = 0; - break; - - case STRTOG_Normal: - case STRTOG_NaNbits: - L[_3] = bits[0]; - L[_2] = bits[1]; - L[_1] = bits[2]; - L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16); - break; - - case STRTOG_Denormal: - L[_3] = bits[0]; - L[_2] = bits[1]; - L[_1] = bits[2]; - L[_0] = bits[3]; - break; - - case STRTOG_Infinite: - L[_0] = 0x7fff0000; - L[_1] = L[_2] = L[_3] = 0; - break; - - case STRTOG_NaN: - L[0] = ld_QNAN0; - L[1] = ld_QNAN1; - L[2] = ld_QNAN2; - L[3] = ld_QNAN3; - } - if (k & STRTOG_Neg) - L[_0] |= 0x80000000L; - } - - int -#ifdef KR_headers -strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L; -#else -strtorQ(CONST char *s, char **sp, int rounding, void *L) -#endif -{ - static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI }; - FPI *fpi, fpi1; - ULong bits[4]; - Long exp; - int k; - - fpi = &fpi0; - if (rounding != FPI_Round_near) { - fpi1 = fpi0; - fpi1.rounding = rounding; - fpi = &fpi1; - } - k = strtodg(s, sp, fpi, &exp, bits); - ULtoQ((ULong*)L, bits, exp, k); - return k; - } diff --git a/contrib/gdtoa/strtordd.c b/contrib/gdtoa/strtordd.c deleted file mode 100644 index e0b8e6a23f..0000000000 --- a/contrib/gdtoa/strtordd.c +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - void -#ifdef KR_headers -ULtodd(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k; -#else -ULtodd(ULong *L, ULong *bits, Long exp, int k) -#endif -{ - int i, j; - - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = L[3] = 0; - break; - - case STRTOG_Normal: - L[_1] = (bits[1] >> 21 | bits[2] << 11) & (ULong)0xffffffffL; - L[_0] = (bits[2] >> 21) | (bits[3] << 11 & 0xfffff) - | ((exp + 0x3ff + 105) << 20); - exp += 0x3ff + 52; - if (bits[1] &= 0x1fffff) { - i = hi0bits(bits[1]) - 11; - if (i >= exp) { - i = exp - 1; - exp = 0; - } - else - exp -= i; - if (i > 0) { - bits[1] = bits[1] << i | bits[0] >> (32-i); - bits[0] = bits[0] << i & (ULong)0xffffffffL; - } - } - else if (bits[0]) { - i = hi0bits(bits[0]) + 21; - if (i >= exp) { - i = exp - 1; - exp = 0; - } - else - exp -= i; - if (i < 32) { - bits[1] = bits[0] >> (32 - i); - bits[0] = bits[0] << i & (ULong)0xffffffffL; - } - else { - bits[1] = bits[0] << (i - 32); - bits[0] = 0; - } - } - else { - L[2] = L[3] = 0; - break; - } - L[2+_1] = bits[0]; - L[2+_0] = (bits[1] & 0xfffff) | (exp << 20); - break; - - case STRTOG_Denormal: - if (bits[3]) - goto nearly_normal; - if (bits[2]) - goto partly_normal; - if (bits[1] & 0xffe00000) - goto hardly_normal; - /* completely denormal */ - L[2] = L[3] = 0; - L[_1] = bits[0]; - L[_0] = bits[1]; - break; - - nearly_normal: - i = hi0bits(bits[3]) - 11; /* i >= 12 */ - j = 32 - i; - L[_0] = ((bits[3] << i | bits[2] >> j) & 0xfffff) - | ((65 - i) << 20); - L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - L[2+_0] = bits[1] & (((ULong)1L << j) - 1); - L[2+_1] = bits[0]; - break; - - partly_normal: - i = hi0bits(bits[2]) - 11; - if (i < 0) { - j = -i; - i += 32; - L[_0] = (bits[2] >> j & 0xfffff) | ((33 + j) << 20); - L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - L[2+_0] = bits[1] & (((ULong)1L << j) - 1); - L[2+_1] = bits[0]; - break; - } - if (i == 0) { - L[_0] = (bits[2] & 0xfffff) | (33 << 20); - L[_1] = bits[1]; - L[2+_0] = 0; - L[2+_1] = bits[0]; - break; - } - j = 32 - i; - L[_0] = (((bits[2] << i) | (bits[1] >> j)) & 0xfffff) - | ((j + 1) << 20); - L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; - L[2+_0] = 0; - L[2+_1] = bits[0] & ((1L << j) - 1); - break; - - hardly_normal: - j = 11 - hi0bits(bits[1]); - i = 32 - j; - L[_0] = (bits[1] >> j & 0xfffff) | ((j + 1) << 20); - L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; - L[2+_0] = 0; - L[2+_1] = bits[0] & (((ULong)1L << j) - 1); - break; - - case STRTOG_Infinite: - L[_0] = L[2+_0] = 0x7ff00000; - L[_1] = L[2+_1] = 0; - break; - - case STRTOG_NaN: - L[0] = L[2] = d_QNAN0; - L[1] = L[3] = d_QNAN1; - break; - - case STRTOG_NaNbits: - L[_1] = (bits[1] >> 21 | bits[2] << 11) & (ULong)0xffffffffL; - L[_0] = bits[2] >> 21 | bits[3] << 11 - | (ULong)0x7ff00000L; - L[2+_1] = bits[0]; - L[2+_0] = bits[1] | (ULong)0x7ff00000L; - } - if (k & STRTOG_Neg) { - L[_0] |= 0x80000000L; - L[2+_0] |= 0x80000000L; - } - } - - int -#ifdef KR_headers -strtordd(s, sp, rounding, dd) CONST char *s; char **sp; int rounding; double *dd; -#else -strtordd(CONST char *s, char **sp, int rounding, double *dd) -#endif -{ -#ifdef Sudden_Underflow - static FPI fpi0 = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; -#else - static FPI fpi0 = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; -#endif - FPI *fpi, fpi1; - ULong bits[4]; - Long exp; - int k; - - fpi = &fpi0; - if (rounding != FPI_Round_near) { - fpi1 = fpi0; - fpi1.rounding = rounding; - fpi = &fpi1; - } - k = strtodg(s, sp, fpi, &exp, bits); - ULtodd((ULong*)dd, bits, exp, k); - return k; - } diff --git a/contrib/gdtoa/strtorf.c b/contrib/gdtoa/strtorf.c deleted file mode 100644 index 21c6d28b88..0000000000 --- a/contrib/gdtoa/strtorf.c +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - - void -#ifdef KR_headers -ULtof(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k; -#else -ULtof(ULong *L, ULong *bits, Long exp, int k) -#endif -{ - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - *L = 0; - break; - - case STRTOG_Normal: - case STRTOG_NaNbits: - L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); - break; - - case STRTOG_Denormal: - L[0] = bits[0]; - break; - - case STRTOG_Infinite: - L[0] = 0x7f800000; - break; - - case STRTOG_NaN: - L[0] = f_QNAN; - } - if (k & STRTOG_Neg) - L[0] |= 0x80000000L; - } - - int -#ifdef KR_headers -strtorf(s, sp, rounding, f) CONST char *s; char **sp; int rounding; float *f; -#else -strtorf(CONST char *s, char **sp, int rounding, float *f) -#endif -{ - static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; - FPI *fpi, fpi1; - ULong bits[1]; - Long exp; - int k; - - fpi = &fpi0; - if (rounding != FPI_Round_near) { - fpi1 = fpi0; - fpi1.rounding = rounding; - fpi = &fpi1; - } - k = strtodg(s, sp, fpi, &exp, bits); - ULtof((ULong*)f, bits, exp, k); - return k; - } diff --git a/contrib/gdtoa/strtorxL.c b/contrib/gdtoa/strtorxL.c deleted file mode 100644 index 58acc80855..0000000000 --- a/contrib/gdtoa/strtorxL.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2000 by Lucent Technologies -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of Lucent or any of its entities -not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - -****************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -#include "gdtoaimp.h" - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#endif -#ifdef IEEE_8087 -#define _0 2 -#define _1 1 -#define _2 0 -#endif - - void -#ifdef KR_headers -ULtoxL(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k; -#else -ULtoxL(ULong *L, ULong *bits, Long exp, int k) -#endif -{ - switch(k & STRTOG_Retmask) { - case STRTOG_NoNumber: - case STRTOG_Zero: - L[0] = L[1] = L[2] = 0; - break; - - case STRTOG_Normal: - case STRTOG_Denormal: - case STRTOG_NaNbits: - L[_0] = (exp + 0x3fff + 63) << 16; - L[_1] = bits[1]; - L[_2] = bits[0]; - break; - - case STRTOG_Infinite: - L[_0] = 0x7fff << 16; - L[_1] = 0x80000000; - L[_2] = 0; - break; - - case STRTOG_NaN: - L[0] = ld_QNAN0; - L[1] = ld_QNAN1; - L[2] = ld_QNAN2; - } - if (k & STRTOG_Neg) - L[_0] |= 0x80000000L; - } - - int -#ifdef KR_headers -strtorxL(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L; -#else -strtorxL(CONST char *s, char **sp, int rounding, void *L) -#endif -{ - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; - FPI *fpi, fpi1; - ULong bits[2]; - Long exp; - int k; - - fpi = &fpi0; - if (rounding != FPI_Round_near) { - fpi1 = fpi0; - fpi1.rounding = rounding; - fpi = &fpi1; - } - k = strtodg(s, sp, fpi, &exp, bits); - ULtoxL((ULong*)L, bits, exp, k); - return k; - } -- 2.41.0