| File: | wsutil/dtoa.c |
| Warning: | line 3282, column 11 Although the value stored to 'ureslo' is used in the enclosing expression, the value is never actually read from 'ureslo' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /**************************************************************** |
| 2 | * |
| 3 | * The author of this software is David M. Gay. |
| 4 | * |
| 5 | * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. |
| 6 | * |
| 7 | * Permission to use, copy, modify, and distribute this software for any |
| 8 | * purpose without fee is hereby granted, provided that this entire notice |
| 9 | * is included in all copies of any software which is or includes a copy |
| 10 | * or modification of this software and in all copies of the supporting |
| 11 | * documentation for such software. |
| 12 | * |
| 13 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED |
| 14 | * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY |
| 15 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY |
| 16 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. |
| 17 | * |
| 18 | ***************************************************************/ |
| 19 | |
| 20 | /* Please send bug reports to David M. Gay (dmg at acm dot org, |
| 21 | * with " at " changed at "@" and " dot " changed to "."). */ |
| 22 | |
| 23 | /* On a machine with IEEE extended-precision registers, it is |
| 24 | * necessary to specify double-precision (53-bit) rounding precision |
| 25 | * before invoking strtod or dtoa. If the machine uses (the equivalent |
| 26 | * of) Intel 80x87 arithmetic, the call |
| 27 | * _control87(PC_53, MCW_PC); |
| 28 | * does this with many compilers. Whether this or another call is |
| 29 | * appropriate depends on the compiler; for this to work, it may be |
| 30 | * necessary to #include "float.h" or another system-dependent header |
| 31 | * file. When needed, this call avoids double rounding, which can |
| 32 | * cause one bit errors, e.g., with strtod on 8.3e26 or 6.3876e-16. |
| 33 | */ |
| 34 | |
| 35 | /* strtod for IEEE-, VAX-, and IBM-arithmetic machines. |
| 36 | * (Note that IEEE arithmetic is disabled by gcc's -ffast-math flag.) |
| 37 | * |
| 38 | * This strtod returns a nearest machine number to the input decimal |
| 39 | * string (or sets errno to ERANGE). With IEEE arithmetic, ties are |
| 40 | * broken by the IEEE round-even rule. Otherwise ties are broken by |
| 41 | * biased rounding (add half and chop). |
| 42 | * |
| 43 | * Inspired loosely by William D. Clinger's paper "How to Read Floating |
| 44 | * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. |
| 45 | * |
| 46 | * Modifications: |
| 47 | * |
| 48 | * 1. We only require IEEE, IBM, or VAX double-precision |
| 49 | * arithmetic (not IEEE double-extended). |
| 50 | * 2. We get by with floating-point arithmetic in a case that |
| 51 | * Clinger missed -- when we're computing d * 10^n |
| 52 | * for a small integer d and the integer n is not too |
| 53 | * much larger than 22 (the maximum integer k for which |
| 54 | * we can represent 10^k exactly), we may be able to |
| 55 | * compute (d*10^k) * 10^(e-k) with just one roundoff. |
| 56 | * 3. Rather than a bit-at-a-time adjustment of the binary |
| 57 | * result in the hard case, we use floating-point |
| 58 | * arithmetic to determine the adjustment to within |
| 59 | * one bit; only in really hard cases do we need to |
| 60 | * compute a second residual. |
| 61 | * 4. Because of 3., we don't need a large table of powers of 10 |
| 62 | * for ten-to-e (just some small tables, e.g. of 10^k |
| 63 | * for 0 <= k <= 22). |
| 64 | */ |
| 65 | |
| 66 | /* |
| 67 | * #define IEEE_8087 for IEEE-arithmetic machines where the least |
| 68 | * significant byte has the lowest address. |
| 69 | * #define IEEE_MC68k for IEEE-arithmetic machines where the most |
| 70 | * significant byte has the lowest address. |
| 71 | * #define Long int on machines with 32-bit ints and 64-bit longs. |
| 72 | * #define IBM for IBM mainframe-style floating-point arithmetic. |
| 73 | * #define VAX for VAX-style floating-point arithmetic (D_floating). |
| 74 | * #define No_leftright to omit left-right logic in fast floating-point |
| 75 | * computation of dtoa. This will cause dtoa modes 4 and 5 to be |
| 76 | * treated the same as modes 2 and 3 for some inputs. |
| 77 | * #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 |
| 78 | * and strtod and dtoa should round accordingly. Unless Trust_FLT_ROUNDS |
| 79 | * is also #defined, fegetround() will be queried for the rounding mode. |
| 80 | * Note that both FLT_ROUNDS and fegetround() are specified by the C99 |
| 81 | * standard (and are specified to be consistent, with fesetround() |
| 82 | * affecting the value of FLT_ROUNDS), but that some (Linux) systems |
| 83 | * do not work correctly in this regard, so using fegetround() is more |
| 84 | * portable than using FLT_ROUNDS directly. |
| 85 | * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 |
| 86 | * and Honor_FLT_ROUNDS is not #defined. |
| 87 | * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines |
| 88 | * that use extended-precision instructions to compute rounded |
| 89 | * products and quotients) with IBM. |
| 90 | * #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic |
| 91 | * that rounds toward +Infinity. |
| 92 | * #define ROUND_BIASED_without_Round_Up for IEEE-format with biased |
| 93 | * rounding when the underlying floating-point arithmetic uses |
| 94 | * unbiased rounding. This prevent using ordinary floating-point |
| 95 | * arithmetic when the result could be computed with one rounding error. |
| 96 | * #define Inaccurate_Divide for IEEE-format with correctly rounded |
| 97 | * products but inaccurate quotients, e.g., for Intel i860. |
| 98 | * #define NO_LONG_LONG on machines that do not have a "long long" |
| 99 | * integer type (of >= 64 bits). On such machines, you can |
| 100 | * #define Just_16 to store 16 bits per 32-bit Long when doing |
| 101 | * high-precision integer arithmetic. Whether this speeds things |
| 102 | * up or slows things down depends on the machine and the number |
| 103 | * being converted. If long long is available and the name is |
| 104 | * something other than "long long", #define Llong to be the name, |
| 105 | * and if "unsigned Llong" does not work as an unsigned version of |
| 106 | * Llong, #define #ULLong to be the corresponding unsigned type. |
| 107 | * #define Bad_float_h if your system lacks a float.h or if it does not |
| 108 | * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, |
| 109 | * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. |
| 110 | * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) |
| 111 | * if memory is available and otherwise does something you deem |
| 112 | * appropriate. If MALLOC is undefined, malloc will be invoked |
| 113 | * directly -- and assumed always to succeed. Similarly, if you |
| 114 | * want something other than the system's free() to be called to |
| 115 | * recycle memory acquired from MALLOC, #define FREE to be the |
| 116 | * name of the alternate routine. (FREE or free is only called in |
| 117 | * pathological cases, e.g., in a dtoa call after a dtoa return in |
| 118 | * mode 3 with thousands of digits requested.) |
| 119 | * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making |
| 120 | * memory allocations from a private pool of memory when possible. |
| 121 | * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, |
| 122 | * unless #defined to be a different length. This default length |
| 123 | * suffices to get rid of MALLOC calls except for unusual cases, |
| 124 | * such as decimal-to-binary conversion of a very long string of |
| 125 | * digits. The longest string dtoa can return is about 751 bytes |
| 126 | * long. For conversions by strtod of strings of 800 digits and |
| 127 | * all dtoa conversions in single-threaded executions with 8-byte |
| 128 | * pointers, PRIVATE_MEM >= 7400 appears to suffice; with 4-byte |
| 129 | * pointers, PRIVATE_MEM >= 7112 appears adequate. |
| 130 | * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK |
| 131 | * #defined automatically on IEEE systems. On such systems, |
| 132 | * when INFNAN_CHECK is #defined, strtod checks |
| 133 | * for Infinity and NaN (case insensitively). On some systems |
| 134 | * (e.g., some HP systems), it may be necessary to #define NAN_WORD0 |
| 135 | * appropriately -- to the most significant word of a quiet NaN. |
| 136 | * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) |
| 137 | * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, |
| 138 | * strtod also accepts (case insensitively) strings of the form |
| 139 | * NaN(x), where x is a string of hexadecimal digits and spaces; |
| 140 | * if there is only one string of hexadecimal digits, it is taken |
| 141 | * for the 52 fraction bits of the resulting NaN; if there are two |
| 142 | * or more strings of hex digits, the first is for the high 20 bits, |
| 143 | * the second and subsequent for the low 32 bits, with intervening |
| 144 | * white space ignored; but if this results in none of the 52 |
| 145 | * fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0 |
| 146 | * and NAN_WORD1 are used instead. |
| 147 | * #define MULTIPLE_THREADS if the system offers preemptively scheduled |
| 148 | * multiple threads. In this case, you must provide (or suitably |
| 149 | * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed |
| 150 | * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed |
| 151 | * in pow5mult, ensures lazy evaluation of only one copy of high |
| 152 | * powers of 5; omitting this lock would introduce a small |
| 153 | * probability of wasting memory, but would otherwise be harmless.) |
| 154 | * You must also invoke freedtoa(s) to free the value s returned by |
| 155 | * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. |
| 156 | |
| 157 | * When MULTIPLE_THREADS is #defined, this source file provides |
| 158 | * void set_max_dtoa_threads(unsigned int n); |
| 159 | * and expects |
| 160 | * unsigned int dtoa_get_threadno(void); |
| 161 | * to be available (possibly provided by |
| 162 | * #define dtoa_get_threadno omp_get_thread_num |
| 163 | * if OpenMP is in use or by |
| 164 | * #define dtoa_get_threadno pthread_self |
| 165 | * if Pthreads is in use), to return the current thread number. |
| 166 | * If set_max_dtoa_threads(n) was called and the current thread |
| 167 | * number is k with k < n, then calls on ACQUIRE_DTOA_LOCK(...) and |
| 168 | * FREE_DTOA_LOCK(...) are avoided; instead each thread with thread |
| 169 | * number < n has a separate copy of relevant data structures. |
| 170 | * After set_max_dtoa_threads(n), a call set_max_dtoa_threads(m) |
| 171 | * with m <= n has has no effect, but a call with m > n is honored. |
| 172 | * Such a call invokes REALLOC (assumed to be "realloc" if REALLOC |
| 173 | * is not #defined) to extend the size of the relevant array. |
| 174 | |
| 175 | * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that |
| 176 | * avoids underflows on inputs whose result does not underflow. |
| 177 | * If you #define NO_IEEE_Scale on a machine that uses IEEE-format |
| 178 | * floating-point numbers and flushes underflows to zero rather |
| 179 | * than implementing gradual underflow, then you must also #define |
| 180 | * Sudden_Underflow. |
| 181 | * #define USE_LOCALE to use the current locale's decimal_point value. |
| 182 | * #define SET_INEXACT if IEEE arithmetic is being used and extra |
| 183 | * computation should be done to set the inexact flag when the |
| 184 | * result is inexact and avoid setting inexact when the result |
| 185 | * is exact. In this case, dtoa.c must be compiled in |
| 186 | * an environment, perhaps provided by #include "dtoa.c" in a |
| 187 | * suitable wrapper, that defines two functions, |
| 188 | * int get_inexact(void); |
| 189 | * void clear_inexact(void); |
| 190 | * such that get_inexact() returns a nonzero value if the |
| 191 | * inexact bit is already set, and clear_inexact() sets the |
| 192 | * inexact bit to 0. When SET_INEXACT is #defined, strtod |
| 193 | * also does extra computations to set the underflow and overflow |
| 194 | * flags when appropriate (i.e., when the result is tiny and |
| 195 | * inexact or when it is a numeric value rounded to +-infinity). |
| 196 | * #define NO_ERRNO if strtod should not assign errno = ERANGE when |
| 197 | * the result overflows to +-Infinity or underflows to 0. |
| 198 | * When errno should be assigned, under seemingly rare conditions |
| 199 | * it may be necessary to define Set_errno(x) suitably, e.g., in |
| 200 | * a local errno.h, such as |
| 201 | * #include <errno.h> |
| 202 | * #define Set_errno(x) _set_errno(x) |
| 203 | * #define NO_HEX_FP to omit recognition of hexadecimal floating-point |
| 204 | * values by strtod. |
| 205 | * #define NO_STRTOD_BIGCOMP (on IEEE-arithmetic systems only for now) |
| 206 | * to disable logic for "fast" testing of very long input strings |
| 207 | * to strtod. This testing proceeds by initially truncating the |
| 208 | * input string, then if necessary comparing the whole string with |
| 209 | * a decimal expansion to decide close cases. This logic is only |
| 210 | * used for input more than STRTOD_DIGLIM digits long (default 40). |
| 211 | */ |
| 212 | |
| 213 | /* Begin Wireshark defines and includes */ |
| 214 | #include <wireshark.h> |
| 215 | #include "dtoa.h" |
| 216 | |
| 217 | #if G_BYTE_ORDER1234 == G_LITTLE_ENDIAN1234 |
| 218 | #define IEEE_8087 |
| 219 | #elif G_BYTE_ORDER1234 == G_BIG_ENDIAN4321 |
| 220 | #define IEEE_MC68k |
| 221 | #else |
| 222 | #error "Unsupported byte order" |
| 223 | #endif |
| 224 | |
| 225 | #define MALLOCg_malloc g_malloc |
| 226 | #define REALLOCg_realloc g_realloc |
| 227 | #define FREEg_free g_free |
| 228 | |
| 229 | typedef int32_t Longint; |
| 230 | typedef uint32_t ULong; |
| 231 | typedef uint64_t ULLongunsigned long long; |
| 232 | |
| 233 | #define NO_HEX_FP |
| 234 | |
| 235 | #ifdef _MSC_VER |
| 236 | /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */ |
| 237 | #pragma warning(disable:4146) |
| 238 | #endif |
| 239 | |
| 240 | /* End Wireshark defines and includes */ |
| 241 | |
| 242 | #ifndef Longint |
| 243 | #define Longint int |
| 244 | #endif |
| 245 | #ifndef ULong |
| 246 | typedef unsigned Longint ULong; |
| 247 | #endif |
| 248 | |
| 249 | #ifdef DEBUG |
| 250 | #include <assert.h> |
| 251 | #include "stdio.h" |
| 252 | #define Bug(x) {ws_error("%s", x)ws_log_fatal_full("", LOG_LEVEL_ERROR, "wsutil/dtoa.c", 252, __func__ , "%s", x);} |
| 253 | #define Debug(x) x |
| 254 | int dtoa_stats[7]; /* strtod_{64,96,bigcomp},dtoa_{exact,64,96,bigcomp} */ |
| 255 | #else |
| 256 | #define assert(x) /*nothing*/ |
| 257 | #define Debug(x) /*nothing*/ |
| 258 | #endif |
| 259 | |
| 260 | #include "stdlib.h" |
| 261 | #include "string.h" |
| 262 | |
| 263 | #ifdef USE_LOCALE |
| 264 | #include "locale.h" |
| 265 | #endif |
| 266 | |
| 267 | #ifdef Honor_FLT_ROUNDS |
| 268 | #ifndef Trust_FLT_ROUNDS |
| 269 | #include <fenv.h> |
| 270 | #endif |
| 271 | #endif |
| 272 | |
| 273 | #ifndef Omit_Private_Memory |
| 274 | #ifndef PRIVATE_MEM2304 |
| 275 | #define PRIVATE_MEM2304 2304 |
| 276 | #endif |
| 277 | #define PRIVATE_mem((2304 +sizeof(double)-1)/sizeof(double)) ((PRIVATE_MEM2304+sizeof(double)-1)/sizeof(double)) |
| 278 | static double private_mem[PRIVATE_mem((2304 +sizeof(double)-1)/sizeof(double))], *pmem_next = private_mem; |
| 279 | #endif |
| 280 | |
| 281 | #undef IEEE_Arith |
| 282 | #undef Avoid_Underflow |
| 283 | #ifdef IEEE_MC68k |
| 284 | #define IEEE_Arith |
| 285 | #endif |
| 286 | #ifdef IEEE_8087 |
| 287 | #define IEEE_Arith |
| 288 | #endif |
| 289 | |
| 290 | #ifdef IEEE_Arith |
| 291 | #ifndef NO_INFNAN_CHECK |
| 292 | #undef INFNAN_CHECK |
| 293 | #define INFNAN_CHECK |
| 294 | #endif |
| 295 | #else |
| 296 | #undef INFNAN_CHECK |
| 297 | #define NO_STRTOD_BIGCOMP |
| 298 | #endif |
| 299 | |
| 300 | #include "errno.h" |
| 301 | |
| 302 | #ifdef NO_ERRNO /*{*/ |
| 303 | #undef Set_errno |
| 304 | #define Set_errno(x)(*__errno_location ()) = x |
| 305 | #else |
| 306 | #ifndef Set_errno |
| 307 | #define Set_errno(x)(*__errno_location ()) = x errno(*__errno_location ()) = x |
| 308 | #endif |
| 309 | #endif /*}*/ |
| 310 | |
| 311 | #ifdef Bad_float_h |
| 312 | |
| 313 | #ifdef IEEE_Arith |
| 314 | #define DBL_DIG15 15 |
| 315 | #define DBL_MAX_10_EXP308 308 |
| 316 | #define DBL_MAX_EXP1024 1024 |
| 317 | #define FLT_RADIX2 2 |
| 318 | #endif /*IEEE_Arith*/ |
| 319 | |
| 320 | #ifdef IBM |
| 321 | #define DBL_DIG15 16 |
| 322 | #define DBL_MAX_10_EXP308 75 |
| 323 | #define DBL_MAX_EXP1024 63 |
| 324 | #define FLT_RADIX2 16 |
| 325 | #define DBL_MAX1.7976931348623157e+308 7.2370055773322621e+75 |
| 326 | #endif |
| 327 | |
| 328 | #ifdef VAX |
| 329 | #define DBL_DIG15 16 |
| 330 | #define DBL_MAX_10_EXP308 38 |
| 331 | #define DBL_MAX_EXP1024 127 |
| 332 | #define FLT_RADIX2 2 |
| 333 | #define DBL_MAX1.7976931348623157e+308 1.7014118346046923e+38 |
| 334 | #endif |
| 335 | |
| 336 | #ifndef LONG_MAX9223372036854775807L |
| 337 | #define LONG_MAX9223372036854775807L 2147483647 |
| 338 | #endif |
| 339 | |
| 340 | #else /* ifndef Bad_float_h */ |
| 341 | #include "float.h" |
| 342 | #endif /* Bad_float_h */ |
| 343 | |
| 344 | #ifndef __MATH_H__ |
| 345 | #include "math.h" |
| 346 | #endif |
| 347 | |
| 348 | #ifdef __cplusplus |
| 349 | extern "C" { |
| 350 | #endif |
| 351 | |
| 352 | #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 |
| 353 | Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. |
| 354 | #endif |
| 355 | |
| 356 | #undef USE_BF96 |
| 357 | |
| 358 | #ifdef NO_LONG_LONG /*{{*/ |
| 359 | #undef ULLongunsigned long long |
| 360 | #ifdef Just_16 |
| 361 | #undef Pack_32 |
| 362 | /* When Pack_32 is not defined, we store 16 bits per 32-bit Long. |
| 363 | * This makes some inner loops simpler and sometimes saves work |
| 364 | * during multiplications, but it often seems to make things slightly |
| 365 | * slower. Hence the default is now to store 32 bits per Long. |
| 366 | */ |
| 367 | #endif |
| 368 | #else /*}{ long long available */ |
| 369 | #ifndef Llonglong long |
| 370 | #define Llonglong long long long |
| 371 | #endif |
| 372 | #ifndef ULLongunsigned long long |
| 373 | #define ULLongunsigned long long unsigned Llonglong long |
| 374 | #endif |
| 375 | #ifndef NO_BF96 /*{*/ |
| 376 | #define USE_BF96 |
| 377 | |
| 378 | #ifdef SET_INEXACT |
| 379 | #define dtoa_divmax 27 |
| 380 | #else |
| 381 | static const int dtoa_divmax = 2; |
| 382 | /* Permit experimenting: on some systems, 64-bit integer */ |
| 383 | /* division is slow enough that we may sometimes want to */ |
| 384 | /* avoid using it. We assume (but do not check) that */ |
| 385 | /* dtoa_divmax <= 27.*/ |
| 386 | #endif |
| 387 | |
| 388 | typedef struct BF96 { /* Normalized 96-bit software floating point numbers */ |
| 389 | unsigned int b0,b1,b2; /* b0 = most significant, binary point just to its left */ |
| 390 | int e; /* number represented = b * 2^e, with .5 <= b < 1 */ |
| 391 | } BF96; |
| 392 | |
| 393 | static const BF96 pten[667] = { |
| 394 | { 0xeef453d6, 0x923bd65a, 0x113faa29, -1136 }, |
| 395 | { 0x9558b466, 0x1b6565f8, 0x4ac7ca59, -1132 }, |
| 396 | { 0xbaaee17f, 0xa23ebf76, 0x5d79bcf0, -1129 }, |
| 397 | { 0xe95a99df, 0x8ace6f53, 0xf4d82c2c, -1126 }, |
| 398 | { 0x91d8a02b, 0xb6c10594, 0x79071b9b, -1122 }, |
| 399 | { 0xb64ec836, 0xa47146f9, 0x9748e282, -1119 }, |
| 400 | { 0xe3e27a44, 0x4d8d98b7, 0xfd1b1b23, -1116 }, |
| 401 | { 0x8e6d8c6a, 0xb0787f72, 0xfe30f0f5, -1112 }, |
| 402 | { 0xb208ef85, 0x5c969f4f, 0xbdbd2d33, -1109 }, |
| 403 | { 0xde8b2b66, 0xb3bc4723, 0xad2c7880, -1106 }, |
| 404 | { 0x8b16fb20, 0x3055ac76, 0x4c3bcb50, -1102 }, |
| 405 | { 0xaddcb9e8, 0x3c6b1793, 0xdf4abe24, -1099 }, |
| 406 | { 0xd953e862, 0x4b85dd78, 0xd71d6dad, -1096 }, |
| 407 | { 0x87d4713d, 0x6f33aa6b, 0x8672648c, -1092 }, |
| 408 | { 0xa9c98d8c, 0xcb009506, 0x680efdaf, -1089 }, |
| 409 | { 0xd43bf0ef, 0xfdc0ba48, 0x0212bd1b, -1086 }, |
| 410 | { 0x84a57695, 0xfe98746d, 0x014bb630, -1082 }, |
| 411 | { 0xa5ced43b, 0x7e3e9188, 0x419ea3bd, -1079 }, |
| 412 | { 0xcf42894a, 0x5dce35ea, 0x52064cac, -1076 }, |
| 413 | { 0x818995ce, 0x7aa0e1b2, 0x7343efeb, -1072 }, |
| 414 | { 0xa1ebfb42, 0x19491a1f, 0x1014ebe6, -1069 }, |
| 415 | { 0xca66fa12, 0x9f9b60a6, 0xd41a26e0, -1066 }, |
| 416 | { 0xfd00b897, 0x478238d0, 0x8920b098, -1063 }, |
| 417 | { 0x9e20735e, 0x8cb16382, 0x55b46e5f, -1059 }, |
| 418 | { 0xc5a89036, 0x2fddbc62, 0xeb2189f7, -1056 }, |
| 419 | { 0xf712b443, 0xbbd52b7b, 0xa5e9ec75, -1053 }, |
| 420 | { 0x9a6bb0aa, 0x55653b2d, 0x47b233c9, -1049 }, |
| 421 | { 0xc1069cd4, 0xeabe89f8, 0x999ec0bb, -1046 }, |
| 422 | { 0xf148440a, 0x256e2c76, 0xc00670ea, -1043 }, |
| 423 | { 0x96cd2a86, 0x5764dbca, 0x38040692, -1039 }, |
| 424 | { 0xbc807527, 0xed3e12bc, 0xc6050837, -1036 }, |
| 425 | { 0xeba09271, 0xe88d976b, 0xf7864a44, -1033 }, |
| 426 | { 0x93445b87, 0x31587ea3, 0x7ab3ee6a, -1029 }, |
| 427 | { 0xb8157268, 0xfdae9e4c, 0x5960ea05, -1026 }, |
| 428 | { 0xe61acf03, 0x3d1a45df, 0x6fb92487, -1023 }, |
| 429 | { 0x8fd0c162, 0x06306bab, 0xa5d3b6d4, -1019 }, |
| 430 | { 0xb3c4f1ba, 0x87bc8696, 0x8f48a489, -1016 }, |
| 431 | { 0xe0b62e29, 0x29aba83c, 0x331acdab, -1013 }, |
| 432 | { 0x8c71dcd9, 0xba0b4925, 0x9ff0c08b, -1009 }, |
| 433 | { 0xaf8e5410, 0x288e1b6f, 0x07ecf0ae, -1006 }, |
| 434 | { 0xdb71e914, 0x32b1a24a, 0xc9e82cd9, -1003 }, |
| 435 | { 0x892731ac, 0x9faf056e, 0xbe311c08, -999 }, |
| 436 | { 0xab70fe17, 0xc79ac6ca, 0x6dbd630a, -996 }, |
| 437 | { 0xd64d3d9d, 0xb981787d, 0x092cbbcc, -993 }, |
| 438 | { 0x85f04682, 0x93f0eb4e, 0x25bbf560, -989 }, |
| 439 | { 0xa76c5823, 0x38ed2621, 0xaf2af2b8, -986 }, |
| 440 | { 0xd1476e2c, 0x07286faa, 0x1af5af66, -983 }, |
| 441 | { 0x82cca4db, 0x847945ca, 0x50d98d9f, -979 }, |
| 442 | { 0xa37fce12, 0x6597973c, 0xe50ff107, -976 }, |
| 443 | { 0xcc5fc196, 0xfefd7d0c, 0x1e53ed49, -973 }, |
| 444 | { 0xff77b1fc, 0xbebcdc4f, 0x25e8e89c, -970 }, |
| 445 | { 0x9faacf3d, 0xf73609b1, 0x77b19161, -966 }, |
| 446 | { 0xc795830d, 0x75038c1d, 0xd59df5b9, -963 }, |
| 447 | { 0xf97ae3d0, 0xd2446f25, 0x4b057328, -960 }, |
| 448 | { 0x9becce62, 0x836ac577, 0x4ee367f9, -956 }, |
| 449 | { 0xc2e801fb, 0x244576d5, 0x229c41f7, -953 }, |
| 450 | { 0xf3a20279, 0xed56d48a, 0x6b435275, -950 }, |
| 451 | { 0x9845418c, 0x345644d6, 0x830a1389, -946 }, |
| 452 | { 0xbe5691ef, 0x416bd60c, 0x23cc986b, -943 }, |
| 453 | { 0xedec366b, 0x11c6cb8f, 0x2cbfbe86, -940 }, |
| 454 | { 0x94b3a202, 0xeb1c3f39, 0x7bf7d714, -936 }, |
| 455 | { 0xb9e08a83, 0xa5e34f07, 0xdaf5ccd9, -933 }, |
| 456 | { 0xe858ad24, 0x8f5c22c9, 0xd1b3400f, -930 }, |
| 457 | { 0x91376c36, 0xd99995be, 0x23100809, -926 }, |
| 458 | { 0xb5854744, 0x8ffffb2d, 0xabd40a0c, -923 }, |
| 459 | { 0xe2e69915, 0xb3fff9f9, 0x16c90c8f, -920 }, |
| 460 | { 0x8dd01fad, 0x907ffc3b, 0xae3da7d9, -916 }, |
| 461 | { 0xb1442798, 0xf49ffb4a, 0x99cd11cf, -913 }, |
| 462 | { 0xdd95317f, 0x31c7fa1d, 0x40405643, -910 }, |
| 463 | { 0x8a7d3eef, 0x7f1cfc52, 0x482835ea, -906 }, |
| 464 | { 0xad1c8eab, 0x5ee43b66, 0xda324365, -903 }, |
| 465 | { 0xd863b256, 0x369d4a40, 0x90bed43e, -900 }, |
| 466 | { 0x873e4f75, 0xe2224e68, 0x5a7744a6, -896 }, |
| 467 | { 0xa90de353, 0x5aaae202, 0x711515d0, -893 }, |
| 468 | { 0xd3515c28, 0x31559a83, 0x0d5a5b44, -890 }, |
| 469 | { 0x8412d999, 0x1ed58091, 0xe858790a, -886 }, |
| 470 | { 0xa5178fff, 0x668ae0b6, 0x626e974d, -883 }, |
| 471 | { 0xce5d73ff, 0x402d98e3, 0xfb0a3d21, -880 }, |
| 472 | { 0x80fa687f, 0x881c7f8e, 0x7ce66634, -876 }, |
| 473 | { 0xa139029f, 0x6a239f72, 0x1c1fffc1, -873 }, |
| 474 | { 0xc9874347, 0x44ac874e, 0xa327ffb2, -870 }, |
| 475 | { 0xfbe91419, 0x15d7a922, 0x4bf1ff9f, -867 }, |
| 476 | { 0x9d71ac8f, 0xada6c9b5, 0x6f773fc3, -863 }, |
| 477 | { 0xc4ce17b3, 0x99107c22, 0xcb550fb4, -860 }, |
| 478 | { 0xf6019da0, 0x7f549b2b, 0x7e2a53a1, -857 }, |
| 479 | { 0x99c10284, 0x4f94e0fb, 0x2eda7444, -853 }, |
| 480 | { 0xc0314325, 0x637a1939, 0xfa911155, -850 }, |
| 481 | { 0xf03d93ee, 0xbc589f88, 0x793555ab, -847 }, |
| 482 | { 0x96267c75, 0x35b763b5, 0x4bc1558b, -843 }, |
| 483 | { 0xbbb01b92, 0x83253ca2, 0x9eb1aaed, -840 }, |
| 484 | { 0xea9c2277, 0x23ee8bcb, 0x465e15a9, -837 }, |
| 485 | { 0x92a1958a, 0x7675175f, 0x0bfacd89, -833 }, |
| 486 | { 0xb749faed, 0x14125d36, 0xcef980ec, -830 }, |
| 487 | { 0xe51c79a8, 0x5916f484, 0x82b7e127, -827 }, |
| 488 | { 0x8f31cc09, 0x37ae58d2, 0xd1b2ecb8, -823 }, |
| 489 | { 0xb2fe3f0b, 0x8599ef07, 0x861fa7e6, -820 }, |
| 490 | { 0xdfbdcece, 0x67006ac9, 0x67a791e0, -817 }, |
| 491 | { 0x8bd6a141, 0x006042bd, 0xe0c8bb2c, -813 }, |
| 492 | { 0xaecc4991, 0x4078536d, 0x58fae9f7, -810 }, |
| 493 | { 0xda7f5bf5, 0x90966848, 0xaf39a475, -807 }, |
| 494 | { 0x888f9979, 0x7a5e012d, 0x6d8406c9, -803 }, |
| 495 | { 0xaab37fd7, 0xd8f58178, 0xc8e5087b, -800 }, |
| 496 | { 0xd5605fcd, 0xcf32e1d6, 0xfb1e4a9a, -797 }, |
| 497 | { 0x855c3be0, 0xa17fcd26, 0x5cf2eea0, -793 }, |
| 498 | { 0xa6b34ad8, 0xc9dfc06f, 0xf42faa48, -790 }, |
| 499 | { 0xd0601d8e, 0xfc57b08b, 0xf13b94da, -787 }, |
| 500 | { 0x823c1279, 0x5db6ce57, 0x76c53d08, -783 }, |
| 501 | { 0xa2cb1717, 0xb52481ed, 0x54768c4b, -780 }, |
| 502 | { 0xcb7ddcdd, 0xa26da268, 0xa9942f5d, -777 }, |
| 503 | { 0xfe5d5415, 0x0b090b02, 0xd3f93b35, -774 }, |
| 504 | { 0x9efa548d, 0x26e5a6e1, 0xc47bc501, -770 }, |
| 505 | { 0xc6b8e9b0, 0x709f109a, 0x359ab641, -767 }, |
| 506 | { 0xf867241c, 0x8cc6d4c0, 0xc30163d2, -764 }, |
| 507 | { 0x9b407691, 0xd7fc44f8, 0x79e0de63, -760 }, |
| 508 | { 0xc2109436, 0x4dfb5636, 0x985915fc, -757 }, |
| 509 | { 0xf294b943, 0xe17a2bc4, 0x3e6f5b7b, -754 }, |
| 510 | { 0x979cf3ca, 0x6cec5b5a, 0xa705992c, -750 }, |
| 511 | { 0xbd8430bd, 0x08277231, 0x50c6ff78, -747 }, |
| 512 | { 0xece53cec, 0x4a314ebd, 0xa4f8bf56, -744 }, |
| 513 | { 0x940f4613, 0xae5ed136, 0x871b7795, -740 }, |
| 514 | { 0xb9131798, 0x99f68584, 0x28e2557b, -737 }, |
| 515 | { 0xe757dd7e, 0xc07426e5, 0x331aeada, -734 }, |
| 516 | { 0x9096ea6f, 0x3848984f, 0x3ff0d2c8, -730 }, |
| 517 | { 0xb4bca50b, 0x065abe63, 0x0fed077a, -727 }, |
| 518 | { 0xe1ebce4d, 0xc7f16dfb, 0xd3e84959, -724 }, |
| 519 | { 0x8d3360f0, 0x9cf6e4bd, 0x64712dd7, -720 }, |
| 520 | { 0xb080392c, 0xc4349dec, 0xbd8d794d, -717 }, |
| 521 | { 0xdca04777, 0xf541c567, 0xecf0d7a0, -714 }, |
| 522 | { 0x89e42caa, 0xf9491b60, 0xf41686c4, -710 }, |
| 523 | { 0xac5d37d5, 0xb79b6239, 0x311c2875, -707 }, |
| 524 | { 0xd77485cb, 0x25823ac7, 0x7d633293, -704 }, |
| 525 | { 0x86a8d39e, 0xf77164bc, 0xae5dff9c, -700 }, |
| 526 | { 0xa8530886, 0xb54dbdeb, 0xd9f57f83, -697 }, |
| 527 | { 0xd267caa8, 0x62a12d66, 0xd072df63, -694 }, |
| 528 | { 0x8380dea9, 0x3da4bc60, 0x4247cb9e, -690 }, |
| 529 | { 0xa4611653, 0x8d0deb78, 0x52d9be85, -687 }, |
| 530 | { 0xcd795be8, 0x70516656, 0x67902e27, -684 }, |
| 531 | { 0x806bd971, 0x4632dff6, 0x00ba1cd8, -680 }, |
| 532 | { 0xa086cfcd, 0x97bf97f3, 0x80e8a40e, -677 }, |
| 533 | { 0xc8a883c0, 0xfdaf7df0, 0x6122cd12, -674 }, |
| 534 | { 0xfad2a4b1, 0x3d1b5d6c, 0x796b8057, -671 }, |
| 535 | { 0x9cc3a6ee, 0xc6311a63, 0xcbe33036, -667 }, |
| 536 | { 0xc3f490aa, 0x77bd60fc, 0xbedbfc44, -664 }, |
| 537 | { 0xf4f1b4d5, 0x15acb93b, 0xee92fb55, -661 }, |
| 538 | { 0x99171105, 0x2d8bf3c5, 0x751bdd15, -657 }, |
| 539 | { 0xbf5cd546, 0x78eef0b6, 0xd262d45a, -654 }, |
| 540 | { 0xef340a98, 0x172aace4, 0x86fb8971, -651 }, |
| 541 | { 0x9580869f, 0x0e7aac0e, 0xd45d35e6, -647 }, |
| 542 | { 0xbae0a846, 0xd2195712, 0x89748360, -644 }, |
| 543 | { 0xe998d258, 0x869facd7, 0x2bd1a438, -641 }, |
| 544 | { 0x91ff8377, 0x5423cc06, 0x7b6306a3, -637 }, |
| 545 | { 0xb67f6455, 0x292cbf08, 0x1a3bc84c, -634 }, |
| 546 | { 0xe41f3d6a, 0x7377eeca, 0x20caba5f, -631 }, |
| 547 | { 0x8e938662, 0x882af53e, 0x547eb47b, -627 }, |
| 548 | { 0xb23867fb, 0x2a35b28d, 0xe99e619a, -624 }, |
| 549 | { 0xdec681f9, 0xf4c31f31, 0x6405fa00, -621 }, |
| 550 | { 0x8b3c113c, 0x38f9f37e, 0xde83bc40, -617 }, |
| 551 | { 0xae0b158b, 0x4738705e, 0x9624ab50, -614 }, |
| 552 | { 0xd98ddaee, 0x19068c76, 0x3badd624, -611 }, |
| 553 | { 0x87f8a8d4, 0xcfa417c9, 0xe54ca5d7, -607 }, |
| 554 | { 0xa9f6d30a, 0x038d1dbc, 0x5e9fcf4c, -604 }, |
| 555 | { 0xd47487cc, 0x8470652b, 0x7647c320, -601 }, |
| 556 | { 0x84c8d4df, 0xd2c63f3b, 0x29ecd9f4, -597 }, |
| 557 | { 0xa5fb0a17, 0xc777cf09, 0xf4681071, -594 }, |
| 558 | { 0xcf79cc9d, 0xb955c2cc, 0x7182148d, -591 }, |
| 559 | { 0x81ac1fe2, 0x93d599bf, 0xc6f14cd8, -587 }, |
| 560 | { 0xa21727db, 0x38cb002f, 0xb8ada00e, -584 }, |
| 561 | { 0xca9cf1d2, 0x06fdc03b, 0xa6d90811, -581 }, |
| 562 | { 0xfd442e46, 0x88bd304a, 0x908f4a16, -578 }, |
| 563 | { 0x9e4a9cec, 0x15763e2e, 0x9a598e4e, -574 }, |
| 564 | { 0xc5dd4427, 0x1ad3cdba, 0x40eff1e1, -571 }, |
| 565 | { 0xf7549530, 0xe188c128, 0xd12bee59, -568 }, |
| 566 | { 0x9a94dd3e, 0x8cf578b9, 0x82bb74f8, -564 }, |
| 567 | { 0xc13a148e, 0x3032d6e7, 0xe36a5236, -561 }, |
| 568 | { 0xf18899b1, 0xbc3f8ca1, 0xdc44e6c3, -558 }, |
| 569 | { 0x96f5600f, 0x15a7b7e5, 0x29ab103a, -554 }, |
| 570 | { 0xbcb2b812, 0xdb11a5de, 0x7415d448, -551 }, |
| 571 | { 0xebdf6617, 0x91d60f56, 0x111b495b, -548 }, |
| 572 | { 0x936b9fce, 0xbb25c995, 0xcab10dd9, -544 }, |
| 573 | { 0xb84687c2, 0x69ef3bfb, 0x3d5d514f, -541 }, |
| 574 | { 0xe65829b3, 0x046b0afa, 0x0cb4a5a3, -538 }, |
| 575 | { 0x8ff71a0f, 0xe2c2e6dc, 0x47f0e785, -534 }, |
| 576 | { 0xb3f4e093, 0xdb73a093, 0x59ed2167, -531 }, |
| 577 | { 0xe0f218b8, 0xd25088b8, 0x306869c1, -528 }, |
| 578 | { 0x8c974f73, 0x83725573, 0x1e414218, -524 }, |
| 579 | { 0xafbd2350, 0x644eeacf, 0xe5d1929e, -521 }, |
| 580 | { 0xdbac6c24, 0x7d62a583, 0xdf45f746, -518 }, |
| 581 | { 0x894bc396, 0xce5da772, 0x6b8bba8c, -514 }, |
| 582 | { 0xab9eb47c, 0x81f5114f, 0x066ea92f, -511 }, |
| 583 | { 0xd686619b, 0xa27255a2, 0xc80a537b, -508 }, |
| 584 | { 0x8613fd01, 0x45877585, 0xbd06742c, -504 }, |
| 585 | { 0xa798fc41, 0x96e952e7, 0x2c481138, -501 }, |
| 586 | { 0xd17f3b51, 0xfca3a7a0, 0xf75a1586, -498 }, |
| 587 | { 0x82ef8513, 0x3de648c4, 0x9a984d73, -494 }, |
| 588 | { 0xa3ab6658, 0x0d5fdaf5, 0xc13e60d0, -491 }, |
| 589 | { 0xcc963fee, 0x10b7d1b3, 0x318df905, -488 }, |
| 590 | { 0xffbbcfe9, 0x94e5c61f, 0xfdf17746, -485 }, |
| 591 | { 0x9fd561f1, 0xfd0f9bd3, 0xfeb6ea8b, -481 }, |
| 592 | { 0xc7caba6e, 0x7c5382c8, 0xfe64a52e, -478 }, |
| 593 | { 0xf9bd690a, 0x1b68637b, 0x3dfdce7a, -475 }, |
| 594 | { 0x9c1661a6, 0x51213e2d, 0x06bea10c, -471 }, |
| 595 | { 0xc31bfa0f, 0xe5698db8, 0x486e494f, -468 }, |
| 596 | { 0xf3e2f893, 0xdec3f126, 0x5a89dba3, -465 }, |
| 597 | { 0x986ddb5c, 0x6b3a76b7, 0xf8962946, -461 }, |
| 598 | { 0xbe895233, 0x86091465, 0xf6bbb397, -458 }, |
| 599 | { 0xee2ba6c0, 0x678b597f, 0x746aa07d, -455 }, |
| 600 | { 0x94db4838, 0x40b717ef, 0xa8c2a44e, -451 }, |
| 601 | { 0xba121a46, 0x50e4ddeb, 0x92f34d62, -448 }, |
| 602 | { 0xe896a0d7, 0xe51e1566, 0x77b020ba, -445 }, |
| 603 | { 0x915e2486, 0xef32cd60, 0x0ace1474, -441 }, |
| 604 | { 0xb5b5ada8, 0xaaff80b8, 0x0d819992, -438 }, |
| 605 | { 0xe3231912, 0xd5bf60e6, 0x10e1fff6, -435 }, |
| 606 | { 0x8df5efab, 0xc5979c8f, 0xca8d3ffa, -431 }, |
| 607 | { 0xb1736b96, 0xb6fd83b3, 0xbd308ff8, -428 }, |
| 608 | { 0xddd0467c, 0x64bce4a0, 0xac7cb3f6, -425 }, |
| 609 | { 0x8aa22c0d, 0xbef60ee4, 0x6bcdf07a, -421 }, |
| 610 | { 0xad4ab711, 0x2eb3929d, 0x86c16c98, -418 }, |
| 611 | { 0xd89d64d5, 0x7a607744, 0xe871c7bf, -415 }, |
| 612 | { 0x87625f05, 0x6c7c4a8b, 0x11471cd7, -411 }, |
| 613 | { 0xa93af6c6, 0xc79b5d2d, 0xd598e40d, -408 }, |
| 614 | { 0xd389b478, 0x79823479, 0x4aff1d10, -405 }, |
| 615 | { 0x843610cb, 0x4bf160cb, 0xcedf722a, -401 }, |
| 616 | { 0xa54394fe, 0x1eedb8fe, 0xc2974eb4, -398 }, |
| 617 | { 0xce947a3d, 0xa6a9273e, 0x733d2262, -395 }, |
| 618 | { 0x811ccc66, 0x8829b887, 0x0806357d, -391 }, |
| 619 | { 0xa163ff80, 0x2a3426a8, 0xca07c2dc, -388 }, |
| 620 | { 0xc9bcff60, 0x34c13052, 0xfc89b393, -385 }, |
| 621 | { 0xfc2c3f38, 0x41f17c67, 0xbbac2078, -382 }, |
| 622 | { 0x9d9ba783, 0x2936edc0, 0xd54b944b, -378 }, |
| 623 | { 0xc5029163, 0xf384a931, 0x0a9e795e, -375 }, |
| 624 | { 0xf64335bc, 0xf065d37d, 0x4d4617b5, -372 }, |
| 625 | { 0x99ea0196, 0x163fa42e, 0x504bced1, -368 }, |
| 626 | { 0xc06481fb, 0x9bcf8d39, 0xe45ec286, -365 }, |
| 627 | { 0xf07da27a, 0x82c37088, 0x5d767327, -362 }, |
| 628 | { 0x964e858c, 0x91ba2655, 0x3a6a07f8, -358 }, |
| 629 | { 0xbbe226ef, 0xb628afea, 0x890489f7, -355 }, |
| 630 | { 0xeadab0ab, 0xa3b2dbe5, 0x2b45ac74, -352 }, |
| 631 | { 0x92c8ae6b, 0x464fc96f, 0x3b0b8bc9, -348 }, |
| 632 | { 0xb77ada06, 0x17e3bbcb, 0x09ce6ebb, -345 }, |
| 633 | { 0xe5599087, 0x9ddcaabd, 0xcc420a6a, -342 }, |
| 634 | { 0x8f57fa54, 0xc2a9eab6, 0x9fa94682, -338 }, |
| 635 | { 0xb32df8e9, 0xf3546564, 0x47939822, -335 }, |
| 636 | { 0xdff97724, 0x70297ebd, 0x59787e2b, -332 }, |
| 637 | { 0x8bfbea76, 0xc619ef36, 0x57eb4edb, -328 }, |
| 638 | { 0xaefae514, 0x77a06b03, 0xede62292, -325 }, |
| 639 | { 0xdab99e59, 0x958885c4, 0xe95fab36, -322 }, |
| 640 | { 0x88b402f7, 0xfd75539b, 0x11dbcb02, -318 }, |
| 641 | { 0xaae103b5, 0xfcd2a881, 0xd652bdc2, -315 }, |
| 642 | { 0xd59944a3, 0x7c0752a2, 0x4be76d33, -312 }, |
| 643 | { 0x857fcae6, 0x2d8493a5, 0x6f70a440, -308 }, |
| 644 | { 0xa6dfbd9f, 0xb8e5b88e, 0xcb4ccd50, -305 }, |
| 645 | { 0xd097ad07, 0xa71f26b2, 0x7e2000a4, -302 }, |
| 646 | { 0x825ecc24, 0xc873782f, 0x8ed40066, -298 }, |
| 647 | { 0xa2f67f2d, 0xfa90563b, 0x72890080, -295 }, |
| 648 | { 0xcbb41ef9, 0x79346bca, 0x4f2b40a0, -292 }, |
| 649 | { 0xfea126b7, 0xd78186bc, 0xe2f610c8, -289 }, |
| 650 | { 0x9f24b832, 0xe6b0f436, 0x0dd9ca7d, -285 }, |
| 651 | { 0xc6ede63f, 0xa05d3143, 0x91503d1c, -282 }, |
| 652 | { 0xf8a95fcf, 0x88747d94, 0x75a44c63, -279 }, |
| 653 | { 0x9b69dbe1, 0xb548ce7c, 0xc986afbe, -275 }, |
| 654 | { 0xc24452da, 0x229b021b, 0xfbe85bad, -272 }, |
| 655 | { 0xf2d56790, 0xab41c2a2, 0xfae27299, -269 }, |
| 656 | { 0x97c560ba, 0x6b0919a5, 0xdccd879f, -265 }, |
| 657 | { 0xbdb6b8e9, 0x05cb600f, 0x5400e987, -262 }, |
| 658 | { 0xed246723, 0x473e3813, 0x290123e9, -259 }, |
| 659 | { 0x9436c076, 0x0c86e30b, 0xf9a0b672, -255 }, |
| 660 | { 0xb9447093, 0x8fa89bce, 0xf808e40e, -252 }, |
| 661 | { 0xe7958cb8, 0x7392c2c2, 0xb60b1d12, -249 }, |
| 662 | { 0x90bd77f3, 0x483bb9b9, 0xb1c6f22b, -245 }, |
| 663 | { 0xb4ecd5f0, 0x1a4aa828, 0x1e38aeb6, -242 }, |
| 664 | { 0xe2280b6c, 0x20dd5232, 0x25c6da63, -239 }, |
| 665 | { 0x8d590723, 0x948a535f, 0x579c487e, -235 }, |
| 666 | { 0xb0af48ec, 0x79ace837, 0x2d835a9d, -232 }, |
| 667 | { 0xdcdb1b27, 0x98182244, 0xf8e43145, -229 }, |
| 668 | { 0x8a08f0f8, 0xbf0f156b, 0x1b8e9ecb, -225 }, |
| 669 | { 0xac8b2d36, 0xeed2dac5, 0xe272467e, -222 }, |
| 670 | { 0xd7adf884, 0xaa879177, 0x5b0ed81d, -219 }, |
| 671 | { 0x86ccbb52, 0xea94baea, 0x98e94712, -215 }, |
| 672 | { 0xa87fea27, 0xa539e9a5, 0x3f2398d7, -212 }, |
| 673 | { 0xd29fe4b1, 0x8e88640e, 0x8eec7f0d, -209 }, |
| 674 | { 0x83a3eeee, 0xf9153e89, 0x1953cf68, -205 }, |
| 675 | { 0xa48ceaaa, 0xb75a8e2b, 0x5fa8c342, -202 }, |
| 676 | { 0xcdb02555, 0x653131b6, 0x3792f412, -199 }, |
| 677 | { 0x808e1755, 0x5f3ebf11, 0xe2bbd88b, -195 }, |
| 678 | { 0xa0b19d2a, 0xb70e6ed6, 0x5b6aceae, -192 }, |
| 679 | { 0xc8de0475, 0x64d20a8b, 0xf245825a, -189 }, |
| 680 | { 0xfb158592, 0xbe068d2e, 0xeed6e2f0, -186 }, |
| 681 | { 0x9ced737b, 0xb6c4183d, 0x55464dd6, -182 }, |
| 682 | { 0xc428d05a, 0xa4751e4c, 0xaa97e14c, -179 }, |
| 683 | { 0xf5330471, 0x4d9265df, 0xd53dd99f, -176 }, |
| 684 | { 0x993fe2c6, 0xd07b7fab, 0xe546a803, -172 }, |
| 685 | { 0xbf8fdb78, 0x849a5f96, 0xde985204, -169 }, |
| 686 | { 0xef73d256, 0xa5c0f77c, 0x963e6685, -166 }, |
| 687 | { 0x95a86376, 0x27989aad, 0xdde70013, -162 }, |
| 688 | { 0xbb127c53, 0xb17ec159, 0x5560c018, -159 }, |
| 689 | { 0xe9d71b68, 0x9dde71af, 0xaab8f01e, -156 }, |
| 690 | { 0x92267121, 0x62ab070d, 0xcab39613, -152 }, |
| 691 | { 0xb6b00d69, 0xbb55c8d1, 0x3d607b97, -149 }, |
| 692 | { 0xe45c10c4, 0x2a2b3b05, 0x8cb89a7d, -146 }, |
| 693 | { 0x8eb98a7a, 0x9a5b04e3, 0x77f3608e, -142 }, |
| 694 | { 0xb267ed19, 0x40f1c61c, 0x55f038b2, -139 }, |
| 695 | { 0xdf01e85f, 0x912e37a3, 0x6b6c46de, -136 }, |
| 696 | { 0x8b61313b, 0xbabce2c6, 0x2323ac4b, -132 }, |
| 697 | { 0xae397d8a, 0xa96c1b77, 0xabec975e, -129 }, |
| 698 | { 0xd9c7dced, 0x53c72255, 0x96e7bd35, -126 }, |
| 699 | { 0x881cea14, 0x545c7575, 0x7e50d641, -122 }, |
| 700 | { 0xaa242499, 0x697392d2, 0xdde50bd1, -119 }, |
| 701 | { 0xd4ad2dbf, 0xc3d07787, 0x955e4ec6, -116 }, |
| 702 | { 0x84ec3c97, 0xda624ab4, 0xbd5af13b, -112 }, |
| 703 | { 0xa6274bbd, 0xd0fadd61, 0xecb1ad8a, -109 }, |
| 704 | { 0xcfb11ead, 0x453994ba, 0x67de18ed, -106 }, |
| 705 | { 0x81ceb32c, 0x4b43fcf4, 0x80eacf94, -102 }, |
| 706 | { 0xa2425ff7, 0x5e14fc31, 0xa1258379, -99 }, |
| 707 | { 0xcad2f7f5, 0x359a3b3e, 0x096ee458, -96 }, |
| 708 | { 0xfd87b5f2, 0x8300ca0d, 0x8bca9d6e, -93 }, |
| 709 | { 0x9e74d1b7, 0x91e07e48, 0x775ea264, -89 }, |
| 710 | { 0xc6120625, 0x76589dda, 0x95364afe, -86 }, |
| 711 | { 0xf79687ae, 0xd3eec551, 0x3a83ddbd, -83 }, |
| 712 | { 0x9abe14cd, 0x44753b52, 0xc4926a96, -79 }, |
| 713 | { 0xc16d9a00, 0x95928a27, 0x75b7053c, -76 }, |
| 714 | { 0xf1c90080, 0xbaf72cb1, 0x5324c68b, -73 }, |
| 715 | { 0x971da050, 0x74da7bee, 0xd3f6fc16, -69 }, |
| 716 | { 0xbce50864, 0x92111aea, 0x88f4bb1c, -66 }, |
| 717 | { 0xec1e4a7d, 0xb69561a5, 0x2b31e9e3, -63 }, |
| 718 | { 0x9392ee8e, 0x921d5d07, 0x3aff322e, -59 }, |
| 719 | { 0xb877aa32, 0x36a4b449, 0x09befeb9, -56 }, |
| 720 | { 0xe69594be, 0xc44de15b, 0x4c2ebe68, -53 }, |
| 721 | { 0x901d7cf7, 0x3ab0acd9, 0x0f9d3701, -49 }, |
| 722 | { 0xb424dc35, 0x095cd80f, 0x538484c1, -46 }, |
| 723 | { 0xe12e1342, 0x4bb40e13, 0x2865a5f2, -43 }, |
| 724 | { 0x8cbccc09, 0x6f5088cb, 0xf93f87b7, -39 }, |
| 725 | { 0xafebff0b, 0xcb24aafe, 0xf78f69a5, -36 }, |
| 726 | { 0xdbe6fece, 0xbdedd5be, 0xb573440e, -33 }, |
| 727 | { 0x89705f41, 0x36b4a597, 0x31680a88, -29 }, |
| 728 | { 0xabcc7711, 0x8461cefc, 0xfdc20d2b, -26 }, |
| 729 | { 0xd6bf94d5, 0xe57a42bc, 0x3d329076, -23 }, |
| 730 | { 0x8637bd05, 0xaf6c69b5, 0xa63f9a49, -19 }, |
| 731 | { 0xa7c5ac47, 0x1b478423, 0x0fcf80dc, -16 }, |
| 732 | { 0xd1b71758, 0xe219652b, 0xd3c36113, -13 }, |
| 733 | { 0x83126e97, 0x8d4fdf3b, 0x645a1cac, -9 }, |
| 734 | { 0xa3d70a3d, 0x70a3d70a, 0x3d70a3d7, -6 }, |
| 735 | { 0xcccccccc, 0xcccccccc, 0xcccccccc, -3 }, |
| 736 | { 0x80000000, 0x00000000, 0x00000000, 1 }, |
| 737 | { 0xa0000000, 0x00000000, 0x00000000, 4 }, |
| 738 | { 0xc8000000, 0x00000000, 0x00000000, 7 }, |
| 739 | { 0xfa000000, 0x00000000, 0x00000000, 10 }, |
| 740 | { 0x9c400000, 0x00000000, 0x00000000, 14 }, |
| 741 | { 0xc3500000, 0x00000000, 0x00000000, 17 }, |
| 742 | { 0xf4240000, 0x00000000, 0x00000000, 20 }, |
| 743 | { 0x98968000, 0x00000000, 0x00000000, 24 }, |
| 744 | { 0xbebc2000, 0x00000000, 0x00000000, 27 }, |
| 745 | { 0xee6b2800, 0x00000000, 0x00000000, 30 }, |
| 746 | { 0x9502f900, 0x00000000, 0x00000000, 34 }, |
| 747 | { 0xba43b740, 0x00000000, 0x00000000, 37 }, |
| 748 | { 0xe8d4a510, 0x00000000, 0x00000000, 40 }, |
| 749 | { 0x9184e72a, 0x00000000, 0x00000000, 44 }, |
| 750 | { 0xb5e620f4, 0x80000000, 0x00000000, 47 }, |
| 751 | { 0xe35fa931, 0xa0000000, 0x00000000, 50 }, |
| 752 | { 0x8e1bc9bf, 0x04000000, 0x00000000, 54 }, |
| 753 | { 0xb1a2bc2e, 0xc5000000, 0x00000000, 57 }, |
| 754 | { 0xde0b6b3a, 0x76400000, 0x00000000, 60 }, |
| 755 | { 0x8ac72304, 0x89e80000, 0x00000000, 64 }, |
| 756 | { 0xad78ebc5, 0xac620000, 0x00000000, 67 }, |
| 757 | { 0xd8d726b7, 0x177a8000, 0x00000000, 70 }, |
| 758 | { 0x87867832, 0x6eac9000, 0x00000000, 74 }, |
| 759 | { 0xa968163f, 0x0a57b400, 0x00000000, 77 }, |
| 760 | { 0xd3c21bce, 0xcceda100, 0x00000000, 80 }, |
| 761 | { 0x84595161, 0x401484a0, 0x00000000, 84 }, |
| 762 | { 0xa56fa5b9, 0x9019a5c8, 0x00000000, 87 }, |
| 763 | { 0xcecb8f27, 0xf4200f3a, 0x00000000, 90 }, |
| 764 | { 0x813f3978, 0xf8940984, 0x40000000, 94 }, |
| 765 | { 0xa18f07d7, 0x36b90be5, 0x50000000, 97 }, |
| 766 | { 0xc9f2c9cd, 0x04674ede, 0xa4000000, 100 }, |
| 767 | { 0xfc6f7c40, 0x45812296, 0x4d000000, 103 }, |
| 768 | { 0x9dc5ada8, 0x2b70b59d, 0xf0200000, 107 }, |
| 769 | { 0xc5371912, 0x364ce305, 0x6c280000, 110 }, |
| 770 | { 0xf684df56, 0xc3e01bc6, 0xc7320000, 113 }, |
| 771 | { 0x9a130b96, 0x3a6c115c, 0x3c7f4000, 117 }, |
| 772 | { 0xc097ce7b, 0xc90715b3, 0x4b9f1000, 120 }, |
| 773 | { 0xf0bdc21a, 0xbb48db20, 0x1e86d400, 123 }, |
| 774 | { 0x96769950, 0xb50d88f4, 0x13144480, 127 }, |
| 775 | { 0xbc143fa4, 0xe250eb31, 0x17d955a0, 130 }, |
| 776 | { 0xeb194f8e, 0x1ae525fd, 0x5dcfab08, 133 }, |
| 777 | { 0x92efd1b8, 0xd0cf37be, 0x5aa1cae5, 137 }, |
| 778 | { 0xb7abc627, 0x050305ad, 0xf14a3d9e, 140 }, |
| 779 | { 0xe596b7b0, 0xc643c719, 0x6d9ccd05, 143 }, |
| 780 | { 0x8f7e32ce, 0x7bea5c6f, 0xe4820023, 147 }, |
| 781 | { 0xb35dbf82, 0x1ae4f38b, 0xdda2802c, 150 }, |
| 782 | { 0xe0352f62, 0xa19e306e, 0xd50b2037, 153 }, |
| 783 | { 0x8c213d9d, 0xa502de45, 0x4526f422, 157 }, |
| 784 | { 0xaf298d05, 0x0e4395d6, 0x9670b12b, 160 }, |
| 785 | { 0xdaf3f046, 0x51d47b4c, 0x3c0cdd76, 163 }, |
| 786 | { 0x88d8762b, 0xf324cd0f, 0xa5880a69, 167 }, |
| 787 | { 0xab0e93b6, 0xefee0053, 0x8eea0d04, 170 }, |
| 788 | { 0xd5d238a4, 0xabe98068, 0x72a49045, 173 }, |
| 789 | { 0x85a36366, 0xeb71f041, 0x47a6da2b, 177 }, |
| 790 | { 0xa70c3c40, 0xa64e6c51, 0x999090b6, 180 }, |
| 791 | { 0xd0cf4b50, 0xcfe20765, 0xfff4b4e3, 183 }, |
| 792 | { 0x82818f12, 0x81ed449f, 0xbff8f10e, 187 }, |
| 793 | { 0xa321f2d7, 0x226895c7, 0xaff72d52, 190 }, |
| 794 | { 0xcbea6f8c, 0xeb02bb39, 0x9bf4f8a6, 193 }, |
| 795 | { 0xfee50b70, 0x25c36a08, 0x02f236d0, 196 }, |
| 796 | { 0x9f4f2726, 0x179a2245, 0x01d76242, 200 }, |
| 797 | { 0xc722f0ef, 0x9d80aad6, 0x424d3ad2, 203 }, |
| 798 | { 0xf8ebad2b, 0x84e0d58b, 0xd2e08987, 206 }, |
| 799 | { 0x9b934c3b, 0x330c8577, 0x63cc55f4, 210 }, |
| 800 | { 0xc2781f49, 0xffcfa6d5, 0x3cbf6b71, 213 }, |
| 801 | { 0xf316271c, 0x7fc3908a, 0x8bef464e, 216 }, |
| 802 | { 0x97edd871, 0xcfda3a56, 0x97758bf0, 220 }, |
| 803 | { 0xbde94e8e, 0x43d0c8ec, 0x3d52eeed, 223 }, |
| 804 | { 0xed63a231, 0xd4c4fb27, 0x4ca7aaa8, 226 }, |
| 805 | { 0x945e455f, 0x24fb1cf8, 0x8fe8caa9, 230 }, |
| 806 | { 0xb975d6b6, 0xee39e436, 0xb3e2fd53, 233 }, |
| 807 | { 0xe7d34c64, 0xa9c85d44, 0x60dbbca8, 236 }, |
| 808 | { 0x90e40fbe, 0xea1d3a4a, 0xbc8955e9, 240 }, |
| 809 | { 0xb51d13ae, 0xa4a488dd, 0x6babab63, 243 }, |
| 810 | { 0xe264589a, 0x4dcdab14, 0xc696963c, 246 }, |
| 811 | { 0x8d7eb760, 0x70a08aec, 0xfc1e1de5, 250 }, |
| 812 | { 0xb0de6538, 0x8cc8ada8, 0x3b25a55f, 253 }, |
| 813 | { 0xdd15fe86, 0xaffad912, 0x49ef0eb7, 256 }, |
| 814 | { 0x8a2dbf14, 0x2dfcc7ab, 0x6e356932, 260 }, |
| 815 | { 0xacb92ed9, 0x397bf996, 0x49c2c37f, 263 }, |
| 816 | { 0xd7e77a8f, 0x87daf7fb, 0xdc33745e, 266 }, |
| 817 | { 0x86f0ac99, 0xb4e8dafd, 0x69a028bb, 270 }, |
| 818 | { 0xa8acd7c0, 0x222311bc, 0xc40832ea, 273 }, |
| 819 | { 0xd2d80db0, 0x2aabd62b, 0xf50a3fa4, 276 }, |
| 820 | { 0x83c7088e, 0x1aab65db, 0x792667c6, 280 }, |
| 821 | { 0xa4b8cab1, 0xa1563f52, 0x577001b8, 283 }, |
| 822 | { 0xcde6fd5e, 0x09abcf26, 0xed4c0226, 286 }, |
| 823 | { 0x80b05e5a, 0xc60b6178, 0x544f8158, 290 }, |
| 824 | { 0xa0dc75f1, 0x778e39d6, 0x696361ae, 293 }, |
| 825 | { 0xc913936d, 0xd571c84c, 0x03bc3a19, 296 }, |
| 826 | { 0xfb587849, 0x4ace3a5f, 0x04ab48a0, 299 }, |
| 827 | { 0x9d174b2d, 0xcec0e47b, 0x62eb0d64, 303 }, |
| 828 | { 0xc45d1df9, 0x42711d9a, 0x3ba5d0bd, 306 }, |
| 829 | { 0xf5746577, 0x930d6500, 0xca8f44ec, 309 }, |
| 830 | { 0x9968bf6a, 0xbbe85f20, 0x7e998b13, 313 }, |
| 831 | { 0xbfc2ef45, 0x6ae276e8, 0x9e3fedd8, 316 }, |
| 832 | { 0xefb3ab16, 0xc59b14a2, 0xc5cfe94e, 319 }, |
| 833 | { 0x95d04aee, 0x3b80ece5, 0xbba1f1d1, 323 }, |
| 834 | { 0xbb445da9, 0xca61281f, 0x2a8a6e45, 326 }, |
| 835 | { 0xea157514, 0x3cf97226, 0xf52d09d7, 329 }, |
| 836 | { 0x924d692c, 0xa61be758, 0x593c2626, 333 }, |
| 837 | { 0xb6e0c377, 0xcfa2e12e, 0x6f8b2fb0, 336 }, |
| 838 | { 0xe498f455, 0xc38b997a, 0x0b6dfb9c, 339 }, |
| 839 | { 0x8edf98b5, 0x9a373fec, 0x4724bd41, 343 }, |
| 840 | { 0xb2977ee3, 0x00c50fe7, 0x58edec91, 346 }, |
| 841 | { 0xdf3d5e9b, 0xc0f653e1, 0x2f2967b6, 349 }, |
| 842 | { 0x8b865b21, 0x5899f46c, 0xbd79e0d2, 353 }, |
| 843 | { 0xae67f1e9, 0xaec07187, 0xecd85906, 356 }, |
| 844 | { 0xda01ee64, 0x1a708de9, 0xe80e6f48, 359 }, |
| 845 | { 0x884134fe, 0x908658b2, 0x3109058d, 363 }, |
| 846 | { 0xaa51823e, 0x34a7eede, 0xbd4b46f0, 366 }, |
| 847 | { 0xd4e5e2cd, 0xc1d1ea96, 0x6c9e18ac, 369 }, |
| 848 | { 0x850fadc0, 0x9923329e, 0x03e2cf6b, 373 }, |
| 849 | { 0xa6539930, 0xbf6bff45, 0x84db8346, 376 }, |
| 850 | { 0xcfe87f7c, 0xef46ff16, 0xe6126418, 379 }, |
| 851 | { 0x81f14fae, 0x158c5f6e, 0x4fcb7e8f, 383 }, |
| 852 | { 0xa26da399, 0x9aef7749, 0xe3be5e33, 386 }, |
| 853 | { 0xcb090c80, 0x01ab551c, 0x5cadf5bf, 389 }, |
| 854 | { 0xfdcb4fa0, 0x02162a63, 0x73d9732f, 392 }, |
| 855 | { 0x9e9f11c4, 0x014dda7e, 0x2867e7fd, 396 }, |
| 856 | { 0xc646d635, 0x01a1511d, 0xb281e1fd, 399 }, |
| 857 | { 0xf7d88bc2, 0x4209a565, 0x1f225a7c, 402 }, |
| 858 | { 0x9ae75759, 0x6946075f, 0x3375788d, 406 }, |
| 859 | { 0xc1a12d2f, 0xc3978937, 0x0052d6b1, 409 }, |
| 860 | { 0xf209787b, 0xb47d6b84, 0xc0678c5d, 412 }, |
| 861 | { 0x9745eb4d, 0x50ce6332, 0xf840b7ba, 416 }, |
| 862 | { 0xbd176620, 0xa501fbff, 0xb650e5a9, 419 }, |
| 863 | { 0xec5d3fa8, 0xce427aff, 0xa3e51f13, 422 }, |
| 864 | { 0x93ba47c9, 0x80e98cdf, 0xc66f336c, 426 }, |
| 865 | { 0xb8a8d9bb, 0xe123f017, 0xb80b0047, 429 }, |
| 866 | { 0xe6d3102a, 0xd96cec1d, 0xa60dc059, 432 }, |
| 867 | { 0x9043ea1a, 0xc7e41392, 0x87c89837, 436 }, |
| 868 | { 0xb454e4a1, 0x79dd1877, 0x29babe45, 439 }, |
| 869 | { 0xe16a1dc9, 0xd8545e94, 0xf4296dd6, 442 }, |
| 870 | { 0x8ce2529e, 0x2734bb1d, 0x1899e4a6, 446 }, |
| 871 | { 0xb01ae745, 0xb101e9e4, 0x5ec05dcf, 449 }, |
| 872 | { 0xdc21a117, 0x1d42645d, 0x76707543, 452 }, |
| 873 | { 0x899504ae, 0x72497eba, 0x6a06494a, 456 }, |
| 874 | { 0xabfa45da, 0x0edbde69, 0x0487db9d, 459 }, |
| 875 | { 0xd6f8d750, 0x9292d603, 0x45a9d284, 462 }, |
| 876 | { 0x865b8692, 0x5b9bc5c2, 0x0b8a2392, 466 }, |
| 877 | { 0xa7f26836, 0xf282b732, 0x8e6cac77, 469 }, |
| 878 | { 0xd1ef0244, 0xaf2364ff, 0x3207d795, 472 }, |
| 879 | { 0x8335616a, 0xed761f1f, 0x7f44e6bd, 476 }, |
| 880 | { 0xa402b9c5, 0xa8d3a6e7, 0x5f16206c, 479 }, |
| 881 | { 0xcd036837, 0x130890a1, 0x36dba887, 482 }, |
| 882 | { 0x80222122, 0x6be55a64, 0xc2494954, 486 }, |
| 883 | { 0xa02aa96b, 0x06deb0fd, 0xf2db9baa, 489 }, |
| 884 | { 0xc83553c5, 0xc8965d3d, 0x6f928294, 492 }, |
| 885 | { 0xfa42a8b7, 0x3abbf48c, 0xcb772339, 495 }, |
| 886 | { 0x9c69a972, 0x84b578d7, 0xff2a7604, 499 }, |
| 887 | { 0xc38413cf, 0x25e2d70d, 0xfef51385, 502 }, |
| 888 | { 0xf46518c2, 0xef5b8cd1, 0x7eb25866, 505 }, |
| 889 | { 0x98bf2f79, 0xd5993802, 0xef2f773f, 509 }, |
| 890 | { 0xbeeefb58, 0x4aff8603, 0xaafb550f, 512 }, |
| 891 | { 0xeeaaba2e, 0x5dbf6784, 0x95ba2a53, 515 }, |
| 892 | { 0x952ab45c, 0xfa97a0b2, 0xdd945a74, 519 }, |
| 893 | { 0xba756174, 0x393d88df, 0x94f97111, 522 }, |
| 894 | { 0xe912b9d1, 0x478ceb17, 0x7a37cd56, 525 }, |
| 895 | { 0x91abb422, 0xccb812ee, 0xac62e055, 529 }, |
| 896 | { 0xb616a12b, 0x7fe617aa, 0x577b986b, 532 }, |
| 897 | { 0xe39c4976, 0x5fdf9d94, 0xed5a7e85, 535 }, |
| 898 | { 0x8e41ade9, 0xfbebc27d, 0x14588f13, 539 }, |
| 899 | { 0xb1d21964, 0x7ae6b31c, 0x596eb2d8, 542 }, |
| 900 | { 0xde469fbd, 0x99a05fe3, 0x6fca5f8e, 545 }, |
| 901 | { 0x8aec23d6, 0x80043bee, 0x25de7bb9, 549 }, |
| 902 | { 0xada72ccc, 0x20054ae9, 0xaf561aa7, 552 }, |
| 903 | { 0xd910f7ff, 0x28069da4, 0x1b2ba151, 555 }, |
| 904 | { 0x87aa9aff, 0x79042286, 0x90fb44d2, 559 }, |
| 905 | { 0xa99541bf, 0x57452b28, 0x353a1607, 562 }, |
| 906 | { 0xd3fa922f, 0x2d1675f2, 0x42889b89, 565 }, |
| 907 | { 0x847c9b5d, 0x7c2e09b7, 0x69956135, 569 }, |
| 908 | { 0xa59bc234, 0xdb398c25, 0x43fab983, 572 }, |
| 909 | { 0xcf02b2c2, 0x1207ef2e, 0x94f967e4, 575 }, |
| 910 | { 0x8161afb9, 0x4b44f57d, 0x1d1be0ee, 579 }, |
| 911 | { 0xa1ba1ba7, 0x9e1632dc, 0x6462d92a, 582 }, |
| 912 | { 0xca28a291, 0x859bbf93, 0x7d7b8f75, 585 }, |
| 913 | { 0xfcb2cb35, 0xe702af78, 0x5cda7352, 588 }, |
| 914 | { 0x9defbf01, 0xb061adab, 0x3a088813, 592 }, |
| 915 | { 0xc56baec2, 0x1c7a1916, 0x088aaa18, 595 }, |
| 916 | { 0xf6c69a72, 0xa3989f5b, 0x8aad549e, 598 }, |
| 917 | { 0x9a3c2087, 0xa63f6399, 0x36ac54e2, 602 }, |
| 918 | { 0xc0cb28a9, 0x8fcf3c7f, 0x84576a1b, 605 }, |
| 919 | { 0xf0fdf2d3, 0xf3c30b9f, 0x656d44a2, 608 }, |
| 920 | { 0x969eb7c4, 0x7859e743, 0x9f644ae5, 612 }, |
| 921 | { 0xbc4665b5, 0x96706114, 0x873d5d9f, 615 }, |
| 922 | { 0xeb57ff22, 0xfc0c7959, 0xa90cb506, 618 }, |
| 923 | { 0x9316ff75, 0xdd87cbd8, 0x09a7f124, 622 }, |
| 924 | { 0xb7dcbf53, 0x54e9bece, 0x0c11ed6d, 625 }, |
| 925 | { 0xe5d3ef28, 0x2a242e81, 0x8f1668c8, 628 }, |
| 926 | { 0x8fa47579, 0x1a569d10, 0xf96e017d, 632 }, |
| 927 | { 0xb38d92d7, 0x60ec4455, 0x37c981dc, 635 }, |
| 928 | { 0xe070f78d, 0x3927556a, 0x85bbe253, 638 }, |
| 929 | { 0x8c469ab8, 0x43b89562, 0x93956d74, 642 }, |
| 930 | { 0xaf584166, 0x54a6babb, 0x387ac8d1, 645 }, |
| 931 | { 0xdb2e51bf, 0xe9d0696a, 0x06997b05, 648 }, |
| 932 | { 0x88fcf317, 0xf22241e2, 0x441fece3, 652 }, |
| 933 | { 0xab3c2fdd, 0xeeaad25a, 0xd527e81c, 655 }, |
| 934 | { 0xd60b3bd5, 0x6a5586f1, 0x8a71e223, 658 }, |
| 935 | { 0x85c70565, 0x62757456, 0xf6872d56, 662 }, |
| 936 | { 0xa738c6be, 0xbb12d16c, 0xb428f8ac, 665 }, |
| 937 | { 0xd106f86e, 0x69d785c7, 0xe13336d7, 668 }, |
| 938 | { 0x82a45b45, 0x0226b39c, 0xecc00246, 672 }, |
| 939 | { 0xa34d7216, 0x42b06084, 0x27f002d7, 675 }, |
| 940 | { 0xcc20ce9b, 0xd35c78a5, 0x31ec038d, 678 }, |
| 941 | { 0xff290242, 0xc83396ce, 0x7e670471, 681 }, |
| 942 | { 0x9f79a169, 0xbd203e41, 0x0f0062c6, 685 }, |
| 943 | { 0xc75809c4, 0x2c684dd1, 0x52c07b78, 688 }, |
| 944 | { 0xf92e0c35, 0x37826145, 0xa7709a56, 691 }, |
| 945 | { 0x9bbcc7a1, 0x42b17ccb, 0x88a66076, 695 }, |
| 946 | { 0xc2abf989, 0x935ddbfe, 0x6acff893, 698 }, |
| 947 | { 0xf356f7eb, 0xf83552fe, 0x0583f6b8, 701 }, |
| 948 | { 0x98165af3, 0x7b2153de, 0xc3727a33, 705 }, |
| 949 | { 0xbe1bf1b0, 0x59e9a8d6, 0x744f18c0, 708 }, |
| 950 | { 0xeda2ee1c, 0x7064130c, 0x1162def0, 711 }, |
| 951 | { 0x9485d4d1, 0xc63e8be7, 0x8addcb56, 715 }, |
| 952 | { 0xb9a74a06, 0x37ce2ee1, 0x6d953e2b, 718 }, |
| 953 | { 0xe8111c87, 0xc5c1ba99, 0xc8fa8db6, 721 }, |
| 954 | { 0x910ab1d4, 0xdb9914a0, 0x1d9c9892, 725 }, |
| 955 | { 0xb54d5e4a, 0x127f59c8, 0x2503beb6, 728 }, |
| 956 | { 0xe2a0b5dc, 0x971f303a, 0x2e44ae64, 731 }, |
| 957 | { 0x8da471a9, 0xde737e24, 0x5ceaecfe, 735 }, |
| 958 | { 0xb10d8e14, 0x56105dad, 0x7425a83e, 738 }, |
| 959 | { 0xdd50f199, 0x6b947518, 0xd12f124e, 741 }, |
| 960 | { 0x8a5296ff, 0xe33cc92f, 0x82bd6b70, 745 }, |
| 961 | { 0xace73cbf, 0xdc0bfb7b, 0x636cc64d, 748 }, |
| 962 | { 0xd8210bef, 0xd30efa5a, 0x3c47f7e0, 751 }, |
| 963 | { 0x8714a775, 0xe3e95c78, 0x65acfaec, 755 }, |
| 964 | { 0xa8d9d153, 0x5ce3b396, 0x7f1839a7, 758 }, |
| 965 | { 0xd31045a8, 0x341ca07c, 0x1ede4811, 761 }, |
| 966 | { 0x83ea2b89, 0x2091e44d, 0x934aed0a, 765 }, |
| 967 | { 0xa4e4b66b, 0x68b65d60, 0xf81da84d, 768 }, |
| 968 | { 0xce1de406, 0x42e3f4b9, 0x36251260, 771 }, |
| 969 | { 0x80d2ae83, 0xe9ce78f3, 0xc1d72b7c, 775 }, |
| 970 | { 0xa1075a24, 0xe4421730, 0xb24cf65b, 778 }, |
| 971 | { 0xc94930ae, 0x1d529cfc, 0xdee033f2, 781 }, |
| 972 | { 0xfb9b7cd9, 0xa4a7443c, 0x169840ef, 784 }, |
| 973 | { 0x9d412e08, 0x06e88aa5, 0x8e1f2895, 788 }, |
| 974 | { 0xc491798a, 0x08a2ad4e, 0xf1a6f2ba, 791 }, |
| 975 | { 0xf5b5d7ec, 0x8acb58a2, 0xae10af69, 794 }, |
| 976 | { 0x9991a6f3, 0xd6bf1765, 0xacca6da1, 798 }, |
| 977 | { 0xbff610b0, 0xcc6edd3f, 0x17fd090a, 801 }, |
| 978 | { 0xeff394dc, 0xff8a948e, 0xddfc4b4c, 804 }, |
| 979 | { 0x95f83d0a, 0x1fb69cd9, 0x4abdaf10, 808 }, |
| 980 | { 0xbb764c4c, 0xa7a4440f, 0x9d6d1ad4, 811 }, |
| 981 | { 0xea53df5f, 0xd18d5513, 0x84c86189, 814 }, |
| 982 | { 0x92746b9b, 0xe2f8552c, 0x32fd3cf5, 818 }, |
| 983 | { 0xb7118682, 0xdbb66a77, 0x3fbc8c33, 821 }, |
| 984 | { 0xe4d5e823, 0x92a40515, 0x0fabaf3f, 824 }, |
| 985 | { 0x8f05b116, 0x3ba6832d, 0x29cb4d87, 828 }, |
| 986 | { 0xb2c71d5b, 0xca9023f8, 0x743e20e9, 831 }, |
| 987 | { 0xdf78e4b2, 0xbd342cf6, 0x914da924, 834 }, |
| 988 | { 0x8bab8eef, 0xb6409c1a, 0x1ad089b6, 838 }, |
| 989 | { 0xae9672ab, 0xa3d0c320, 0xa184ac24, 841 }, |
| 990 | { 0xda3c0f56, 0x8cc4f3e8, 0xc9e5d72d, 844 }, |
| 991 | { 0x88658996, 0x17fb1871, 0x7e2fa67c, 848 }, |
| 992 | { 0xaa7eebfb, 0x9df9de8d, 0xddbb901b, 851 }, |
| 993 | { 0xd51ea6fa, 0x85785631, 0x552a7422, 854 }, |
| 994 | { 0x8533285c, 0x936b35de, 0xd53a8895, 858 }, |
| 995 | { 0xa67ff273, 0xb8460356, 0x8a892aba, 861 }, |
| 996 | { 0xd01fef10, 0xa657842c, 0x2d2b7569, 864 }, |
| 997 | { 0x8213f56a, 0x67f6b29b, 0x9c3b2962, 868 }, |
| 998 | { 0xa298f2c5, 0x01f45f42, 0x8349f3ba, 871 }, |
| 999 | { 0xcb3f2f76, 0x42717713, 0x241c70a9, 874 }, |
| 1000 | { 0xfe0efb53, 0xd30dd4d7, 0xed238cd3, 877 }, |
| 1001 | { 0x9ec95d14, 0x63e8a506, 0xf4363804, 881 }, |
| 1002 | { 0xc67bb459, 0x7ce2ce48, 0xb143c605, 884 }, |
| 1003 | { 0xf81aa16f, 0xdc1b81da, 0xdd94b786, 887 }, |
| 1004 | { 0x9b10a4e5, 0xe9913128, 0xca7cf2b4, 891 }, |
| 1005 | { 0xc1d4ce1f, 0x63f57d72, 0xfd1c2f61, 894 }, |
| 1006 | { 0xf24a01a7, 0x3cf2dccf, 0xbc633b39, 897 }, |
| 1007 | { 0x976e4108, 0x8617ca01, 0xd5be0503, 901 }, |
| 1008 | { 0xbd49d14a, 0xa79dbc82, 0x4b2d8644, 904 }, |
| 1009 | { 0xec9c459d, 0x51852ba2, 0xddf8e7d6, 907 }, |
| 1010 | { 0x93e1ab82, 0x52f33b45, 0xcabb90e5, 911 }, |
| 1011 | { 0xb8da1662, 0xe7b00a17, 0x3d6a751f, 914 }, |
| 1012 | { 0xe7109bfb, 0xa19c0c9d, 0x0cc51267, 917 }, |
| 1013 | { 0x906a617d, 0x450187e2, 0x27fb2b80, 921 }, |
| 1014 | { 0xb484f9dc, 0x9641e9da, 0xb1f9f660, 924 }, |
| 1015 | { 0xe1a63853, 0xbbd26451, 0x5e7873f8, 927 }, |
| 1016 | { 0x8d07e334, 0x55637eb2, 0xdb0b487b, 931 }, |
| 1017 | { 0xb049dc01, 0x6abc5e5f, 0x91ce1a9a, 934 }, |
| 1018 | { 0xdc5c5301, 0xc56b75f7, 0x7641a140, 937 }, |
| 1019 | { 0x89b9b3e1, 0x1b6329ba, 0xa9e904c8, 941 }, |
| 1020 | { 0xac2820d9, 0x623bf429, 0x546345fa, 944 }, |
| 1021 | { 0xd732290f, 0xbacaf133, 0xa97c1779, 947 }, |
| 1022 | { 0x867f59a9, 0xd4bed6c0, 0x49ed8eab, 951 }, |
| 1023 | { 0xa81f3014, 0x49ee8c70, 0x5c68f256, 954 }, |
| 1024 | { 0xd226fc19, 0x5c6a2f8c, 0x73832eec, 957 }, |
| 1025 | { 0x83585d8f, 0xd9c25db7, 0xc831fd53, 961 }, |
| 1026 | { 0xa42e74f3, 0xd032f525, 0xba3e7ca8, 964 }, |
| 1027 | { 0xcd3a1230, 0xc43fb26f, 0x28ce1bd2, 967 }, |
| 1028 | { 0x80444b5e, 0x7aa7cf85, 0x7980d163, 971 }, |
| 1029 | { 0xa0555e36, 0x1951c366, 0xd7e105bc, 974 }, |
| 1030 | { 0xc86ab5c3, 0x9fa63440, 0x8dd9472b, 977 }, |
| 1031 | { 0xfa856334, 0x878fc150, 0xb14f98f6, 980 }, |
| 1032 | { 0x9c935e00, 0xd4b9d8d2, 0x6ed1bf9a, 984 }, |
| 1033 | { 0xc3b83581, 0x09e84f07, 0x0a862f80, 987 }, |
| 1034 | { 0xf4a642e1, 0x4c6262c8, 0xcd27bb61, 990 }, |
| 1035 | { 0x98e7e9cc, 0xcfbd7dbd, 0x8038d51c, 994 }, |
| 1036 | { 0xbf21e440, 0x03acdd2c, 0xe0470a63, 997 }, |
| 1037 | { 0xeeea5d50, 0x04981478, 0x1858ccfc, 1000 }, |
| 1038 | { 0x95527a52, 0x02df0ccb, 0x0f37801e, 1004 }, |
| 1039 | { 0xbaa718e6, 0x8396cffd, 0xd3056025, 1007 }, |
| 1040 | { 0xe950df20, 0x247c83fd, 0x47c6b82e, 1010 }, |
| 1041 | { 0x91d28b74, 0x16cdd27e, 0x4cdc331d, 1014 }, |
| 1042 | { 0xb6472e51, 0x1c81471d, 0xe0133fe4, 1017 }, |
| 1043 | { 0xe3d8f9e5, 0x63a198e5, 0x58180fdd, 1020 }, |
| 1044 | { 0x8e679c2f, 0x5e44ff8f, 0x570f09ea, 1024 }, |
| 1045 | { 0xb201833b, 0x35d63f73, 0x2cd2cc65, 1027 }, |
| 1046 | { 0xde81e40a, 0x034bcf4f, 0xf8077f7e, 1030 }, |
| 1047 | { 0x8b112e86, 0x420f6191, 0xfb04afaf, 1034 }, |
| 1048 | { 0xadd57a27, 0xd29339f6, 0x79c5db9a, 1037 }, |
| 1049 | { 0xd94ad8b1, 0xc7380874, 0x18375281, 1040 }, |
| 1050 | { 0x87cec76f, 0x1c830548, 0x8f229391, 1044 }, |
| 1051 | { 0xa9c2794a, 0xe3a3c69a, 0xb2eb3875, 1047 }, |
| 1052 | { 0xd433179d, 0x9c8cb841, 0x5fa60692, 1050 }, |
| 1053 | { 0x849feec2, 0x81d7f328, 0xdbc7c41b, 1054 }, |
| 1054 | { 0xa5c7ea73, 0x224deff3, 0x12b9b522, 1057 }, |
| 1055 | { 0xcf39e50f, 0xeae16bef, 0xd768226b, 1060 }, |
| 1056 | { 0x81842f29, 0xf2cce375, 0xe6a11583, 1064 }, |
| 1057 | { 0xa1e53af4, 0x6f801c53, 0x60495ae3, 1067 }, |
| 1058 | { 0xca5e89b1, 0x8b602368, 0x385bb19c, 1070 }, |
| 1059 | { 0xfcf62c1d, 0xee382c42, 0x46729e03, 1073 }, |
| 1060 | { 0x9e19db92, 0xb4e31ba9, 0x6c07a2c2, 1077 } |
| 1061 | }; |
| 1062 | static const short int Lhint[2098] = { |
| 1063 | /*18,*/19, 19, 19, 19, 20, 20, 20, 21, 21, |
| 1064 | 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, |
| 1065 | 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, |
| 1066 | 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, |
| 1067 | 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, |
| 1068 | 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, |
| 1069 | 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, |
| 1070 | 39, 40, 40, 40, 41, 41, 41, 41, 42, 42, |
| 1071 | 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, |
| 1072 | 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, |
| 1073 | 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, |
| 1074 | 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, |
| 1075 | 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, |
| 1076 | 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, |
| 1077 | 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, |
| 1078 | 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, |
| 1079 | 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, |
| 1080 | 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, |
| 1081 | 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, |
| 1082 | 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, |
| 1083 | 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, |
| 1084 | 82, 82, 82, 82, 83, 83, 83, 84, 84, 84, |
| 1085 | 85, 85, 85, 85, 86, 86, 86, 87, 87, 87, |
| 1086 | 88, 88, 88, 88, 89, 89, 89, 90, 90, 90, |
| 1087 | 91, 91, 91, 91, 92, 92, 92, 93, 93, 93, |
| 1088 | 94, 94, 94, 94, 95, 95, 95, 96, 96, 96, |
| 1089 | 97, 97, 97, 97, 98, 98, 98, 99, 99, 99, |
| 1090 | 100, 100, 100, 100, 101, 101, 101, 102, 102, 102, |
| 1091 | 103, 103, 103, 103, 104, 104, 104, 105, 105, 105, |
| 1092 | 106, 106, 106, 106, 107, 107, 107, 108, 108, 108, |
| 1093 | 109, 109, 109, 110, 110, 110, 110, 111, 111, 111, |
| 1094 | 112, 112, 112, 113, 113, 113, 113, 114, 114, 114, |
| 1095 | 115, 115, 115, 116, 116, 116, 116, 117, 117, 117, |
| 1096 | 118, 118, 118, 119, 119, 119, 119, 120, 120, 120, |
| 1097 | 121, 121, 121, 122, 122, 122, 122, 123, 123, 123, |
| 1098 | 124, 124, 124, 125, 125, 125, 125, 126, 126, 126, |
| 1099 | 127, 127, 127, 128, 128, 128, 128, 129, 129, 129, |
| 1100 | 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, |
| 1101 | 133, 133, 133, 134, 134, 134, 134, 135, 135, 135, |
| 1102 | 136, 136, 136, 137, 137, 137, 137, 138, 138, 138, |
| 1103 | 139, 139, 139, 140, 140, 140, 141, 141, 141, 141, |
| 1104 | 142, 142, 142, 143, 143, 143, 144, 144, 144, 144, |
| 1105 | 145, 145, 145, 146, 146, 146, 147, 147, 147, 147, |
| 1106 | 148, 148, 148, 149, 149, 149, 150, 150, 150, 150, |
| 1107 | 151, 151, 151, 152, 152, 152, 153, 153, 153, 153, |
| 1108 | 154, 154, 154, 155, 155, 155, 156, 156, 156, 156, |
| 1109 | 157, 157, 157, 158, 158, 158, 159, 159, 159, 159, |
| 1110 | 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, |
| 1111 | 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, |
| 1112 | 166, 166, 166, 167, 167, 167, 168, 168, 168, 169, |
| 1113 | 169, 169, 169, 170, 170, 170, 171, 171, 171, 172, |
| 1114 | 172, 172, 172, 173, 173, 173, 174, 174, 174, 175, |
| 1115 | 175, 175, 175, 176, 176, 176, 177, 177, 177, 178, |
| 1116 | 178, 178, 178, 179, 179, 179, 180, 180, 180, 181, |
| 1117 | 181, 181, 181, 182, 182, 182, 183, 183, 183, 184, |
| 1118 | 184, 184, 184, 185, 185, 185, 186, 186, 186, 187, |
| 1119 | 187, 187, 187, 188, 188, 188, 189, 189, 189, 190, |
| 1120 | 190, 190, 190, 191, 191, 191, 192, 192, 192, 193, |
| 1121 | 193, 193, 193, 194, 194, 194, 195, 195, 195, 196, |
| 1122 | 196, 196, 197, 197, 197, 197, 198, 198, 198, 199, |
| 1123 | 199, 199, 200, 200, 200, 200, 201, 201, 201, 202, |
| 1124 | 202, 202, 203, 203, 203, 203, 204, 204, 204, 205, |
| 1125 | 205, 205, 206, 206, 206, 206, 207, 207, 207, 208, |
| 1126 | 208, 208, 209, 209, 209, 209, 210, 210, 210, 211, |
| 1127 | 211, 211, 212, 212, 212, 212, 213, 213, 213, 214, |
| 1128 | 214, 214, 215, 215, 215, 215, 216, 216, 216, 217, |
| 1129 | 217, 217, 218, 218, 218, 218, 219, 219, 219, 220, |
| 1130 | 220, 220, 221, 221, 221, 221, 222, 222, 222, 223, |
| 1131 | 223, 223, 224, 224, 224, 224, 225, 225, 225, 226, |
| 1132 | 226, 226, 227, 227, 227, 228, 228, 228, 228, 229, |
| 1133 | 229, 229, 230, 230, 230, 231, 231, 231, 231, 232, |
| 1134 | 232, 232, 233, 233, 233, 234, 234, 234, 234, 235, |
| 1135 | 235, 235, 236, 236, 236, 237, 237, 237, 237, 238, |
| 1136 | 238, 238, 239, 239, 239, 240, 240, 240, 240, 241, |
| 1137 | 241, 241, 242, 242, 242, 243, 243, 243, 243, 244, |
| 1138 | 244, 244, 245, 245, 245, 246, 246, 246, 246, 247, |
| 1139 | 247, 247, 248, 248, 248, 249, 249, 249, 249, 250, |
| 1140 | 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, |
| 1141 | 253, 253, 254, 254, 254, 255, 255, 255, 256, 256, |
| 1142 | 256, 256, 257, 257, 257, 258, 258, 258, 259, 259, |
| 1143 | 259, 259, 260, 260, 260, 261, 261, 261, 262, 262, |
| 1144 | 262, 262, 263, 263, 263, 264, 264, 264, 265, 265, |
| 1145 | 265, 265, 266, 266, 266, 267, 267, 267, 268, 268, |
| 1146 | 268, 268, 269, 269, 269, 270, 270, 270, 271, 271, |
| 1147 | 271, 271, 272, 272, 272, 273, 273, 273, 274, 274, |
| 1148 | 274, 274, 275, 275, 275, 276, 276, 276, 277, 277, |
| 1149 | 277, 277, 278, 278, 278, 279, 279, 279, 280, 280, |
| 1150 | 280, 280, 281, 281, 281, 282, 282, 282, 283, 283, |
| 1151 | 283, 283, 284, 284, 284, 285, 285, 285, 286, 286, |
| 1152 | 286, 287, 287, 287, 287, 288, 288, 288, 289, 289, |
| 1153 | 289, 290, 290, 290, 290, 291, 291, 291, 292, 292, |
| 1154 | 292, 293, 293, 293, 293, 294, 294, 294, 295, 295, |
| 1155 | 295, 296, 296, 296, 296, 297, 297, 297, 298, 298, |
| 1156 | 298, 299, 299, 299, 299, 300, 300, 300, 301, 301, |
| 1157 | 301, 302, 302, 302, 302, 303, 303, 303, 304, 304, |
| 1158 | 304, 305, 305, 305, 305, 306, 306, 306, 307, 307, |
| 1159 | 307, 308, 308, 308, 308, 309, 309, 309, 310, 310, |
| 1160 | 310, 311, 311, 311, 311, 312, 312, 312, 313, 313, |
| 1161 | 313, 314, 314, 314, 315, 315, 315, 315, 316, 316, |
| 1162 | 316, 317, 317, 317, 318, 318, 318, 318, 319, 319, |
| 1163 | 319, 320, 320, 320, 321, 321, 321, 321, 322, 322, |
| 1164 | 322, 323, 323, 323, 324, 324, 324, 324, 325, 325, |
| 1165 | 325, 326, 326, 326, 327, 327, 327, 327, 328, 328, |
| 1166 | 328, 329, 329, 329, 330, 330, 330, 330, 331, 331, |
| 1167 | 331, 332, 332, 332, 333, 333, 333, 333, 334, 334, |
| 1168 | 334, 335, 335, 335, 336, 336, 336, 336, 337, 337, |
| 1169 | 337, 338, 338, 338, 339, 339, 339, 339, 340, 340, |
| 1170 | 340, 341, 341, 341, 342, 342, 342, 342, 343, 343, |
| 1171 | 343, 344, 344, 344, 345, 345, 345, 346, 346, 346, |
| 1172 | 346, 347, 347, 347, 348, 348, 348, 349, 349, 349, |
| 1173 | 349, 350, 350, 350, 351, 351, 351, 352, 352, 352, |
| 1174 | 352, 353, 353, 353, 354, 354, 354, 355, 355, 355, |
| 1175 | 355, 356, 356, 356, 357, 357, 357, 358, 358, 358, |
| 1176 | 358, 359, 359, 359, 360, 360, 360, 361, 361, 361, |
| 1177 | 361, 362, 362, 362, 363, 363, 363, 364, 364, 364, |
| 1178 | 364, 365, 365, 365, 366, 366, 366, 367, 367, 367, |
| 1179 | 367, 368, 368, 368, 369, 369, 369, 370, 370, 370, |
| 1180 | 370, 371, 371, 371, 372, 372, 372, 373, 373, 373, |
| 1181 | 374, 374, 374, 374, 375, 375, 375, 376, 376, 376, |
| 1182 | 377, 377, 377, 377, 378, 378, 378, 379, 379, 379, |
| 1183 | 380, 380, 380, 380, 381, 381, 381, 382, 382, 382, |
| 1184 | 383, 383, 383, 383, 384, 384, 384, 385, 385, 385, |
| 1185 | 386, 386, 386, 386, 387, 387, 387, 388, 388, 388, |
| 1186 | 389, 389, 389, 389, 390, 390, 390, 391, 391, 391, |
| 1187 | 392, 392, 392, 392, 393, 393, 393, 394, 394, 394, |
| 1188 | 395, 395, 395, 395, 396, 396, 396, 397, 397, 397, |
| 1189 | 398, 398, 398, 398, 399, 399, 399, 400, 400, 400, |
| 1190 | 401, 401, 401, 402, 402, 402, 402, 403, 403, 403, |
| 1191 | 404, 404, 404, 405, 405, 405, 405, 406, 406, 406, |
| 1192 | 407, 407, 407, 408, 408, 408, 408, 409, 409, 409, |
| 1193 | 410, 410, 410, 411, 411, 411, 411, 412, 412, 412, |
| 1194 | 413, 413, 413, 414, 414, 414, 414, 415, 415, 415, |
| 1195 | 416, 416, 416, 417, 417, 417, 417, 418, 418, 418, |
| 1196 | 419, 419, 419, 420, 420, 420, 420, 421, 421, 421, |
| 1197 | 422, 422, 422, 423, 423, 423, 423, 424, 424, 424, |
| 1198 | 425, 425, 425, 426, 426, 426, 426, 427, 427, 427, |
| 1199 | 428, 428, 428, 429, 429, 429, 429, 430, 430, 430, |
| 1200 | 431, 431, 431, 432, 432, 432, 433, 433, 433, 433, |
| 1201 | 434, 434, 434, 435, 435, 435, 436, 436, 436, 436, |
| 1202 | 437, 437, 437, 438, 438, 438, 439, 439, 439, 439, |
| 1203 | 440, 440, 440, 441, 441, 441, 442, 442, 442, 442, |
| 1204 | 443, 443, 443, 444, 444, 444, 445, 445, 445, 445, |
| 1205 | 446, 446, 446, 447, 447, 447, 448, 448, 448, 448, |
| 1206 | 449, 449, 449, 450, 450, 450, 451, 451, 451, 451, |
| 1207 | 452, 452, 452, 453, 453, 453, 454, 454, 454, 454, |
| 1208 | 455, 455, 455, 456, 456, 456, 457, 457, 457, 457, |
| 1209 | 458, 458, 458, 459, 459, 459, 460, 460, 460, 461, |
| 1210 | 461, 461, 461, 462, 462, 462, 463, 463, 463, 464, |
| 1211 | 464, 464, 464, 465, 465, 465, 466, 466, 466, 467, |
| 1212 | 467, 467, 467, 468, 468, 468, 469, 469, 469, 470, |
| 1213 | 470, 470, 470, 471, 471, 471, 472, 472, 472, 473, |
| 1214 | 473, 473, 473, 474, 474, 474, 475, 475, 475, 476, |
| 1215 | 476, 476, 476, 477, 477, 477, 478, 478, 478, 479, |
| 1216 | 479, 479, 479, 480, 480, 480, 481, 481, 481, 482, |
| 1217 | 482, 482, 482, 483, 483, 483, 484, 484, 484, 485, |
| 1218 | 485, 485, 485, 486, 486, 486, 487, 487, 487, 488, |
| 1219 | 488, 488, 488, 489, 489, 489, 490, 490, 490, 491, |
| 1220 | 491, 491, 492, 492, 492, 492, 493, 493, 493, 494, |
| 1221 | 494, 494, 495, 495, 495, 495, 496, 496, 496, 497, |
| 1222 | 497, 497, 498, 498, 498, 498, 499, 499, 499, 500, |
| 1223 | 500, 500, 501, 501, 501, 501, 502, 502, 502, 503, |
| 1224 | 503, 503, 504, 504, 504, 504, 505, 505, 505, 506, |
| 1225 | 506, 506, 507, 507, 507, 507, 508, 508, 508, 509, |
| 1226 | 509, 509, 510, 510, 510, 510, 511, 511, 511, 512, |
| 1227 | 512, 512, 513, 513, 513, 513, 514, 514, 514, 515, |
| 1228 | 515, 515, 516, 516, 516, 516, 517, 517, 517, 518, |
| 1229 | 518, 518, 519, 519, 519, 520, 520, 520, 520, 521, |
| 1230 | 521, 521, 522, 522, 522, 523, 523, 523, 523, 524, |
| 1231 | 524, 524, 525, 525, 525, 526, 526, 526, 526, 527, |
| 1232 | 527, 527, 528, 528, 528, 529, 529, 529, 529, 530, |
| 1233 | 530, 530, 531, 531, 531, 532, 532, 532, 532, 533, |
| 1234 | 533, 533, 534, 534, 534, 535, 535, 535, 535, 536, |
| 1235 | 536, 536, 537, 537, 537, 538, 538, 538, 538, 539, |
| 1236 | 539, 539, 540, 540, 540, 541, 541, 541, 541, 542, |
| 1237 | 542, 542, 543, 543, 543, 544, 544, 544, 544, 545, |
| 1238 | 545, 545, 546, 546, 546, 547, 547, 547, 548, 548, |
| 1239 | 548, 548, 549, 549, 549, 550, 550, 550, 551, 551, |
| 1240 | 551, 551, 552, 552, 552, 553, 553, 553, 554, 554, |
| 1241 | 554, 554, 555, 555, 555, 556, 556, 556, 557, 557, |
| 1242 | 557, 557, 558, 558, 558, 559, 559, 559, 560, 560, |
| 1243 | 560, 560, 561, 561, 561, 562, 562, 562, 563, 563, |
| 1244 | 563, 563, 564, 564, 564, 565, 565, 565, 566, 566, |
| 1245 | 566, 566, 567, 567, 567, 568, 568, 568, 569, 569, |
| 1246 | 569, 569, 570, 570, 570, 571, 571, 571, 572, 572, |
| 1247 | 572, 572, 573, 573, 573, 574, 574, 574, 575, 575, |
| 1248 | 575, 575, 576, 576, 576, 577, 577, 577, 578, 578, |
| 1249 | 578, 579, 579, 579, 579, 580, 580, 580, 581, 581, |
| 1250 | 581, 582, 582, 582, 582, 583, 583, 583, 584, 584, |
| 1251 | 584, 585, 585, 585, 585, 586, 586, 586, 587, 587, |
| 1252 | 587, 588, 588, 588, 588, 589, 589, 589, 590, 590, |
| 1253 | 590, 591, 591, 591, 591, 592, 592, 592, 593, 593, |
| 1254 | 593, 594, 594, 594, 594, 595, 595, 595, 596, 596, |
| 1255 | 596, 597, 597, 597, 597, 598, 598, 598, 599, 599, |
| 1256 | 599, 600, 600, 600, 600, 601, 601, 601, 602, 602, |
| 1257 | 602, 603, 603, 603, 603, 604, 604, 604, 605, 605, |
| 1258 | 605, 606, 606, 606, 607, 607, 607, 607, 608, 608, |
| 1259 | 608, 609, 609, 609, 610, 610, 610, 610, 611, 611, |
| 1260 | 611, 612, 612, 612, 613, 613, 613, 613, 614, 614, |
| 1261 | 614, 615, 615, 615, 616, 616, 616, 616, 617, 617, |
| 1262 | 617, 618, 618, 618, 619, 619, 619, 619, 620, 620, |
| 1263 | 620, 621, 621, 621, 622, 622, 622, 622, 623, 623, |
| 1264 | 623, 624, 624, 624, 625, 625, 625, 625, 626, 626, |
| 1265 | 626, 627, 627, 627, 628, 628, 628, 628, 629, 629, |
| 1266 | 629, 630, 630, 630, 631, 631, 631, 631, 632, 632, |
| 1267 | 632, 633, 633, 633, 634, 634, 634, 634, 635, 635, |
| 1268 | 635, 636, 636, 636, 637, 637, 637, 638, 638, 638, |
| 1269 | 638, 639, 639, 639, 640, 640, 640, 641, 641, 641, |
| 1270 | 641, 642, 642, 642, 643, 643, 643, 644, 644, 644, |
| 1271 | 644, 645, 645, 645, 646, 646, 646, 647, 647, 647, |
| 1272 | 647, 648, 648, 648, 649, 649, 649, 650, 650 }; |
| 1273 | static const ULLongunsigned long long pfive[27] = { |
| 1274 | 5ll, |
| 1275 | 25ll, |
| 1276 | 125ll, |
| 1277 | 625ll, |
| 1278 | 3125ll, |
| 1279 | 15625ll, |
| 1280 | 78125ll, |
| 1281 | 390625ll, |
| 1282 | 1953125ll, |
| 1283 | 9765625ll, |
| 1284 | 48828125ll, |
| 1285 | 244140625ll, |
| 1286 | 1220703125ll, |
| 1287 | 6103515625ll, |
| 1288 | 30517578125ll, |
| 1289 | 152587890625ll, |
| 1290 | 762939453125ll, |
| 1291 | 3814697265625ll, |
| 1292 | 19073486328125ll, |
| 1293 | 95367431640625ll, |
| 1294 | 476837158203125ll, |
| 1295 | 2384185791015625ll, |
| 1296 | 11920928955078125ll, |
| 1297 | 59604644775390625ll, |
| 1298 | 298023223876953125ll, |
| 1299 | 1490116119384765625ll, |
| 1300 | 7450580596923828125ll |
| 1301 | }; |
| 1302 | |
| 1303 | static const int pfivebits[25] = {3, 5, 7, 10, 12, 14, 17, 19, 21, 24, 26, 28, 31, |
| 1304 | 33, 35, 38, 40, 42, 45, 47, 49, 52, 54, 56, 59}; |
| 1305 | #endif /*}*/ |
| 1306 | #endif /*}} NO_LONG_LONG */ |
| 1307 | |
| 1308 | typedef union { double d; ULong L[2]; |
| 1309 | #ifdef USE_BF96 |
| 1310 | ULLongunsigned long long LL; |
| 1311 | #endif |
| 1312 | } U; |
| 1313 | |
| 1314 | #ifdef IEEE_8087 |
| 1315 | #define word0(x)(x)->L[1] (x)->L[1] |
| 1316 | #define word1(x)(x)->L[0] (x)->L[0] |
| 1317 | #else |
| 1318 | #define word0(x)(x)->L[1] (x)->L[0] |
| 1319 | #define word1(x)(x)->L[0] (x)->L[1] |
| 1320 | #endif |
| 1321 | #define dval(x)(x)->d (x)->d |
| 1322 | #define LLval(x)(x)->LL (x)->LL |
| 1323 | |
| 1324 | #ifndef STRTOD_DIGLIM40 |
| 1325 | #define STRTOD_DIGLIM40 40 |
| 1326 | #endif |
| 1327 | |
| 1328 | #ifdef DIGLIM_DEBUG |
| 1329 | extern int strtod_diglim40; |
| 1330 | #else |
| 1331 | #define strtod_diglim40 STRTOD_DIGLIM40 |
| 1332 | #endif |
| 1333 | |
| 1334 | /* The following definition of Storeinc is appropriate for MIPS processors. |
| 1335 | * An alternative that might be better on some machines is |
| 1336 | * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) |
| 1337 | */ |
| 1338 | #if defined(IEEE_8087) + defined(VAX) |
| 1339 | #define Storeinc(a,b,c)(((unsigned short *)a)[1] = (unsigned short)b, ((unsigned short *)a)[0] = (unsigned short)c, a++) (((unsigned short *)a)[1] = (unsigned short)b, \ |
| 1340 | ((unsigned short *)a)[0] = (unsigned short)c, a++) |
| 1341 | #else |
| 1342 | #define Storeinc(a,b,c)(((unsigned short *)a)[1] = (unsigned short)b, ((unsigned short *)a)[0] = (unsigned short)c, a++) (((unsigned short *)a)[0] = (unsigned short)b, \ |
| 1343 | ((unsigned short *)a)[1] = (unsigned short)c, a++) |
| 1344 | #endif |
| 1345 | |
| 1346 | /* #define P DBL_MANT_DIG */ |
| 1347 | /* Ten_pmax = floor(P*log(2)/log(5)) */ |
| 1348 | /* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ |
| 1349 | /* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ |
| 1350 | /* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ |
| 1351 | |
| 1352 | #ifdef IEEE_Arith |
| 1353 | #define Exp_shift20 20 |
| 1354 | #define Exp_shift120 20 |
| 1355 | #define Exp_msk10x100000 0x100000 |
| 1356 | #define Exp_msk110x100000 0x100000 |
| 1357 | #define Exp_mask0x7ff00000 0x7ff00000 |
| 1358 | #define P53 53 |
| 1359 | #define Nbits53 53 |
| 1360 | #define Bias1023 1023 |
| 1361 | #define Emax1023 1023 |
| 1362 | #define Emin(-1022) (-1022) |
| 1363 | #define Exp_10x3ff00000 0x3ff00000 |
| 1364 | #define Exp_110x3ff00000 0x3ff00000 |
| 1365 | #define Ebits11 11 |
| 1366 | #define Frac_mask0xfffff 0xfffff |
| 1367 | #define Frac_mask10xfffff 0xfffff |
| 1368 | #define Ten_pmax22 22 |
| 1369 | #define Bletch0x10 0x10 |
| 1370 | #define Bndry_mask0xfffff 0xfffff |
| 1371 | #define Bndry_mask10xfffff 0xfffff |
| 1372 | #define LSB1 1 |
| 1373 | #define Sign_bit0x80000000 0x80000000 |
| 1374 | #define Log2P1 1 |
| 1375 | #define Tiny00 0 |
| 1376 | #define Tiny11 1 |
| 1377 | #define Quick_max14 14 |
| 1378 | #define Int_max14 14 |
| 1379 | #ifndef NO_IEEE_Scale |
| 1380 | #define Avoid_Underflow |
| 1381 | #ifdef Flush_Denorm /* debugging option */ |
| 1382 | #undef Sudden_Underflow |
| 1383 | #endif |
| 1384 | #endif |
| 1385 | |
| 1386 | #ifndef Flt_Rounds(__builtin_flt_rounds()) |
| 1387 | #ifdef FLT_ROUNDS(__builtin_flt_rounds()) |
| 1388 | #define Flt_Rounds(__builtin_flt_rounds()) FLT_ROUNDS(__builtin_flt_rounds()) |
| 1389 | #else |
| 1390 | #define Flt_Rounds(__builtin_flt_rounds()) 1 |
| 1391 | #endif |
| 1392 | #endif /*Flt_Rounds*/ |
| 1393 | |
| 1394 | #ifdef Honor_FLT_ROUNDS |
| 1395 | #undef Check_FLT_ROUNDS |
| 1396 | #define Check_FLT_ROUNDS |
| 1397 | #else |
| 1398 | #define Rounding(__builtin_flt_rounds()) Flt_Rounds(__builtin_flt_rounds()) |
| 1399 | #endif |
| 1400 | |
| 1401 | #else /* ifndef IEEE_Arith */ |
| 1402 | #undef Check_FLT_ROUNDS |
| 1403 | #undef Honor_FLT_ROUNDS |
| 1404 | #undef SET_INEXACT |
| 1405 | #undef Sudden_Underflow |
| 1406 | #define Sudden_Underflow |
| 1407 | #ifdef IBM |
| 1408 | #undef Flt_Rounds(__builtin_flt_rounds()) |
| 1409 | #define Flt_Rounds(__builtin_flt_rounds()) 0 |
| 1410 | #define Exp_shift20 24 |
| 1411 | #define Exp_shift120 24 |
| 1412 | #define Exp_msk10x100000 0x1000000 |
| 1413 | #define Exp_msk110x100000 0x1000000 |
| 1414 | #define Exp_mask0x7ff00000 0x7f000000 |
| 1415 | #define P53 14 |
| 1416 | #define Nbits53 56 |
| 1417 | #define Bias1023 65 |
| 1418 | #define Emax1023 248 |
| 1419 | #define Emin(-1022) (-260) |
| 1420 | #define Exp_10x3ff00000 0x41000000 |
| 1421 | #define Exp_110x3ff00000 0x41000000 |
| 1422 | #define Ebits11 8 /* exponent has 7 bits, but 8 is the right value in b2d */ |
| 1423 | #define Frac_mask0xfffff 0xffffff |
| 1424 | #define Frac_mask10xfffff 0xffffff |
| 1425 | #define Bletch0x10 4 |
| 1426 | #define Ten_pmax22 22 |
| 1427 | #define Bndry_mask0xfffff 0xefffff |
| 1428 | #define Bndry_mask10xfffff 0xffffff |
| 1429 | #define LSB1 1 |
| 1430 | #define Sign_bit0x80000000 0x80000000 |
| 1431 | #define Log2P1 4 |
| 1432 | #define Tiny00 0x100000 |
| 1433 | #define Tiny11 0 |
| 1434 | #define Quick_max14 14 |
| 1435 | #define Int_max14 15 |
| 1436 | #else /* VAX */ |
| 1437 | #undef Flt_Rounds(__builtin_flt_rounds()) |
| 1438 | #define Flt_Rounds(__builtin_flt_rounds()) 1 |
| 1439 | #define Exp_shift20 23 |
| 1440 | #define Exp_shift120 7 |
| 1441 | #define Exp_msk10x100000 0x80 |
| 1442 | #define Exp_msk110x100000 0x800000 |
| 1443 | #define Exp_mask0x7ff00000 0x7f80 |
| 1444 | #define P53 56 |
| 1445 | #define Nbits53 56 |
| 1446 | #define Bias1023 129 |
| 1447 | #define Emax1023 126 |
| 1448 | #define Emin(-1022) (-129) |
| 1449 | #define Exp_10x3ff00000 0x40800000 |
| 1450 | #define Exp_110x3ff00000 0x4080 |
| 1451 | #define Ebits11 8 |
| 1452 | #define Frac_mask0xfffff 0x7fffff |
| 1453 | #define Frac_mask10xfffff 0xffff007f |
| 1454 | #define Ten_pmax22 24 |
| 1455 | #define Bletch0x10 2 |
| 1456 | #define Bndry_mask0xfffff 0xffff007f |
| 1457 | #define Bndry_mask10xfffff 0xffff007f |
| 1458 | #define LSB1 0x10000 |
| 1459 | #define Sign_bit0x80000000 0x8000 |
| 1460 | #define Log2P1 1 |
| 1461 | #define Tiny00 0x80 |
| 1462 | #define Tiny11 0 |
| 1463 | #define Quick_max14 15 |
| 1464 | #define Int_max14 15 |
| 1465 | #endif /* IBM, VAX */ |
| 1466 | #endif /* IEEE_Arith */ |
| 1467 | |
| 1468 | #ifndef IEEE_Arith |
| 1469 | #define ROUND_BIASED |
| 1470 | #else |
| 1471 | #ifdef ROUND_BIASED_without_Round_Up |
| 1472 | #undef ROUND_BIASED |
| 1473 | #define ROUND_BIASED |
| 1474 | #endif |
| 1475 | #endif |
| 1476 | |
| 1477 | #ifdef RND_PRODQUOT |
| 1478 | #define rounded_product(a,b)a *= b a = rnd_prod(a, b) |
| 1479 | #define rounded_quotient(a,b)a /= b a = rnd_quot(a, b) |
| 1480 | extern double rnd_prod(double, double), rnd_quot(double, double); |
| 1481 | #else |
| 1482 | #define rounded_product(a,b)a *= b a *= b |
| 1483 | #define rounded_quotient(a,b)a /= b a /= b |
| 1484 | #endif |
| 1485 | |
| 1486 | #define Big0(0xfffff | 0x100000*(1024 +1023 -1)) (Frac_mask10xfffff | Exp_msk10x100000*(DBL_MAX_EXP1024+Bias1023-1)) |
| 1487 | #define Big10xffffffff 0xffffffff |
| 1488 | |
| 1489 | #ifndef Pack_32 |
| 1490 | #define Pack_32 |
| 1491 | #endif |
| 1492 | |
| 1493 | typedef struct BCinfo BCinfo; |
| 1494 | struct |
| 1495 | BCinfo { int dp0, dp1, dplen, dsign, e0, inexact, nd, nd0, rounding, scale, uflchk; }; |
| 1496 | |
| 1497 | #define FFFFFFFF0xffffffffUL 0xffffffffUL |
| 1498 | |
| 1499 | #ifdef MULTIPLE_THREADS |
| 1500 | #define MTa , PTI |
| 1501 | #define MTb , &TI |
| 1502 | #define MTd , ThInfo **PTI |
| 1503 | static unsigned int maxthreads = 0; |
| 1504 | #else |
| 1505 | #define MTa /*nothing*/ |
| 1506 | #define MTb /*nothing*/ |
| 1507 | #define MTd /*nothing*/ |
| 1508 | #endif |
| 1509 | |
| 1510 | #define Kmax7 7 |
| 1511 | |
| 1512 | #ifdef __cplusplus |
| 1513 | extern "C" char *dtoa(double d, int mode, int ndigits, |
| 1514 | int *decpt, int *sign, char **rve); |
| 1515 | #endif |
| 1516 | |
| 1517 | struct |
| 1518 | Bigint { |
| 1519 | struct Bigint *next; |
| 1520 | int k, maxwds, sign, wds; |
| 1521 | ULong x[1]; |
| 1522 | }; |
| 1523 | |
| 1524 | typedef struct Bigint Bigint; |
| 1525 | typedef struct |
| 1526 | ThInfo { |
| 1527 | Bigint *Freelist[Kmax7+1]; |
| 1528 | Bigint *P5s; |
| 1529 | } ThInfo; |
| 1530 | |
| 1531 | static ThInfo TI0; |
| 1532 | |
| 1533 | #ifdef MULTIPLE_THREADS |
| 1534 | static ThInfo *TI1; |
| 1535 | static int TI0_used; |
| 1536 | |
| 1537 | void |
| 1538 | set_max_dtoa_threads(unsigned int n) |
| 1539 | { |
| 1540 | size_t L; |
| 1541 | |
| 1542 | if (n > maxthreads) { |
| 1543 | L = n*sizeof(ThInfo); |
| 1544 | if (TI1) { |
| 1545 | TI1 = (ThInfo*)REALLOCg_realloc(TI1, L); |
| 1546 | memset(TI1 + maxthreads, 0, (n-maxthreads)*sizeof(ThInfo)); |
| 1547 | } |
| 1548 | else { |
| 1549 | TI1 = (ThInfo*)MALLOCg_malloc(L); |
| 1550 | if (TI0_used) { |
| 1551 | memcpy(TI1, &TI0, sizeof(ThInfo)); |
| 1552 | if (n > 1) |
| 1553 | memset(TI1 + 1, 0, L - sizeof(ThInfo)); |
| 1554 | memset(&TI0, 0, sizeof(ThInfo)); |
| 1555 | } |
| 1556 | else |
| 1557 | memset(TI1, 0, L); |
| 1558 | } |
| 1559 | maxthreads = n; |
| 1560 | } |
| 1561 | } |
| 1562 | |
| 1563 | static ThInfo* |
| 1564 | get_TI(void) |
| 1565 | { |
| 1566 | unsigned int thno = dtoa_get_threadno(); |
| 1567 | if (thno < maxthreads) |
| 1568 | return TI1 + thno; |
| 1569 | if (thno == 0) |
| 1570 | TI0_used = 1; |
| 1571 | return &TI0; |
| 1572 | } |
| 1573 | #define freelistTI0.Freelist TI->Freelist |
| 1574 | #define p5sTI0.P5s TI->P5s |
| 1575 | #else |
| 1576 | #define freelistTI0.Freelist TI0.Freelist |
| 1577 | #define p5sTI0.P5s TI0.P5s |
| 1578 | #endif |
| 1579 | |
| 1580 | static Bigint * |
| 1581 | Balloc(int k MTd) |
| 1582 | { |
| 1583 | int x; |
| 1584 | Bigint *rv; |
| 1585 | #ifndef Omit_Private_Memory |
| 1586 | unsigned int len; |
| 1587 | #endif |
| 1588 | #ifdef MULTIPLE_THREADS |
| 1589 | ThInfo *TI; |
| 1590 | |
| 1591 | if (!(TI = *PTI)) |
| 1592 | *PTI = TI = get_TI(); |
| 1593 | if (TI == &TI0) |
| 1594 | ACQUIRE_DTOA_LOCK(0); |
| 1595 | #endif |
| 1596 | /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ |
| 1597 | /* but this case seems very unlikely. */ |
| 1598 | if (k <= Kmax7 && (rv = freelistTI0.Freelist[k])) |
| 1599 | freelistTI0.Freelist[k] = rv->next; |
| 1600 | else { |
| 1601 | x = 1 << k; |
| 1602 | #ifdef Omit_Private_Memory |
| 1603 | rv = (Bigint *)MALLOCg_malloc(sizeof(Bigint) + (x-1)*sizeof(ULong)); |
| 1604 | #else |
| 1605 | len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) |
| 1606 | /sizeof(double); |
| 1607 | if (k <= Kmax7 && pmem_next - private_mem + len <= (ssize_t)PRIVATE_mem((2304 +sizeof(double)-1)/sizeof(double)) |
| 1608 | #ifdef MULTIPLE_THREADS |
| 1609 | && TI == TI1 |
| 1610 | #endif |
| 1611 | ) { |
| 1612 | rv = (Bigint*)pmem_next; |
| 1613 | pmem_next += len; |
| 1614 | } |
| 1615 | else |
| 1616 | rv = (Bigint*)MALLOCg_malloc(len*sizeof(double)); |
| 1617 | #endif |
| 1618 | rv->k = k; |
| 1619 | rv->maxwds = x; |
| 1620 | } |
| 1621 | #ifdef MULTIPLE_THREADS |
| 1622 | if (TI == &TI0) |
| 1623 | FREE_DTOA_LOCK(0); |
| 1624 | #endif |
| 1625 | rv->sign = rv->wds = 0; |
| 1626 | return rv; |
| 1627 | } |
| 1628 | |
| 1629 | static void |
| 1630 | Bfree(Bigint *v MTd) |
| 1631 | { |
| 1632 | #ifdef MULTIPLE_THREADS |
| 1633 | ThInfo *TI; |
| 1634 | #endif |
| 1635 | if (v) { |
| 1636 | if (v->k > Kmax7) |
| 1637 | FREEg_free((void*)v); |
| 1638 | else { |
| 1639 | #ifdef MULTIPLE_THREADS |
| 1640 | if (!(TI = *PTI)) |
| 1641 | *PTI = TI = get_TI(); |
| 1642 | if (TI == &TI0) |
| 1643 | ACQUIRE_DTOA_LOCK(0); |
| 1644 | #endif |
| 1645 | v->next = freelistTI0.Freelist[v->k]; |
| 1646 | freelistTI0.Freelist[v->k] = v; |
| 1647 | #ifdef MULTIPLE_THREADS |
| 1648 | if (TI == &TI0) |
| 1649 | FREE_DTOA_LOCK(0); |
| 1650 | #endif |
| 1651 | } |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | #define Bcopy(x,y)memcpy((char *)&x->sign, (char *)&y->sign, y-> wds*sizeof(int) + 2*sizeof(int)) memcpy((char *)&x->sign, (char *)&y->sign, \ |
| 1656 | y->wds*sizeof(Longint) + 2*sizeof(int)) |
| 1657 | |
| 1658 | static Bigint * |
| 1659 | multadd(Bigint *b, int m, int a MTd) /* multiply by m and add a */ |
| 1660 | { |
| 1661 | int i, wds; |
| 1662 | #ifdef ULLongunsigned long long |
| 1663 | ULong *x; |
| 1664 | ULLongunsigned long long carry, y; |
| 1665 | #else |
| 1666 | ULong carry, *x, y; |
| 1667 | #ifdef Pack_32 |
| 1668 | ULong xi, z; |
| 1669 | #endif |
| 1670 | #endif |
| 1671 | Bigint *b1; |
| 1672 | |
| 1673 | wds = b->wds; |
| 1674 | x = b->x; |
| 1675 | i = 0; |
| 1676 | carry = a; |
| 1677 | do { |
| 1678 | #ifdef ULLongunsigned long long |
| 1679 | y = *x * (ULLongunsigned long long)m + carry; |
| 1680 | carry = y >> 32; |
| 1681 | *x++ = y & FFFFFFFF0xffffffffUL; |
| 1682 | #else |
| 1683 | #ifdef Pack_32 |
| 1684 | xi = *x; |
| 1685 | y = (xi & 0xffff) * m + carry; |
| 1686 | z = (xi >> 16) * m + (y >> 16); |
| 1687 | carry = z >> 16; |
| 1688 | *x++ = (z << 16) + (y & 0xffff); |
| 1689 | #else |
| 1690 | y = *x * m + carry; |
| 1691 | carry = y >> 16; |
| 1692 | *x++ = y & 0xffff; |
| 1693 | #endif |
| 1694 | #endif |
| 1695 | } |
| 1696 | while(++i < wds); |
| 1697 | if (carry) { |
| 1698 | if (wds >= b->maxwds) { |
| 1699 | b1 = Balloc(b->k+1 MTa); |
| 1700 | Bcopy(b1, b)memcpy((char *)&b1->sign, (char *)&b->sign, b-> wds*sizeof(int) + 2*sizeof(int)); |
| 1701 | Bfree(b MTa); |
| 1702 | b = b1; |
| 1703 | } |
| 1704 | b->x[wds++] = (ULong)carry; |
| 1705 | b->wds = wds; |
| 1706 | } |
| 1707 | return b; |
| 1708 | } |
| 1709 | |
| 1710 | static int |
| 1711 | hi0bits(ULong x) |
| 1712 | { |
| 1713 | int k = 0; |
| 1714 | |
| 1715 | if (!(x & 0xffff0000)) { |
| 1716 | k = 16; |
| 1717 | x <<= 16; |
| 1718 | } |
| 1719 | if (!(x & 0xff000000)) { |
| 1720 | k += 8; |
| 1721 | x <<= 8; |
| 1722 | } |
| 1723 | if (!(x & 0xf0000000)) { |
| 1724 | k += 4; |
| 1725 | x <<= 4; |
| 1726 | } |
| 1727 | if (!(x & 0xc0000000)) { |
| 1728 | k += 2; |
| 1729 | x <<= 2; |
| 1730 | } |
| 1731 | if (!(x & 0x80000000)) { |
| 1732 | k++; |
| 1733 | if (!(x & 0x40000000)) |
| 1734 | return 32; |
| 1735 | } |
| 1736 | return k; |
| 1737 | } |
| 1738 | |
| 1739 | static int |
| 1740 | lo0bits(ULong *y) |
| 1741 | { |
| 1742 | int k; |
| 1743 | ULong x = *y; |
| 1744 | |
| 1745 | if (x & 7) { |
| 1746 | if (x & 1) |
| 1747 | return 0; |
| 1748 | if (x & 2) { |
| 1749 | *y = x >> 1; |
| 1750 | return 1; |
| 1751 | } |
| 1752 | *y = x >> 2; |
| 1753 | return 2; |
| 1754 | } |
| 1755 | k = 0; |
| 1756 | if (!(x & 0xffff)) { |
| 1757 | k = 16; |
| 1758 | x >>= 16; |
| 1759 | } |
| 1760 | if (!(x & 0xff)) { |
| 1761 | k += 8; |
| 1762 | x >>= 8; |
| 1763 | } |
| 1764 | if (!(x & 0xf)) { |
| 1765 | k += 4; |
| 1766 | x >>= 4; |
| 1767 | } |
| 1768 | if (!(x & 0x3)) { |
| 1769 | k += 2; |
| 1770 | x >>= 2; |
| 1771 | } |
| 1772 | if (!(x & 1)) { |
| 1773 | k++; |
| 1774 | x >>= 1; |
| 1775 | if (!x) |
| 1776 | return 32; |
| 1777 | } |
| 1778 | *y = x; |
| 1779 | return k; |
| 1780 | } |
| 1781 | |
| 1782 | static Bigint * |
| 1783 | i2b(int i MTd) |
| 1784 | { |
| 1785 | Bigint *b; |
| 1786 | |
| 1787 | b = Balloc(1 MTa); |
| 1788 | b->x[0] = i; |
| 1789 | b->wds = 1; |
| 1790 | return b; |
| 1791 | } |
| 1792 | |
| 1793 | static Bigint * |
| 1794 | mult(Bigint *a, Bigint *b MTd) |
| 1795 | { |
| 1796 | Bigint *c; |
| 1797 | int k, wa, wb, wc; |
| 1798 | ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; |
| 1799 | ULong y; |
| 1800 | #ifdef ULLongunsigned long long |
| 1801 | ULLongunsigned long long carry, z; |
| 1802 | #else |
| 1803 | ULong carry, z; |
| 1804 | #ifdef Pack_32 |
| 1805 | ULong z2; |
| 1806 | #endif |
| 1807 | #endif |
| 1808 | |
| 1809 | if (a->wds < b->wds) { |
| 1810 | c = a; |
| 1811 | a = b; |
| 1812 | b = c; |
| 1813 | } |
| 1814 | k = a->k; |
| 1815 | wa = a->wds; |
| 1816 | wb = b->wds; |
| 1817 | wc = wa + wb; |
| 1818 | if (wc > a->maxwds) |
| 1819 | k++; |
| 1820 | c = Balloc(k MTa); |
| 1821 | for(x = c->x, xa = x + wc; x < xa; x++) |
| 1822 | *x = 0; |
| 1823 | xa = a->x; |
| 1824 | xae = xa + wa; |
| 1825 | xb = b->x; |
| 1826 | xbe = xb + wb; |
| 1827 | xc0 = c->x; |
| 1828 | #ifdef ULLongunsigned long long |
| 1829 | for(; xb < xbe; xc0++) { |
| 1830 | if ((y = *xb++)) { |
| 1831 | x = xa; |
| 1832 | xc = xc0; |
| 1833 | carry = 0; |
| 1834 | do { |
| 1835 | z = *x++ * (ULLongunsigned long long)y + *xc + carry; |
| 1836 | carry = z >> 32; |
| 1837 | *xc++ = z & FFFFFFFF0xffffffffUL; |
| 1838 | } |
| 1839 | while(x < xae); |
| 1840 | *xc = (ULong)carry; |
| 1841 | } |
| 1842 | } |
| 1843 | #else |
| 1844 | #ifdef Pack_32 |
| 1845 | for(; xb < xbe; xb++, xc0++) { |
| 1846 | if ((y = *xb & 0xffff)) { |
| 1847 | x = xa; |
| 1848 | xc = xc0; |
| 1849 | carry = 0; |
| 1850 | do { |
| 1851 | z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; |
| 1852 | carry = z >> 16; |
| 1853 | z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; |
| 1854 | carry = z2 >> 16; |
| 1855 | Storeinc(xc, z2, z)(((unsigned short *)xc)[1] = (unsigned short)z2, ((unsigned short *)xc)[0] = (unsigned short)z, xc++); |
| 1856 | } |
| 1857 | while(x < xae); |
| 1858 | *xc = carry; |
| 1859 | } |
| 1860 | if ((y = *xb >> 16)) { |
| 1861 | x = xa; |
| 1862 | xc = xc0; |
| 1863 | carry = 0; |
| 1864 | z2 = *xc; |
| 1865 | do { |
| 1866 | z = (*x & 0xffff) * y + (*xc >> 16) + carry; |
| 1867 | carry = z >> 16; |
| 1868 | Storeinc(xc, z, z2)(((unsigned short *)xc)[1] = (unsigned short)z, ((unsigned short *)xc)[0] = (unsigned short)z2, xc++); |
| 1869 | z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; |
| 1870 | carry = z2 >> 16; |
| 1871 | } |
| 1872 | while(x < xae); |
| 1873 | *xc = z2; |
| 1874 | } |
| 1875 | } |
| 1876 | #else |
| 1877 | for(; xb < xbe; xc0++) { |
| 1878 | if (y = *xb++) { |
| 1879 | x = xa; |
| 1880 | xc = xc0; |
| 1881 | carry = 0; |
| 1882 | do { |
| 1883 | z = *x++ * y + *xc + carry; |
| 1884 | carry = z >> 16; |
| 1885 | *xc++ = z & 0xffff; |
| 1886 | } |
| 1887 | while(x < xae); |
| 1888 | *xc = carry; |
| 1889 | } |
| 1890 | } |
| 1891 | #endif |
| 1892 | #endif |
| 1893 | for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; |
| 1894 | c->wds = wc; |
| 1895 | return c; |
| 1896 | } |
| 1897 | |
| 1898 | static Bigint * |
| 1899 | pow5mult(Bigint *b, int k MTd) |
| 1900 | { |
| 1901 | Bigint *b1, *p5, *p51; |
| 1902 | #ifdef MULTIPLE_THREADS |
| 1903 | ThInfo *TI; |
| 1904 | #endif |
| 1905 | int i; |
| 1906 | static const int p05[3] = { 5, 25, 125 }; |
| 1907 | |
| 1908 | if ((i = k & 3)) |
| 1909 | b = multadd(b, p05[i-1], 0 MTa); |
| 1910 | |
| 1911 | if (!(k >>= 2)) |
| 1912 | return b; |
| 1913 | #ifdef MULTIPLE_THREADS |
| 1914 | if (!(TI = *PTI)) |
| 1915 | *PTI = TI = get_TI(); |
| 1916 | #endif |
| 1917 | if (!(p5 = p5sTI0.P5s)) { |
| 1918 | /* first time */ |
| 1919 | #ifdef MULTIPLE_THREADS |
| 1920 | if (!(TI = *PTI)) |
| 1921 | *PTI = TI = get_TI(); |
| 1922 | if (TI == &TI0) |
| 1923 | ACQUIRE_DTOA_LOCK(1); |
| 1924 | if (!(p5 = p5sTI0.P5s)) { |
| 1925 | p5 = p5sTI0.P5s = i2b(625 MTa); |
| 1926 | p5->next = 0; |
| 1927 | } |
| 1928 | if (TI == &TI0) |
| 1929 | FREE_DTOA_LOCK(1); |
| 1930 | #else |
| 1931 | p5 = p5sTI0.P5s = i2b(625 MTa); |
| 1932 | p5->next = 0; |
| 1933 | #endif |
| 1934 | } |
| 1935 | for(;;) { |
| 1936 | if (k & 1) { |
| 1937 | b1 = mult(b, p5 MTa); |
| 1938 | Bfree(b MTa); |
| 1939 | b = b1; |
| 1940 | } |
| 1941 | if (!(k >>= 1)) |
| 1942 | break; |
| 1943 | if (!(p51 = p5->next)) { |
| 1944 | #ifdef MULTIPLE_THREADS |
| 1945 | if (!TI && !(TI = *PTI)) |
| 1946 | *PTI = TI = get_TI(); |
| 1947 | if (TI == &TI0) |
| 1948 | ACQUIRE_DTOA_LOCK(1); |
| 1949 | if (!(p51 = p5->next)) { |
| 1950 | p51 = p5->next = mult(p5,p5 MTa); |
| 1951 | p51->next = 0; |
| 1952 | } |
| 1953 | if (TI == &TI0) |
| 1954 | FREE_DTOA_LOCK(1); |
| 1955 | #else |
| 1956 | p51 = p5->next = mult(p5,p5); |
| 1957 | p51->next = 0; |
| 1958 | #endif |
| 1959 | } |
| 1960 | p5 = p51; |
| 1961 | } |
| 1962 | return b; |
| 1963 | } |
| 1964 | |
| 1965 | static Bigint * |
| 1966 | lshift(Bigint *b, int k MTd) |
| 1967 | { |
| 1968 | int i, k1, n, n1; |
| 1969 | Bigint *b1; |
| 1970 | ULong *x, *x1, *xe, z; |
| 1971 | |
| 1972 | #ifdef Pack_32 |
| 1973 | n = k >> 5; |
| 1974 | #else |
| 1975 | n = k >> 4; |
| 1976 | #endif |
| 1977 | k1 = b->k; |
| 1978 | n1 = n + b->wds + 1; |
| 1979 | for(i = b->maxwds; n1 > i; i <<= 1) |
| 1980 | k1++; |
| 1981 | b1 = Balloc(k1 MTa); |
| 1982 | x1 = b1->x; |
| 1983 | for(i = 0; i < n; i++) |
| 1984 | *x1++ = 0; |
| 1985 | x = b->x; |
| 1986 | xe = x + b->wds; |
| 1987 | #ifdef Pack_32 |
| 1988 | if (k &= 0x1f) { |
| 1989 | k1 = 32 - k; |
| 1990 | z = 0; |
| 1991 | do { |
| 1992 | *x1++ = *x << k | z; |
| 1993 | z = *x++ >> k1; |
| 1994 | } |
| 1995 | while(x < xe); |
| 1996 | if ((*x1 = z)) |
| 1997 | ++n1; |
| 1998 | } |
| 1999 | #else |
| 2000 | if (k &= 0xf) { |
| 2001 | k1 = 16 - k; |
| 2002 | z = 0; |
| 2003 | do { |
| 2004 | *x1++ = *x << k & 0xffff | z; |
| 2005 | z = *x++ >> k1; |
| 2006 | } |
| 2007 | while(x < xe); |
| 2008 | if (*x1 = z) |
| 2009 | ++n1; |
| 2010 | } |
| 2011 | #endif |
| 2012 | else do |
| 2013 | *x1++ = *x++; |
| 2014 | while(x < xe); |
| 2015 | b1->wds = n1 - 1; |
| 2016 | Bfree(b MTa); |
| 2017 | return b1; |
| 2018 | } |
| 2019 | |
| 2020 | static int |
| 2021 | cmp(Bigint *a, Bigint *b) |
| 2022 | { |
| 2023 | ULong *xa, *xa0, *xb, *xb0; |
| 2024 | int i, j; |
| 2025 | |
| 2026 | i = a->wds; |
| 2027 | j = b->wds; |
| 2028 | #ifdef DEBUG |
| 2029 | if (i > 1 && !a->x[i-1]) |
| 2030 | Bug("cmp called with a->x[a->wds-1] == 0"); |
| 2031 | if (j > 1 && !b->x[j-1]) |
| 2032 | Bug("cmp called with b->x[b->wds-1] == 0"); |
| 2033 | #endif |
| 2034 | if (i -= j) |
| 2035 | return i; |
| 2036 | xa0 = a->x; |
| 2037 | xa = xa0 + j; |
| 2038 | xb0 = b->x; |
| 2039 | xb = xb0 + j; |
| 2040 | for(;;) { |
| 2041 | if (*--xa != *--xb) |
| 2042 | return *xa < *xb ? -1 : 1; |
| 2043 | if (xa <= xa0) |
| 2044 | break; |
| 2045 | } |
| 2046 | return 0; |
| 2047 | } |
| 2048 | |
| 2049 | static Bigint * |
| 2050 | diff(Bigint *a, Bigint *b MTd) |
| 2051 | { |
| 2052 | Bigint *c; |
| 2053 | int i, wa, wb; |
| 2054 | ULong *xa, *xae, *xb, *xbe, *xc; |
| 2055 | #ifdef ULLongunsigned long long |
| 2056 | ULLongunsigned long long borrow, y; |
| 2057 | #else |
| 2058 | ULong borrow, y; |
| 2059 | #ifdef Pack_32 |
| 2060 | ULong z; |
| 2061 | #endif |
| 2062 | #endif |
| 2063 | |
| 2064 | i = cmp(a,b); |
| 2065 | if (!i) { |
| 2066 | c = Balloc(0 MTa); |
| 2067 | c->wds = 1; |
| 2068 | c->x[0] = 0; |
| 2069 | return c; |
| 2070 | } |
| 2071 | if (i < 0) { |
| 2072 | c = a; |
| 2073 | a = b; |
| 2074 | b = c; |
| 2075 | i = 1; |
| 2076 | } |
| 2077 | else |
| 2078 | i = 0; |
| 2079 | c = Balloc(a->k MTa); |
| 2080 | c->sign = i; |
| 2081 | wa = a->wds; |
| 2082 | xa = a->x; |
| 2083 | xae = xa + wa; |
| 2084 | wb = b->wds; |
| 2085 | xb = b->x; |
| 2086 | xbe = xb + wb; |
| 2087 | xc = c->x; |
| 2088 | borrow = 0; |
| 2089 | #ifdef ULLongunsigned long long |
| 2090 | do { |
| 2091 | y = (ULLongunsigned long long)*xa++ - *xb++ - borrow; |
| 2092 | borrow = y >> 32 & (ULong)1; |
| 2093 | *xc++ = y & FFFFFFFF0xffffffffUL; |
| 2094 | } |
| 2095 | while(xb < xbe); |
| 2096 | while(xa < xae) { |
| 2097 | y = *xa++ - borrow; |
| 2098 | borrow = y >> 32 & (ULong)1; |
| 2099 | *xc++ = y & FFFFFFFF0xffffffffUL; |
| 2100 | } |
| 2101 | #else |
| 2102 | #ifdef Pack_32 |
| 2103 | do { |
| 2104 | y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; |
| 2105 | borrow = (y & 0x10000) >> 16; |
| 2106 | z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; |
| 2107 | borrow = (z & 0x10000) >> 16; |
| 2108 | Storeinc(xc, z, y)(((unsigned short *)xc)[1] = (unsigned short)z, ((unsigned short *)xc)[0] = (unsigned short)y, xc++); |
| 2109 | } |
| 2110 | while(xb < xbe); |
| 2111 | while(xa < xae) { |
| 2112 | y = (*xa & 0xffff) - borrow; |
| 2113 | borrow = (y & 0x10000) >> 16; |
| 2114 | z = (*xa++ >> 16) - borrow; |
| 2115 | borrow = (z & 0x10000) >> 16; |
| 2116 | Storeinc(xc, z, y)(((unsigned short *)xc)[1] = (unsigned short)z, ((unsigned short *)xc)[0] = (unsigned short)y, xc++); |
| 2117 | } |
| 2118 | #else |
| 2119 | do { |
| 2120 | y = *xa++ - *xb++ - borrow; |
| 2121 | borrow = (y & 0x10000) >> 16; |
| 2122 | *xc++ = y & 0xffff; |
| 2123 | } |
| 2124 | while(xb < xbe); |
| 2125 | while(xa < xae) { |
| 2126 | y = *xa++ - borrow; |
| 2127 | borrow = (y & 0x10000) >> 16; |
| 2128 | *xc++ = y & 0xffff; |
| 2129 | } |
| 2130 | #endif |
| 2131 | #endif |
| 2132 | while(!*--xc) |
| 2133 | wa--; |
| 2134 | c->wds = wa; |
| 2135 | return c; |
| 2136 | } |
| 2137 | |
| 2138 | static Bigint * |
| 2139 | d2b(U *d, int *e, int *bits MTd) |
| 2140 | { |
| 2141 | Bigint *b; |
| 2142 | int de, k; |
| 2143 | ULong *x, y, z; |
| 2144 | #ifndef Sudden_Underflow |
| 2145 | int i; |
| 2146 | #endif |
| 2147 | #ifdef VAX |
| 2148 | ULong d0, d1; |
| 2149 | d0 = word0(d)(d)->L[1] >> 16 | word0(d)(d)->L[1] << 16; |
| 2150 | d1 = word1(d)(d)->L[0] >> 16 | word1(d)(d)->L[0] << 16; |
| 2151 | #else |
| 2152 | #define d0 word0(d)(d)->L[1] |
| 2153 | #define d1 word1(d)(d)->L[0] |
| 2154 | #endif |
| 2155 | |
| 2156 | #ifdef Pack_32 |
| 2157 | b = Balloc(1 MTa); |
| 2158 | #else |
| 2159 | b = Balloc(2 MTa); |
| 2160 | #endif |
| 2161 | x = b->x; |
| 2162 | |
| 2163 | z = d0 & Frac_mask0xfffff; |
| 2164 | d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ |
| 2165 | #ifdef Sudden_Underflow |
| 2166 | de = (int)(d0 >> Exp_shift20); |
| 2167 | #ifndef IBM |
| 2168 | z |= Exp_msk110x100000; |
| 2169 | #endif |
| 2170 | #else |
| 2171 | if ((de = (int)(d0 >> Exp_shift20))) |
| 2172 | z |= Exp_msk10x100000; |
| 2173 | #endif |
| 2174 | #ifdef Pack_32 |
| 2175 | if ((y = d1)) { |
| 2176 | if ((k = lo0bits(&y))) { |
| 2177 | x[0] = y | z << (32 - k); |
| 2178 | z >>= k; |
| 2179 | } |
| 2180 | else |
| 2181 | x[0] = y; |
| 2182 | #ifndef Sudden_Underflow |
| 2183 | i = |
| 2184 | #endif |
| 2185 | b->wds = (x[1] = z) ? 2 : 1; |
| 2186 | } |
| 2187 | else { |
| 2188 | k = lo0bits(&z); |
| 2189 | x[0] = z; |
| 2190 | #ifndef Sudden_Underflow |
| 2191 | i = |
| 2192 | #endif |
| 2193 | b->wds = 1; |
| 2194 | k += 32; |
| 2195 | } |
| 2196 | #else |
| 2197 | if (y = d1) { |
| 2198 | if (k = lo0bits(&y)) |
| 2199 | if (k >= 16) { |
| 2200 | x[0] = y | z << 32 - k & 0xffff; |
| 2201 | x[1] = z >> k - 16 & 0xffff; |
| 2202 | x[2] = z >> k; |
| 2203 | i = 2; |
| 2204 | } |
| 2205 | else { |
| 2206 | x[0] = y & 0xffff; |
| 2207 | x[1] = y >> 16 | z << 16 - k & 0xffff; |
| 2208 | x[2] = z >> k & 0xffff; |
| 2209 | x[3] = z >> k+16; |
| 2210 | i = 3; |
| 2211 | } |
| 2212 | else { |
| 2213 | x[0] = y & 0xffff; |
| 2214 | x[1] = y >> 16; |
| 2215 | x[2] = z & 0xffff; |
| 2216 | x[3] = z >> 16; |
| 2217 | i = 3; |
| 2218 | } |
| 2219 | } |
| 2220 | else { |
| 2221 | #ifdef DEBUG |
| 2222 | if (!z) |
| 2223 | Bug("Zero passed to d2b"); |
| 2224 | #endif |
| 2225 | k = lo0bits(&z); |
| 2226 | if (k >= 16) { |
| 2227 | x[0] = z; |
| 2228 | i = 0; |
| 2229 | } |
| 2230 | else { |
| 2231 | x[0] = z & 0xffff; |
| 2232 | x[1] = z >> 16; |
| 2233 | i = 1; |
| 2234 | } |
| 2235 | k += 32; |
| 2236 | } |
| 2237 | while(!x[i]) |
| 2238 | --i; |
| 2239 | b->wds = i + 1; |
| 2240 | #endif |
| 2241 | #ifndef Sudden_Underflow |
| 2242 | if (de) { |
| 2243 | #endif |
| 2244 | #ifdef IBM |
| 2245 | *e = (de - Bias1023 - (P53-1) << 2) + k; |
| 2246 | *bits = 4*P53 + 8 - k - hi0bits(word0(d)(d)->L[1] & Frac_mask0xfffff); |
| 2247 | #else |
| 2248 | *e = de - Bias1023 - (P53-1) + k; |
| 2249 | *bits = P53 - k; |
| 2250 | #endif |
| 2251 | #ifndef Sudden_Underflow |
| 2252 | } |
| 2253 | else { |
| 2254 | *e = de - Bias1023 - (P53-1) + 1 + k; |
| 2255 | #ifdef Pack_32 |
| 2256 | *bits = 32*i - hi0bits(x[i-1]); |
| 2257 | #else |
| 2258 | *bits = (i+2)*16 - hi0bits(x[i]); |
| 2259 | #endif |
| 2260 | } |
| 2261 | #endif |
| 2262 | return b; |
| 2263 | } |
| 2264 | #undef d0 |
| 2265 | #undef d1 |
| 2266 | |
| 2267 | #undef Need_Hexdig |
| 2268 | #ifdef INFNAN_CHECK |
| 2269 | #ifndef No_Hex_NaN |
| 2270 | #define Need_Hexdig |
| 2271 | #endif |
| 2272 | #endif |
| 2273 | |
| 2274 | #ifndef Need_Hexdig |
| 2275 | #ifndef NO_HEX_FP |
| 2276 | #define Need_Hexdig |
| 2277 | #endif |
| 2278 | #endif |
| 2279 | |
| 2280 | #ifdef INFNAN_CHECK |
| 2281 | |
| 2282 | #ifndef NAN_WORD00x7ff80000 |
| 2283 | #define NAN_WORD00x7ff80000 0x7ff80000 |
| 2284 | #endif |
| 2285 | |
| 2286 | #ifndef NAN_WORD10 |
| 2287 | #define NAN_WORD10 0 |
| 2288 | #endif |
| 2289 | |
| 2290 | #endif /* INFNAN_CHECK */ |
| 2291 | |
| 2292 | #ifdef Pack_32 |
| 2293 | #define ULbits32 32 |
| 2294 | #define kshift5 5 |
| 2295 | #define kmask31 31 |
| 2296 | #else |
| 2297 | #define ULbits32 16 |
| 2298 | #define kshift5 4 |
| 2299 | #define kmask31 15 |
| 2300 | #endif |
| 2301 | |
| 2302 | #if !defined(NO_HEX_FP) || defined(Honor_FLT_ROUNDS) /*{*/ |
| 2303 | static Bigint * |
| 2304 | increment(Bigint *b MTd) |
| 2305 | { |
| 2306 | ULong *x, *xe; |
| 2307 | Bigint *b1; |
| 2308 | |
| 2309 | x = b->x; |
| 2310 | xe = x + b->wds; |
| 2311 | do { |
| 2312 | if (*x < (ULong)0xffffffffL) { |
| 2313 | ++*x; |
| 2314 | return b; |
| 2315 | } |
| 2316 | *x++ = 0; |
| 2317 | } while(x < xe); |
| 2318 | { |
| 2319 | if (b->wds >= b->maxwds) { |
| 2320 | b1 = Balloc(b->k+1 MTa); |
| 2321 | Bcopy(b1,b)memcpy((char *)&b1->sign, (char *)&b->sign, b-> wds*sizeof(int) + 2*sizeof(int)); |
| 2322 | Bfree(b MTa); |
| 2323 | b = b1; |
| 2324 | } |
| 2325 | b->x[b->wds++] = 1; |
| 2326 | } |
| 2327 | return b; |
| 2328 | } |
| 2329 | |
| 2330 | #endif /*}*/ |
| 2331 | |
| 2332 | static int |
| 2333 | dshift(Bigint *b, int p2) |
| 2334 | { |
| 2335 | int rv = hi0bits(b->x[b->wds-1]) - 4; |
| 2336 | if (p2 > 0) |
| 2337 | rv -= p2; |
| 2338 | return rv & kmask31; |
| 2339 | } |
| 2340 | |
| 2341 | static int |
| 2342 | quorem(Bigint *b, Bigint *S) |
| 2343 | { |
| 2344 | int n; |
| 2345 | ULong *bx, *bxe, q, *sx, *sxe; |
| 2346 | #ifdef ULLongunsigned long long |
| 2347 | ULLongunsigned long long borrow, carry, y, ys; |
| 2348 | #else |
| 2349 | ULong borrow, carry, y, ys; |
| 2350 | #ifdef Pack_32 |
| 2351 | ULong si, z, zs; |
| 2352 | #endif |
| 2353 | #endif |
| 2354 | |
| 2355 | n = S->wds; |
| 2356 | #ifdef DEBUG |
| 2357 | /*debug*/ if (b->wds > n) |
| 2358 | /*debug*/ Bug("oversize b in quorem"); |
| 2359 | #endif |
| 2360 | if (b->wds < n) |
| 2361 | return 0; |
| 2362 | sx = S->x; |
| 2363 | sxe = sx + --n; |
| 2364 | bx = b->x; |
| 2365 | bxe = bx + n; |
| 2366 | q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ |
| 2367 | #ifdef DEBUG |
| 2368 | #ifdef NO_STRTOD_BIGCOMP |
| 2369 | /*debug*/ if (q > 9) |
| 2370 | #else |
| 2371 | /* An oversized q is possible when quorem is called from bigcomp and */ |
| 2372 | /* the input is near, e.g., twice the smallest denormalized number. */ |
| 2373 | /*debug*/ if (q > 15) |
| 2374 | #endif |
| 2375 | /*debug*/ Bug("oversized quotient in quorem"); |
| 2376 | #endif |
| 2377 | if (q) { |
| 2378 | borrow = 0; |
| 2379 | carry = 0; |
| 2380 | do { |
| 2381 | #ifdef ULLongunsigned long long |
| 2382 | ys = *sx++ * (ULLongunsigned long long)q + carry; |
| 2383 | carry = ys >> 32; |
| 2384 | y = *bx - (ys & FFFFFFFF0xffffffffUL) - borrow; |
| 2385 | borrow = y >> 32 & (ULong)1; |
| 2386 | *bx++ = y & FFFFFFFF0xffffffffUL; |
| 2387 | #else |
| 2388 | #ifdef Pack_32 |
| 2389 | si = *sx++; |
| 2390 | ys = (si & 0xffff) * q + carry; |
| 2391 | zs = (si >> 16) * q + (ys >> 16); |
| 2392 | carry = zs >> 16; |
| 2393 | y = (*bx & 0xffff) - (ys & 0xffff) - borrow; |
| 2394 | borrow = (y & 0x10000) >> 16; |
| 2395 | z = (*bx >> 16) - (zs & 0xffff) - borrow; |
| 2396 | borrow = (z & 0x10000) >> 16; |
| 2397 | Storeinc(bx, z, y)(((unsigned short *)bx)[1] = (unsigned short)z, ((unsigned short *)bx)[0] = (unsigned short)y, bx++); |
| 2398 | #else |
| 2399 | ys = *sx++ * q + carry; |
| 2400 | carry = ys >> 16; |
| 2401 | y = *bx - (ys & 0xffff) - borrow; |
| 2402 | borrow = (y & 0x10000) >> 16; |
| 2403 | *bx++ = y & 0xffff; |
| 2404 | #endif |
| 2405 | #endif |
| 2406 | } |
| 2407 | while(sx <= sxe); |
| 2408 | if (!*bxe) { |
| 2409 | bx = b->x; |
| 2410 | while(--bxe > bx && !*bxe) |
| 2411 | --n; |
| 2412 | b->wds = n; |
| 2413 | } |
| 2414 | } |
| 2415 | if (cmp(b, S) >= 0) { |
| 2416 | q++; |
| 2417 | borrow = 0; |
| 2418 | carry = 0; |
| 2419 | bx = b->x; |
| 2420 | sx = S->x; |
| 2421 | do { |
| 2422 | #ifdef ULLongunsigned long long |
| 2423 | ys = *sx++ + carry; |
| 2424 | carry = ys >> 32; |
| 2425 | y = *bx - (ys & FFFFFFFF0xffffffffUL) - borrow; |
| 2426 | borrow = y >> 32 & (ULong)1; |
| 2427 | *bx++ = y & FFFFFFFF0xffffffffUL; |
| 2428 | #else |
| 2429 | #ifdef Pack_32 |
| 2430 | si = *sx++; |
| 2431 | ys = (si & 0xffff) + carry; |
| 2432 | zs = (si >> 16) + (ys >> 16); |
| 2433 | carry = zs >> 16; |
| 2434 | y = (*bx & 0xffff) - (ys & 0xffff) - borrow; |
| 2435 | borrow = (y & 0x10000) >> 16; |
| 2436 | z = (*bx >> 16) - (zs & 0xffff) - borrow; |
| 2437 | borrow = (z & 0x10000) >> 16; |
| 2438 | Storeinc(bx, z, y)(((unsigned short *)bx)[1] = (unsigned short)z, ((unsigned short *)bx)[0] = (unsigned short)y, bx++); |
| 2439 | #else |
| 2440 | ys = *sx++ + carry; |
| 2441 | carry = ys >> 16; |
| 2442 | y = *bx - (ys & 0xffff) - borrow; |
| 2443 | borrow = (y & 0x10000) >> 16; |
| 2444 | *bx++ = y & 0xffff; |
| 2445 | #endif |
| 2446 | #endif |
| 2447 | } |
| 2448 | while(sx <= sxe); |
| 2449 | bx = b->x; |
| 2450 | bxe = bx + n; |
| 2451 | if (!*bxe) { |
| 2452 | while(--bxe > bx && !*bxe) |
| 2453 | --n; |
| 2454 | b->wds = n; |
| 2455 | } |
| 2456 | } |
| 2457 | return q; |
| 2458 | } |
| 2459 | |
| 2460 | #ifndef MULTIPLE_THREADS |
| 2461 | static char *dtoa_result; |
| 2462 | #endif |
| 2463 | |
| 2464 | static char * |
| 2465 | rv_alloc(size_t i MTd) |
| 2466 | { |
| 2467 | int j, k, *r; |
| 2468 | |
| 2469 | j = sizeof(ULong); |
| 2470 | for(k = 0; |
| 2471 | sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; |
| 2472 | j <<= 1) |
| 2473 | k++; |
| 2474 | r = (int*)Balloc(k MTa); |
| 2475 | *r = k; |
| 2476 | return |
| 2477 | #ifndef MULTIPLE_THREADS |
| 2478 | dtoa_result = |
| 2479 | #endif |
| 2480 | (char *)(r+1); |
| 2481 | } |
| 2482 | |
| 2483 | static char * |
| 2484 | nrv_alloc(const char *s, char *s0, size_t s0len, char **rve, size_t n MTd) |
| 2485 | { |
| 2486 | char *rv, *t; |
| 2487 | |
| 2488 | if (!s0) |
| 2489 | s0 = rv_alloc(n MTa); |
| 2490 | else if (s0len <= n) { |
| 2491 | rv = 0; |
| 2492 | t = rv + n; |
| 2493 | goto rve_chk; |
| 2494 | } |
| 2495 | t = rv = s0; |
| 2496 | while((*t = *s++)) |
| 2497 | ++t; |
| 2498 | rve_chk: |
| 2499 | if (rve) |
| 2500 | *rve = t; |
| 2501 | return rv; |
| 2502 | } |
| 2503 | |
| 2504 | /* freedtoa(s) must be used to free values s returned by dtoa |
| 2505 | * when MULTIPLE_THREADS is #defined. It should be used in all cases, |
| 2506 | * but for consistency with earlier versions of dtoa, it is optional |
| 2507 | * when MULTIPLE_THREADS is not defined. |
| 2508 | */ |
| 2509 | |
| 2510 | void |
| 2511 | freedtoa(char *s) |
| 2512 | { |
| 2513 | #ifdef MULTIPLE_THREADS |
| 2514 | ThInfo *TI = 0; |
| 2515 | #endif |
| 2516 | Bigint *b = (Bigint *)((int *)s - 1); |
| 2517 | b->maxwds = 1 << (b->k = *(int*)b); |
| 2518 | Bfree(b MTb); |
| 2519 | #ifndef MULTIPLE_THREADS |
| 2520 | if (s == dtoa_result) |
| 2521 | dtoa_result = 0; |
| 2522 | #endif |
| 2523 | } |
| 2524 | |
| 2525 | /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. |
| 2526 | * |
| 2527 | * Inspired by "How to Print Floating-Point Numbers Accurately" by |
| 2528 | * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. |
| 2529 | * |
| 2530 | * Modifications: |
| 2531 | * 1. Rather than iterating, we use a simple numeric overestimate |
| 2532 | * to determine k = floor(log10(d)). We scale relevant |
| 2533 | * quantities using O(log2(k)) rather than O(k) multiplications. |
| 2534 | * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't |
| 2535 | * try to generate digits strictly left to right. Instead, we |
| 2536 | * compute with fewer bits and propagate the carry if necessary |
| 2537 | * when rounding the final digit up. This is often faster. |
| 2538 | * 3. Under the assumption that input will be rounded nearest, |
| 2539 | * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. |
| 2540 | * That is, we allow equality in stopping tests when the |
| 2541 | * round-nearest rule will give the same floating-point value |
| 2542 | * as would satisfaction of the stopping test with strict |
| 2543 | * inequality. |
| 2544 | * 4. We remove common factors of powers of 2 from relevant |
| 2545 | * quantities. |
| 2546 | * 5. When converting floating-point integers less than 1e16, |
| 2547 | * we use floating-point arithmetic rather than resorting |
| 2548 | * to multiple-precision integers. |
| 2549 | * 6. When asked to produce fewer than 15 digits, we first try |
| 2550 | * to get by with floating-point arithmetic; we resort to |
| 2551 | * multiple-precision integer arithmetic only if we cannot |
| 2552 | * guarantee that the floating-point calculation has given |
| 2553 | * the correctly rounded result. For k requested digits and |
| 2554 | * "uniformly" distributed input, the probability is |
| 2555 | * something like 10^(k-15) that we must resort to the Long |
| 2556 | * calculation. |
| 2557 | */ |
| 2558 | |
| 2559 | char * |
| 2560 | dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, char *buf, size_t blen) |
| 2561 | { |
| 2562 | /* Arguments ndigits, decpt, sign are similar to those |
| 2563 | of ecvt and fcvt; trailing zeros are suppressed from |
| 2564 | the returned string. If not null, *rve is set to point |
| 2565 | to the end of the return value. If d is +-Infinity or NaN, |
| 2566 | then *decpt is set to 9999. |
| 2567 | |
| 2568 | mode: |
| 2569 | 0 ==> shortest string that yields d when read in |
| 2570 | and rounded to nearest. |
| 2571 | 1 ==> like 0, but with Steele & White stopping rule; |
| 2572 | e.g. with IEEE P754 arithmetic , mode 0 gives |
| 2573 | 1e23 whereas mode 1 gives 9.999999999999999e22. |
| 2574 | 2 ==> max(1,ndigits) significant digits. This gives a |
| 2575 | return value similar to that of ecvt, except |
| 2576 | that trailing zeros are suppressed. |
| 2577 | 3 ==> through ndigits past the decimal point. This |
| 2578 | gives a return value similar to that from fcvt, |
| 2579 | except that trailing zeros are suppressed, and |
| 2580 | ndigits can be negative. |
| 2581 | 4,5 ==> similar to 2 and 3, respectively, but (in |
| 2582 | round-nearest mode) with the tests of mode 0 to |
| 2583 | possibly return a shorter string that rounds to d. |
| 2584 | With IEEE arithmetic and compilation with |
| 2585 | -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same |
| 2586 | as modes 2 and 3 when FLT_ROUNDS != 1. |
| 2587 | 6-9 ==> Debugging modes similar to mode - 4: don't try |
| 2588 | fast floating-point estimate (if applicable). |
| 2589 | |
| 2590 | Values of mode other than 0-9 are treated as mode 0. |
| 2591 | |
| 2592 | When not NULL, buf is an output buffer of length blen, which must |
| 2593 | be large enough to accommodate suppressed trailing zeros and a trailing |
| 2594 | null byte. If blen is too small, rv = NULL is returned, in which case |
| 2595 | if rve is not NULL, a subsequent call with blen >= (*rve - rv) + 1 |
| 2596 | should succeed in returning buf. |
| 2597 | |
| 2598 | When buf is NULL, sufficient space is allocated for the return value, |
| 2599 | which, when done using, the caller should pass to freedtoa(). |
| 2600 | |
| 2601 | USE_BF is automatically defined when neither NO_LONG_LONG nor NO_BF96 |
| 2602 | is defined. |
| 2603 | */ |
| 2604 | |
| 2605 | #ifdef MULTIPLE_THREADS |
| 2606 | ThInfo *TI = 0; |
| 2607 | #endif |
| 2608 | int bbits, b2, b5, be, dig, i, ilim, ilim1, |
| 2609 | j, j1, k, leftright, m2, m5, s2, s5, spec_case; |
| 2610 | #if !defined(Sudden_Underflow) || defined(USE_BF96) |
| 2611 | int denorm; |
| 2612 | #endif |
| 2613 | Bigint *b, *b1, *delta, *mlo, *mhi, *S; |
| 2614 | U u; |
| 2615 | char *s; |
| 2616 | #ifdef SET_INEXACT |
| 2617 | int inexact, oldinexact; |
| 2618 | #endif |
| 2619 | #ifdef USE_BF96 /*{{*/ |
| 2620 | const BF96 *p10; |
| 2621 | ULLongunsigned long long dbhi, dbits, dblo, den, hb, rb, rblo, res, res0, res3, reslo, sres, |
| 2622 | sulp, tv0, tv1, tv2, tv3, ulp, ulplo, ulpmask, ures, ureslo, zb; |
| 2623 | int eulp, k1, n2, ulpadj, ulpshift; |
| 2624 | #else /*}{*/ |
| 2625 | #ifndef Sudden_Underflow |
| 2626 | ULong x; |
| 2627 | #endif |
| 2628 | Longint L; |
| 2629 | U d2, eps; |
| 2630 | double ds; |
| 2631 | int ieps, ilim0, k0, k_check, try_quick; |
| 2632 | #ifndef No_leftright |
| 2633 | #ifdef IEEE_Arith |
| 2634 | U eps1; |
| 2635 | #endif |
| 2636 | #endif |
| 2637 | #endif /*}}*/ |
| 2638 | #ifdef Honor_FLT_ROUNDS /*{*/ |
| 2639 | int Rounding(__builtin_flt_rounds()); |
| 2640 | #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ |
| 2641 | Rounding(__builtin_flt_rounds()) = Flt_Rounds(__builtin_flt_rounds()); |
| 2642 | #else /*}{*/ |
| 2643 | Rounding(__builtin_flt_rounds()) = 1; |
| 2644 | switch(fegetround()) { |
| 2645 | case FE_TOWARDZERO: Rounding(__builtin_flt_rounds()) = 0; break; |
| 2646 | case FE_UPWARD: Rounding(__builtin_flt_rounds()) = 2; break; |
| 2647 | case FE_DOWNWARD: Rounding(__builtin_flt_rounds()) = 3; |
| 2648 | } |
| 2649 | #endif /*}}*/ |
| 2650 | #endif /*}*/ |
| 2651 | |
| 2652 | u.d = dd; |
| 2653 | if (word0(&u)(&u)->L[1] & Sign_bit0x80000000) { |
| 2654 | /* set sign for everything, including 0's and NaNs */ |
| 2655 | *sign = 1; |
| 2656 | word0(&u)(&u)->L[1] &= ~Sign_bit0x80000000; /* clear sign bit */ |
| 2657 | } |
| 2658 | else |
| 2659 | *sign = 0; |
| 2660 | |
| 2661 | #if defined(IEEE_Arith) + defined(VAX) |
| 2662 | #ifdef IEEE_Arith |
| 2663 | if ((word0(&u)(&u)->L[1] & Exp_mask0x7ff00000) == Exp_mask0x7ff00000) |
| 2664 | #else |
| 2665 | if (word0(&u)(&u)->L[1] == 0x8000) |
| 2666 | #endif |
| 2667 | { |
| 2668 | /* Infinity or NaN */ |
| 2669 | *decpt = 9999; |
| 2670 | #ifdef IEEE_Arith |
| 2671 | if (!word1(&u)(&u)->L[0] && !(word0(&u)(&u)->L[1] & 0xfffff)) |
| 2672 | return nrv_alloc("Infinity", buf, blen, rve, 8 MTb); |
| 2673 | #endif |
| 2674 | return nrv_alloc("NaN", buf, blen, rve, 3 MTb); |
| 2675 | } |
| 2676 | #endif |
| 2677 | #ifdef IBM |
| 2678 | dval(&u)(&u)->d += 0; /* normalize */ |
| 2679 | #endif |
| 2680 | if (!dval(&u)(&u)->d) { |
| 2681 | *decpt = 1; |
| 2682 | return nrv_alloc("0", buf, blen, rve, 1 MTb); |
| 2683 | } |
| 2684 | |
| 2685 | #ifdef SET_INEXACT |
| 2686 | #ifndef USE_BF96 |
| 2687 | try_quick = |
| 2688 | #endif |
| 2689 | oldinexact = get_inexact(); |
| 2690 | inexact = 1; |
| 2691 | #endif |
| 2692 | #ifdef Honor_FLT_ROUNDS |
| 2693 | if (Rounding(__builtin_flt_rounds()) >= 2) { |
| 2694 | if (*sign) |
| 2695 | Rounding(__builtin_flt_rounds()) = Rounding(__builtin_flt_rounds()) == 2 ? 0 : 2; |
| 2696 | else |
| 2697 | if (Rounding(__builtin_flt_rounds()) != 2) |
| 2698 | Rounding(__builtin_flt_rounds()) = 0; |
| 2699 | } |
| 2700 | #endif |
| 2701 | #ifdef USE_BF96 /*{{*/ |
| 2702 | dbits = (u.LL & 0xfffffffffffffull) << 11; /* fraction bits */ |
| 2703 | if ((be = u.LL >> 52)) /* biased exponent; nonzero ==> normal */ { |
| 2704 | dbits |= 0x8000000000000000ull; |
| 2705 | denorm = ulpadj = 0; |
| 2706 | } |
| 2707 | else { |
| 2708 | denorm = 1; |
| 2709 | ulpadj = be + 1; |
| 2710 | dbits <<= 1; |
| 2711 | if (!(dbits & 0xffffffff00000000ull)) { |
| 2712 | dbits <<= 32; |
| 2713 | be -= 32; |
| 2714 | } |
| 2715 | if (!(dbits & 0xffff000000000000ull)) { |
| 2716 | dbits <<= 16; |
| 2717 | be -= 16; |
| 2718 | } |
| 2719 | if (!(dbits & 0xff00000000000000ull)) { |
| 2720 | dbits <<= 8; |
| 2721 | be -= 8; |
| 2722 | } |
| 2723 | if (!(dbits & 0xf000000000000000ull)) { |
| 2724 | dbits <<= 4; |
| 2725 | be -= 4; |
| 2726 | } |
| 2727 | if (!(dbits & 0xc000000000000000ull)) { |
| 2728 | dbits <<= 2; |
| 2729 | be -= 2; |
| 2730 | } |
| 2731 | if (!(dbits & 0x8000000000000000ull)) { |
| 2732 | dbits <<= 1; |
| 2733 | be -= 1; |
| 2734 | } |
| 2735 | assert(be >= -51); |
| 2736 | ulpadj -= be; |
| 2737 | } |
| 2738 | j = Lhint[be + 51]; |
| 2739 | p10 = &pten[j]; |
| 2740 | dbhi = dbits >> 32; |
| 2741 | dblo = dbits & 0xffffffffull; |
| 2742 | i = be - 0x3fe; |
| 2743 | if (i < p10->e |
| 2744 | || (i == p10->e && (dbhi < p10->b0 || (dbhi == p10->b0 && dblo < p10->b1)))) |
| 2745 | --j; |
| 2746 | k = j - 342; |
| 2747 | |
| 2748 | /* now 10^k <= dd < 10^(k+1) */ |
| 2749 | |
| 2750 | #else /*}{*/ |
| 2751 | |
| 2752 | b = d2b(&u, &be, &bbits MTb); |
| 2753 | #ifdef Sudden_Underflow |
| 2754 | i = (int)(word0(&u)(&u)->L[1] >> Exp_shift120 & (Exp_mask0x7ff00000>>Exp_shift120)); |
| 2755 | #else |
| 2756 | if ((i = (int)(word0(&u)(&u)->L[1] >> Exp_shift120 & (Exp_mask0x7ff00000>>Exp_shift120)))) { |
| 2757 | #endif |
| 2758 | dval(&d2)(&d2)->d = dval(&u)(&u)->d; |
| 2759 | word0(&d2)(&d2)->L[1] &= Frac_mask10xfffff; |
| 2760 | word0(&d2)(&d2)->L[1] |= Exp_110x3ff00000; |
| 2761 | #ifdef IBM |
| 2762 | if (j = 11 - hi0bits(word0(&d2)(&d2)->L[1] & Frac_mask0xfffff)) |
| 2763 | dval(&d2)(&d2)->d /= 1 << j; |
| 2764 | #endif |
| 2765 | |
| 2766 | /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 |
| 2767 | * log10(x) = log(x) / log(10) |
| 2768 | * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) |
| 2769 | * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) |
| 2770 | * |
| 2771 | * This suggests computing an approximation k to log10(d) by |
| 2772 | * |
| 2773 | * k = (i - Bias)*0.301029995663981 |
| 2774 | * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); |
| 2775 | * |
| 2776 | * We want k to be too large rather than too small. |
| 2777 | * The error in the first-order Taylor series approximation |
| 2778 | * is in our favor, so we just round up the constant enough |
| 2779 | * to compensate for any error in the multiplication of |
| 2780 | * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, |
| 2781 | * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, |
| 2782 | * adding 1e-13 to the constant term more than suffices. |
| 2783 | * Hence we adjust the constant term to 0.1760912590558. |
| 2784 | * (We could get a more accurate k by invoking log10, |
| 2785 | * but this is probably not worthwhile.) |
| 2786 | */ |
| 2787 | |
| 2788 | i -= Bias1023; |
| 2789 | #ifdef IBM |
| 2790 | i <<= 2; |
| 2791 | i += j; |
| 2792 | #endif |
| 2793 | #ifndef Sudden_Underflow |
| 2794 | denorm = 0; |
| 2795 | } |
| 2796 | else { |
| 2797 | /* d is denormalized */ |
| 2798 | |
| 2799 | i = bbits + be + (Bias1023 + (P53-1) - 1); |
| 2800 | x = i > 32 ? word0(&u)(&u)->L[1] << (64 - i) | word1(&u)(&u)->L[0] >> (i - 32) |
| 2801 | : word1(&u)(&u)->L[0] << (32 - i); |
| 2802 | dval(&d2)(&d2)->d = x; |
| 2803 | word0(&d2)(&d2)->L[1] -= 31*Exp_msk10x100000; /* adjust exponent */ |
| 2804 | i -= (Bias1023 + (P53-1) - 1) + 1; |
| 2805 | denorm = 1; |
| 2806 | } |
| 2807 | #endif |
| 2808 | ds = (dval(&d2)(&d2)->d-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; |
| 2809 | k = (int)ds; |
| 2810 | if (ds < 0. && ds != k) |
| 2811 | k--; /* want k = floor(ds) */ |
| 2812 | k_check = 1; |
| 2813 | if (k >= 0 && k <= Ten_pmax22) { |
| 2814 | if (dval(&u)(&u)->d < tens[k]) |
| 2815 | k--; |
| 2816 | k_check = 0; |
| 2817 | } |
| 2818 | j = bbits - i - 1; |
| 2819 | if (j >= 0) { |
| 2820 | b2 = 0; |
| 2821 | s2 = j; |
| 2822 | } |
| 2823 | else { |
| 2824 | b2 = -j; |
| 2825 | s2 = 0; |
| 2826 | } |
| 2827 | if (k >= 0) { |
| 2828 | b5 = 0; |
| 2829 | s5 = k; |
| 2830 | s2 += k; |
| 2831 | } |
| 2832 | else { |
| 2833 | b2 -= k; |
| 2834 | b5 = -k; |
| 2835 | s5 = 0; |
| 2836 | } |
| 2837 | #endif /*}}*/ |
| 2838 | if (mode < 0 || mode > 9) |
| 2839 | mode = 0; |
| 2840 | |
| 2841 | #ifndef USE_BF96 |
| 2842 | #ifndef SET_INEXACT |
| 2843 | #ifdef Check_FLT_ROUNDS |
| 2844 | try_quick = Rounding(__builtin_flt_rounds()) == 1; |
| 2845 | #else |
| 2846 | try_quick = 1; |
| 2847 | #endif |
| 2848 | #endif /*SET_INEXACT*/ |
| 2849 | #endif /*USE_BF96*/ |
| 2850 | |
| 2851 | if (mode > 5) { |
| 2852 | mode -= 4; |
| 2853 | #ifndef USE_BF96 |
| 2854 | try_quick = 0; |
| 2855 | #endif |
| 2856 | } |
| 2857 | leftright = 1; |
| 2858 | ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ |
| 2859 | /* silence erroneous "gcc -Wall" warning. */ |
| 2860 | switch(mode) { |
| 2861 | case 0: |
| 2862 | case 1: |
| 2863 | i = 18; |
| 2864 | ndigits = 0; |
| 2865 | break; |
| 2866 | case 2: |
| 2867 | leftright = 0; |
| 2868 | /* FALLTHROUGH */ |
| 2869 | case 4: |
| 2870 | if (ndigits <= 0) |
| 2871 | ndigits = 1; |
| 2872 | ilim = ilim1 = i = ndigits; |
| 2873 | break; |
| 2874 | case 3: |
| 2875 | leftright = 0; |
| 2876 | /* FALLTHROUGH */ |
| 2877 | case 5: |
| 2878 | i = ndigits + k + 1; |
| 2879 | ilim = i; |
| 2880 | ilim1 = i - 1; |
| 2881 | if (i <= 0) |
| 2882 | i = 1; |
| 2883 | } |
| 2884 | if (!buf) { |
| 2885 | buf = rv_alloc(i MTb); |
| 2886 | blen = sizeof(Bigint) + ((1 << ((int*)buf)[-1]) - 1)*sizeof(ULong) - sizeof(int); |
| 2887 | } |
| 2888 | else if (blen <= (size_t)i) { |
| 2889 | buf = 0; |
| 2890 | if (rve) |
| 2891 | *rve = buf + i; |
| 2892 | return buf; |
| 2893 | } |
| 2894 | s = buf; |
| 2895 | |
| 2896 | /* Check for special case that d is a normalized power of 2. */ |
| 2897 | |
| 2898 | spec_case = 0; |
| 2899 | if (mode < 2 || (leftright |
| 2900 | #ifdef Honor_FLT_ROUNDS |
| 2901 | && Rounding(__builtin_flt_rounds()) == 1 |
| 2902 | #endif |
| 2903 | )) { |
| 2904 | if (!word1(&u)(&u)->L[0] && !(word0(&u)(&u)->L[1] & Bndry_mask0xfffff) |
| 2905 | #ifndef Sudden_Underflow |
| 2906 | && word0(&u)(&u)->L[1] & (Exp_mask0x7ff00000 & ~Exp_msk10x100000) |
| 2907 | #endif |
| 2908 | ) { |
| 2909 | /* The special case */ |
| 2910 | spec_case = 1; |
| 2911 | } |
| 2912 | } |
| 2913 | |
| 2914 | #ifdef USE_BF96 /*{*/ |
| 2915 | b = 0; |
| 2916 | if (ilim < 0 && (mode == 3 || mode == 5)) { |
| 2917 | S = mhi = 0; |
| 2918 | goto no_digits; |
| 2919 | } |
| 2920 | i = 1; |
| 2921 | j = 52 + 0x3ff - be; |
| 2922 | ulpshift = 0; |
| 2923 | ulplo = 0; |
| 2924 | /* Can we do an exact computation with 64-bit integer arithmetic? */ |
| 2925 | if (k < 0) { |
| 2926 | if (k < -25) |
| 2927 | goto toobig; |
| 2928 | res = dbits >> 11; |
| 2929 | n2 = pfivebits[k1 = -(k + 1)] + 53; |
| 2930 | j1 = j; |
| 2931 | if (n2 > 61) { |
| 2932 | ulpshift = n2 - 61; |
| 2933 | if (res & (ulpmask = (1ull << ulpshift) - 1)) |
| 2934 | goto toobig; |
| 2935 | j -= ulpshift; |
| 2936 | res >>= ulpshift; |
| 2937 | } |
| 2938 | /* Yes. */ |
| 2939 | res *= ulp = pfive[k1]; |
| 2940 | if (ulpshift) { |
| 2941 | ulplo = ulp; |
| 2942 | ulp >>= ulpshift; |
| 2943 | } |
| 2944 | j += k; |
| 2945 | if (ilim == 0) { |
| 2946 | S = mhi = 0; |
| 2947 | if (res > (5ull << j)) |
| 2948 | goto one_digit; |
| 2949 | goto no_digits; |
| 2950 | } |
| 2951 | goto no_div; |
| 2952 | } |
| 2953 | if (ilim == 0 && j + k >= 0) { |
| 2954 | S = mhi = 0; |
| 2955 | if ((dbits >> 11) > (pfive[k-1] << j)) |
| 2956 | goto one_digit; |
| 2957 | goto no_digits; |
| 2958 | } |
| 2959 | if (k <= dtoa_divmax && j + k >= 0) { |
| 2960 | /* Another "yes" case -- we will use exact integer arithmetic. */ |
| 2961 | use_exact: |
| 2962 | Debug(++dtoa_stats[3]); |
| 2963 | res = dbits >> 11; /* residual */ |
| 2964 | ulp = 1; |
| 2965 | if (k <= 0) |
| 2966 | goto no_div; |
| 2967 | j1 = j + k + 1; |
| 2968 | den = pfive[k-i] << (j1 - i); |
| 2969 | for(;;) { |
| 2970 | dig = (int)(res / den); |
| 2971 | *s++ = '0' + dig; |
| 2972 | if (!(res -= dig*den)) { |
| 2973 | #ifdef SET_INEXACT |
| 2974 | inexact = 0; |
| 2975 | oldinexact = 1; |
| 2976 | #endif |
| 2977 | goto retc; |
| 2978 | } |
| 2979 | if (ilim < 0) { |
| 2980 | ures = den - res; |
| 2981 | if (2*res <= ulp |
| 2982 | && (spec_case ? 4*res <= ulp : (2*res < ulp || dig & 1))) |
| 2983 | goto ulp_reached; |
| 2984 | if (2*ures < ulp) |
| 2985 | goto Roundup; |
| 2986 | } |
| 2987 | else if (i == ilim) { |
| 2988 | switch(Rounding(__builtin_flt_rounds())) { |
| 2989 | case 0: goto retc; |
| 2990 | case 2: goto Roundup; |
| 2991 | } |
| 2992 | ures = 2*res; |
| 2993 | if (ures > den |
| 2994 | || (ures == den && dig & 1) |
| 2995 | || (spec_case && res <= ulp && 2*res >= ulp)) |
| 2996 | goto Roundup; |
| 2997 | goto retc; |
| 2998 | } |
| 2999 | if (j1 < ++i) { |
| 3000 | res *= 10; |
| 3001 | ulp *= 10; |
| 3002 | } |
| 3003 | else { |
| 3004 | if (i > k) |
| 3005 | break; |
| 3006 | den = pfive[k-i] << (j1 - i); |
| 3007 | } |
| 3008 | } |
| 3009 | no_div: |
| 3010 | for(;;) { |
| 3011 | den = res >> j; |
| 3012 | dig = (int)den; |
| 3013 | *s++ = '0' + dig; |
| 3014 | if (!(res -= den << j)) { |
| 3015 | #ifdef SET_INEXACT |
| 3016 | inexact = 0; |
| 3017 | oldinexact = 1; |
| 3018 | #endif |
| 3019 | goto retc; |
| 3020 | } |
| 3021 | if (ilim < 0) { |
| 3022 | ures = (1ull << j) - res; |
| 3023 | if (2*res <= ulp |
| 3024 | && (spec_case ? 4*res <= ulp : (2*res < ulp || dig & 1))) { |
| 3025 | ulp_reached: |
| 3026 | if (ures < res |
| 3027 | || (ures == res && dig & 1) |
| 3028 | || (dig == 9 && 2*ures <= ulp)) |
| 3029 | goto Roundup; |
| 3030 | goto retc; |
| 3031 | } |
| 3032 | if (2*ures < ulp) |
| 3033 | goto Roundup; |
| 3034 | } |
| 3035 | --j; |
| 3036 | if (i == ilim) { |
| 3037 | #ifdef Honor_FLT_ROUNDS |
| 3038 | switch(Rounding(__builtin_flt_rounds())) { |
| 3039 | case 0: goto retc; |
| 3040 | case 2: goto Roundup; |
| 3041 | } |
| 3042 | #endif |
| 3043 | hb = 1ull << j; |
| 3044 | if (res & hb && (dig & 1 || res & (hb-1))) |
| 3045 | goto Roundup; |
| 3046 | if (spec_case && res <= ulp && 2*res >= ulp) { |
| 3047 | Roundup: |
| 3048 | while(*--s == '9') |
| 3049 | if (s == buf) { |
| 3050 | ++k; |
| 3051 | *s++ = '1'; |
| 3052 | goto ret1; |
| 3053 | } |
| 3054 | ++*s++; |
| 3055 | goto ret1; |
| 3056 | } |
| 3057 | goto retc; |
| 3058 | } |
| 3059 | ++i; |
| 3060 | res *= 5; |
| 3061 | if (ulpshift) { |
| 3062 | ulplo = 5*(ulplo & ulpmask); |
| 3063 | ulp = 5*ulp + (ulplo >> ulpshift); |
| 3064 | } |
| 3065 | else |
| 3066 | ulp *= 5; |
| 3067 | } |
| 3068 | } |
| 3069 | toobig: |
| 3070 | if (ilim > 28) |
| 3071 | goto Fast_failed1; |
| 3072 | /* Scale by 10^-k */ |
| 3073 | p10 = &pten[342-k]; |
| 3074 | tv0 = p10->b2 * dblo; /* rarely matters, but does, e.g., for 9.862818194192001e18 */ |
| 3075 | tv1 = p10->b1 * dblo + (tv0 >> 32); |
| 3076 | tv2 = p10->b2 * dbhi + (tv1 & 0xffffffffull); |
| 3077 | tv3 = p10->b0 * dblo + (tv1>>32) + (tv2>>32); |
| 3078 | res3 = p10->b1 * dbhi + (tv3 & 0xffffffffull); |
| 3079 | res = p10->b0 * dbhi + (tv3>>32) + (res3>>32); |
| 3080 | be += p10->e - 0x3fe; |
| 3081 | eulp = j1 = be - 54 + ulpadj; |
| 3082 | if (!(res & 0x8000000000000000ull)) { |
| 3083 | --be; |
| 3084 | res3 <<= 1; |
| 3085 | res = (res << 1) | ((res3 & 0x100000000ull) >> 32); |
| 3086 | } |
| 3087 | res0 = res; /* save for Fast_failed */ |
| 3088 | #if !defined(SET_INEXACT) && !defined(NO_DTOA_64) /*{*/ |
| 3089 | if (ilim > 19) |
| 3090 | goto Fast_failed; |
| 3091 | Debug(++dtoa_stats[4]); |
| 3092 | assert(be >= 0 && be <= 4); /* be = 0 is rare, but possible, e.g., for 1e20 */ |
| 3093 | res >>= 4 - be; |
| 3094 | ulp = p10->b0; /* ulp */ |
| 3095 | ulp = (ulp << 29) | (p10->b1 >> 3); |
| 3096 | /* scaled ulp = ulp * 2^(eulp - 60) */ |
| 3097 | /* We maintain 61 bits of the scaled ulp. */ |
| 3098 | if (ilim == 0) { |
| 3099 | if (!(res & 0x7fffffffffffffeull) |
| 3100 | || !((~res) & 0x7fffffffffffffeull)) |
| 3101 | goto Fast_failed1; |
| 3102 | S = mhi = 0; |
| 3103 | if (res >= 0x5000000000000000ull) |
| 3104 | goto one_digit; |
| 3105 | goto no_digits; |
| 3106 | } |
| 3107 | rb = 1; /* upper bound on rounding error */ |
| 3108 | for(;;++i) { |
| 3109 | dig = res >> 60; |
| 3110 | *s++ = '0' + dig; |
| 3111 | res &= 0xfffffffffffffffull; |
| 3112 | if (ilim < 0) { |
| 3113 | ures = 0x1000000000000000ull - res; |
| 3114 | if (eulp > 0) { |
| 3115 | assert(eulp <= 4); |
| 3116 | sulp = ulp << (eulp - 1); |
| 3117 | if (res <= ures) { |
| 3118 | if (res + rb > ures - rb) |
| 3119 | goto Fast_failed; |
| 3120 | if (res < sulp) |
| 3121 | goto retc; |
| 3122 | } |
| 3123 | else { |
| 3124 | if (res - rb <= ures + rb) |
| 3125 | goto Fast_failed; |
| 3126 | if (ures < sulp) |
| 3127 | goto Roundup; |
| 3128 | } |
| 3129 | } |
| 3130 | else { |
| 3131 | zb = -(1ull << (eulp + 63)); |
| 3132 | if (!(zb & res)) { |
| 3133 | sres = res << (1 - eulp); |
| 3134 | if (sres < ulp && (!spec_case || 2*sres < ulp)) { |
| 3135 | if ((res+rb) << (1 - eulp) >= ulp) |
| 3136 | goto Fast_failed; |
| 3137 | if (ures < res) { |
| 3138 | if (ures + rb >= res - rb) |
| 3139 | goto Fast_failed; |
| 3140 | goto Roundup; |
| 3141 | } |
| 3142 | if (ures - rb < res + rb) |
| 3143 | goto Fast_failed; |
| 3144 | goto retc; |
| 3145 | } |
| 3146 | } |
| 3147 | if (!(zb & ures) && ures << -eulp < ulp) { |
| 3148 | if (ures << (1 - eulp) < ulp) |
| 3149 | goto Roundup; |
| 3150 | goto Fast_failed; |
| 3151 | } |
| 3152 | } |
| 3153 | } |
| 3154 | else if (i == ilim) { |
| 3155 | ures = 0x1000000000000000ull - res; |
| 3156 | if (ures < res) { |
| 3157 | if (ures <= rb || res - rb <= ures + rb) { |
| 3158 | if (j + k >= 0 && k >= 0 && k <= 27) |
| 3159 | goto use_exact1; |
| 3160 | goto Fast_failed; |
| 3161 | } |
| 3162 | #ifdef Honor_FLT_ROUNDS |
| 3163 | if (Rounding(__builtin_flt_rounds()) == 0) |
| 3164 | goto retc; |
| 3165 | #endif |
| 3166 | goto Roundup; |
| 3167 | } |
| 3168 | if (res <= rb || ures - rb <= res + rb) { |
| 3169 | if (j + k >= 0 && k >= 0 && k <= 27) { |
| 3170 | use_exact1: |
| 3171 | s = buf; |
| 3172 | i = 1; |
| 3173 | goto use_exact; |
| 3174 | } |
| 3175 | goto Fast_failed; |
| 3176 | } |
| 3177 | #ifdef Honor_FLT_ROUNDS |
| 3178 | if (Rounding(__builtin_flt_rounds()) == 2) |
| 3179 | goto Roundup; |
| 3180 | #endif |
| 3181 | goto retc; |
| 3182 | } |
| 3183 | rb *= 10; |
| 3184 | if (rb >= 0x1000000000000000ull) |
| 3185 | goto Fast_failed; |
| 3186 | res *= 10; |
| 3187 | ulp *= 5; |
| 3188 | if (ulp & 0x8000000000000000ull) { |
| 3189 | eulp += 4; |
| 3190 | ulp >>= 3; |
| 3191 | } |
| 3192 | else { |
| 3193 | eulp += 3; |
| 3194 | ulp >>= 2; |
| 3195 | } |
| 3196 | } |
| 3197 | #endif /*}*/ |
| 3198 | #ifndef NO_BF96 |
| 3199 | Fast_failed: |
| 3200 | #endif |
| 3201 | Debug(++dtoa_stats[5]); |
| 3202 | s = buf; |
| 3203 | i = 4 - be; |
| 3204 | res = res0 >> i; |
| 3205 | reslo = 0xffffffffull & res3; |
| 3206 | if (i) |
| 3207 | reslo = (res0 << (64 - i)) >> 32 | (reslo >> i); |
| 3208 | rb = 0; |
| 3209 | rblo = 4; /* roundoff bound */ |
| 3210 | ulp = p10->b0; /* ulp */ |
| 3211 | ulp = (ulp << 29) | (p10->b1 >> 3); |
| 3212 | eulp = j1; |
| 3213 | for(i = 1;;++i) { |
| 3214 | dig = res >> 60; |
| 3215 | *s++ = '0' + dig; |
| 3216 | res &= 0xfffffffffffffffull; |
| 3217 | #ifdef SET_INEXACT |
| 3218 | if (!res && !reslo) { |
| 3219 | if (!(res3 & 0xffffffffull)) { |
| 3220 | inexact = 0; |
| 3221 | oldinexact = 1; |
| 3222 | } |
| 3223 | goto retc; |
| 3224 | } |
| 3225 | #endif |
| 3226 | if (ilim < 0) { |
| 3227 | ures = 0x1000000000000000ull - res; |
| 3228 | ureslo = 0; |
| 3229 | if (reslo) { |
| 3230 | ureslo = 0x100000000ull - reslo; |
| 3231 | --ures; |
| 3232 | } |
| 3233 | if (eulp > 0) { |
| 3234 | assert(eulp <= 4); |
| 3235 | sulp = (ulp << (eulp - 1)) - rb; |
| 3236 | if (res <= ures) { |
| 3237 | if (res < sulp) { |
| 3238 | if (res+rb < ures-rb) |
| 3239 | goto retc; |
| 3240 | } |
| 3241 | } |
| 3242 | else if (ures < sulp) { |
| 3243 | if (res-rb > ures+rb) |
| 3244 | goto Roundup; |
| 3245 | } |
| 3246 | goto Fast_failed1; |
| 3247 | } |
| 3248 | else { |
| 3249 | zb = -(1ull << (eulp + 60)); |
| 3250 | if (!(zb & (res + rb))) { |
| 3251 | sres = (res - rb) << (1 - eulp); |
| 3252 | if (sres < ulp && (!spec_case || 2*sres < ulp)) { |
| 3253 | sres = res << (1 - eulp); |
| 3254 | if ((j = eulp + 31) > 0) |
| 3255 | sres += (rblo + reslo) >> j; |
| 3256 | else |
| 3257 | sres += (rblo + reslo) << -j; |
| 3258 | if (sres + (rb << (1 - eulp)) >= ulp) |
| 3259 | goto Fast_failed1; |
| 3260 | if (sres >= ulp) |
| 3261 | goto more96; |
| 3262 | if (ures < res |
| 3263 | || (ures == res && ureslo < reslo)) { |
| 3264 | if (ures + rb >= res - rb) |
| 3265 | goto Fast_failed1; |
| 3266 | goto Roundup; |
| 3267 | } |
| 3268 | if (ures - rb <= res + rb) |
| 3269 | goto Fast_failed1; |
| 3270 | goto retc; |
| 3271 | } |
| 3272 | } |
| 3273 | if (!(zb & ures) && (ures-rb) << (1 - eulp) < ulp) { |
| 3274 | if ((ures + rb) << (2 - eulp) < ulp) |
| 3275 | goto Roundup; |
| 3276 | goto Fast_failed1; |
| 3277 | } |
| 3278 | } |
| 3279 | } |
| 3280 | else if (i == ilim) { |
| 3281 | ures = 0x1000000000000000ull - res; |
| 3282 | sres = ureslo = 0; |
Although the value stored to 'ureslo' is used in the enclosing expression, the value is never actually read from 'ureslo' | |
| 3283 | if (reslo) { |
| 3284 | ureslo = 0x100000000ull - reslo; |
| 3285 | --ures; |
| 3286 | sres = (reslo + rblo) >> 31; |
| 3287 | } |
| 3288 | sres += 2*rb; |
| 3289 | if (ures <= res) { |
| 3290 | if (ures <=sres || res - ures <= sres) |
| 3291 | goto Fast_failed1; |
| 3292 | #ifdef Honor_FLT_ROUNDS |
| 3293 | if (Rounding(__builtin_flt_rounds()) == 0) |
| 3294 | goto retc; |
| 3295 | #endif |
| 3296 | goto Roundup; |
| 3297 | } |
| 3298 | if (res <= sres || ures - res <= sres) |
| 3299 | goto Fast_failed1; |
| 3300 | #ifdef Honor_FLT_ROUNDS |
| 3301 | if (Rounding(__builtin_flt_rounds()) == 2) |
| 3302 | goto Roundup; |
| 3303 | #endif |
| 3304 | goto retc; |
| 3305 | } |
| 3306 | more96: |
| 3307 | rblo *= 10; |
| 3308 | rb = 10*rb + (rblo >> 32); |
| 3309 | rblo &= 0xffffffffull; |
| 3310 | if (rb >= 0x1000000000000000ull) |
| 3311 | goto Fast_failed1; |
| 3312 | reslo *= 10; |
| 3313 | res = 10*res + (reslo >> 32); |
| 3314 | reslo &= 0xffffffffull; |
| 3315 | ulp *= 5; |
| 3316 | if (ulp & 0x8000000000000000ull) { |
| 3317 | eulp += 4; |
| 3318 | ulp >>= 3; |
| 3319 | } |
| 3320 | else { |
| 3321 | eulp += 3; |
| 3322 | ulp >>= 2; |
| 3323 | } |
| 3324 | } |
| 3325 | Fast_failed1: |
| 3326 | Debug(++dtoa_stats[6]); |
| 3327 | S = mhi = mlo = 0; |
| 3328 | #ifdef USE_BF96 |
| 3329 | b = d2b(&u, &be, &bbits MTb); |
| 3330 | #endif |
| 3331 | s = buf; |
| 3332 | i = (int)(word0(&u)(&u)->L[1] >> Exp_shift120 & (Exp_mask0x7ff00000>>Exp_shift120)); |
| 3333 | i -= Bias1023; |
| 3334 | if (ulpadj) |
| 3335 | i -= ulpadj - 1; |
| 3336 | j = bbits - i - 1; |
| 3337 | if (j >= 0) { |
| 3338 | b2 = 0; |
| 3339 | s2 = j; |
| 3340 | } |
| 3341 | else { |
| 3342 | b2 = -j; |
| 3343 | s2 = 0; |
| 3344 | } |
| 3345 | if (k >= 0) { |
| 3346 | b5 = 0; |
| 3347 | s5 = k; |
| 3348 | s2 += k; |
| 3349 | } |
| 3350 | else { |
| 3351 | b2 -= k; |
| 3352 | b5 = -k; |
| 3353 | s5 = 0; |
| 3354 | } |
| 3355 | #endif /*}*/ |
| 3356 | |
| 3357 | #ifdef Honor_FLT_ROUNDS |
| 3358 | if (mode > 1 && Rounding(__builtin_flt_rounds()) != 1) |
| 3359 | leftright = 0; |
| 3360 | #endif |
| 3361 | |
| 3362 | #ifndef USE_BF96 /*{*/ |
| 3363 | if (ilim >= 0 && ilim <= Quick_max14 && try_quick) { |
| 3364 | |
| 3365 | /* Try to get by with floating-point arithmetic. */ |
| 3366 | |
| 3367 | i = 0; |
| 3368 | dval(&d2)(&d2)->d = dval(&u)(&u)->d; |
| 3369 | j1 = -(k0 = k); |
| 3370 | ilim0 = ilim; |
| 3371 | ieps = 2; /* conservative */ |
| 3372 | if (k > 0) { |
| 3373 | ds = tens[k&0xf]; |
| 3374 | j = k >> 4; |
| 3375 | if (j & Bletch0x10) { |
| 3376 | /* prevent overflows */ |
| 3377 | j &= Bletch0x10 - 1; |
| 3378 | dval(&u)(&u)->d /= bigtens[n_bigtens-1]; |
| 3379 | ieps++; |
| 3380 | } |
| 3381 | for(; j; j >>= 1, i++) |
| 3382 | if (j & 1) { |
| 3383 | ieps++; |
| 3384 | ds *= bigtens[i]; |
| 3385 | } |
| 3386 | dval(&u)(&u)->d /= ds; |
| 3387 | } |
| 3388 | else if (j1 > 0) { |
| 3389 | dval(&u)(&u)->d *= tens[j1 & 0xf]; |
| 3390 | for(j = j1 >> 4; j; j >>= 1, i++) |
| 3391 | if (j & 1) { |
| 3392 | ieps++; |
| 3393 | dval(&u)(&u)->d *= bigtens[i]; |
| 3394 | } |
| 3395 | } |
| 3396 | if (k_check && dval(&u)(&u)->d < 1. && ilim > 0) { |
| 3397 | if (ilim1 <= 0) |
| 3398 | goto fast_failed; |
| 3399 | ilim = ilim1; |
| 3400 | k--; |
| 3401 | dval(&u)(&u)->d *= 10.; |
| 3402 | ieps++; |
| 3403 | } |
| 3404 | dval(&eps)(&eps)->d = ieps*dval(&u)(&u)->d + 7.; |
| 3405 | word0(&eps)(&eps)->L[1] -= (P53-1)*Exp_msk10x100000; |
| 3406 | if (ilim == 0) { |
| 3407 | S = mhi = 0; |
| 3408 | dval(&u)(&u)->d -= 5.; |
| 3409 | if (dval(&u)(&u)->d > dval(&eps)(&eps)->d) |
| 3410 | goto one_digit; |
| 3411 | if (dval(&u)(&u)->d < -dval(&eps)(&eps)->d) |
| 3412 | goto no_digits; |
| 3413 | goto fast_failed; |
| 3414 | } |
| 3415 | #ifndef No_leftright |
| 3416 | if (leftright) { |
| 3417 | /* Use Steele & White method of only |
| 3418 | * generating digits needed. |
| 3419 | */ |
| 3420 | dval(&eps)(&eps)->d = 0.5/tens[ilim-1] - dval(&eps)(&eps)->d; |
| 3421 | #ifdef IEEE_Arith |
| 3422 | if (j1 >= 307) { |
| 3423 | eps1.d = 1.01e256; /* 1.01 allows roundoff in the next few lines */ |
| 3424 | word0(&eps1)(&eps1)->L[1] -= Exp_msk10x100000 * (Bias1023+P53-1); |
| 3425 | dval(&eps1)(&eps1)->d *= tens[j1 & 0xf]; |
| 3426 | for(i = 0, j = (j1-256) >> 4; j; j >>= 1, i++) |
| 3427 | if (j & 1) |
| 3428 | dval(&eps1)(&eps1)->d *= bigtens[i]; |
| 3429 | if (eps.d < eps1.d) |
| 3430 | eps.d = eps1.d; |
| 3431 | if (10. - u.d < 10.*eps.d && eps.d < 1.) { |
| 3432 | /* eps.d < 1. excludes trouble with the tiniest denormal */ |
| 3433 | *s++ = '1'; |
| 3434 | ++k; |
| 3435 | goto ret1; |
| 3436 | } |
| 3437 | } |
| 3438 | #endif |
| 3439 | for(i = 0;;) { |
| 3440 | L = dval(&u)(&u)->d; |
| 3441 | dval(&u)(&u)->d -= L; |
| 3442 | *s++ = '0' + (int)L; |
| 3443 | if (1. - dval(&u)(&u)->d < dval(&eps)(&eps)->d) |
| 3444 | goto bump_up; |
| 3445 | if (dval(&u)(&u)->d < dval(&eps)(&eps)->d) |
| 3446 | goto retc; |
| 3447 | if (++i >= ilim) |
| 3448 | break; |
| 3449 | dval(&eps)(&eps)->d *= 10.; |
| 3450 | dval(&u)(&u)->d *= 10.; |
| 3451 | } |
| 3452 | } |
| 3453 | else { |
| 3454 | #endif |
| 3455 | /* Generate ilim digits, then fix them up. */ |
| 3456 | dval(&eps)(&eps)->d *= tens[ilim-1]; |
| 3457 | for(i = 1;; i++, dval(&u)(&u)->d *= 10.) { |
| 3458 | L = (Longint)(dval(&u)(&u)->d); |
| 3459 | if (!(dval(&u)(&u)->d -= L)) |
| 3460 | ilim = i; |
| 3461 | *s++ = '0' + (int)L; |
| 3462 | if (i == ilim) { |
| 3463 | if (dval(&u)(&u)->d > 0.5 + dval(&eps)(&eps)->d) |
| 3464 | goto bump_up; |
| 3465 | else if (dval(&u)(&u)->d < 0.5 - dval(&eps)(&eps)->d) |
| 3466 | goto retc; |
| 3467 | break; |
| 3468 | } |
| 3469 | } |
| 3470 | #ifndef No_leftright |
| 3471 | } |
| 3472 | #endif |
| 3473 | fast_failed: |
| 3474 | s = buf; |
| 3475 | dval(&u)(&u)->d = dval(&d2)(&d2)->d; |
| 3476 | k = k0; |
| 3477 | ilim = ilim0; |
| 3478 | } |
| 3479 | |
| 3480 | /* Do we have a "small" integer? */ |
| 3481 | |
| 3482 | if (be >= 0 && k <= Int_max14) { |
| 3483 | /* Yes. */ |
| 3484 | ds = tens[k]; |
| 3485 | if (ndigits < 0 && ilim <= 0) { |
| 3486 | S = mhi = 0; |
| 3487 | if (ilim < 0 || dval(&u)(&u)->d <= 5*ds) |
| 3488 | goto no_digits; |
| 3489 | goto one_digit; |
| 3490 | } |
| 3491 | for(i = 1;; i++, dval(&u)(&u)->d *= 10.) { |
| 3492 | L = (Longint)(dval(&u)(&u)->d / ds); |
| 3493 | dval(&u)(&u)->d -= L*ds; |
| 3494 | #ifdef Check_FLT_ROUNDS |
| 3495 | /* If FLT_ROUNDS == 2, L will usually be high by 1 */ |
| 3496 | if (dval(&u)(&u)->d < 0) { |
| 3497 | L--; |
| 3498 | dval(&u)(&u)->d += ds; |
| 3499 | } |
| 3500 | #endif |
| 3501 | *s++ = '0' + (int)L; |
| 3502 | if (!dval(&u)(&u)->d) { |
| 3503 | #ifdef SET_INEXACT |
| 3504 | inexact = 0; |
| 3505 | #endif |
| 3506 | break; |
| 3507 | } |
| 3508 | if (i == ilim) { |
| 3509 | #ifdef Honor_FLT_ROUNDS |
| 3510 | if (mode > 1) |
| 3511 | switch(Rounding(__builtin_flt_rounds())) { |
| 3512 | case 0: goto retc; |
| 3513 | case 2: goto bump_up; |
| 3514 | } |
| 3515 | #endif |
| 3516 | dval(&u)(&u)->d += dval(&u)(&u)->d; |
| 3517 | #ifdef ROUND_BIASED |
| 3518 | if (dval(&u)(&u)->d >= ds) |
| 3519 | #else |
| 3520 | if (dval(&u)(&u)->d > ds || (dval(&u)(&u)->d == ds && L & 1)) |
| 3521 | #endif |
| 3522 | { |
| 3523 | bump_up: |
| 3524 | while(*--s == '9') |
| 3525 | if (s == buf) { |
| 3526 | k++; |
| 3527 | *s = '0'; |
| 3528 | break; |
| 3529 | } |
| 3530 | ++*s++; |
| 3531 | } |
| 3532 | break; |
| 3533 | } |
| 3534 | } |
| 3535 | goto retc; |
| 3536 | } |
| 3537 | |
| 3538 | #endif /*}*/ |
| 3539 | m2 = b2; |
| 3540 | m5 = b5; |
| 3541 | mhi = mlo = 0; |
| 3542 | if (leftright) { |
| 3543 | i = |
| 3544 | #ifndef Sudden_Underflow |
| 3545 | denorm ? be + (Bias1023 + (P53-1) - 1 + 1) : |
| 3546 | #endif |
| 3547 | #ifdef IBM |
| 3548 | 1 + 4*P53 - 3 - bbits + ((bbits + be - 1) & 3); |
| 3549 | #else |
| 3550 | 1 + P53 - bbits; |
| 3551 | #endif |
| 3552 | b2 += i; |
| 3553 | s2 += i; |
| 3554 | mhi = i2b(1 MTb); |
| 3555 | } |
| 3556 | if (m2 > 0 && s2 > 0) { |
| 3557 | i = m2 < s2 ? m2 : s2; |
| 3558 | b2 -= i; |
| 3559 | m2 -= i; |
| 3560 | s2 -= i; |
| 3561 | } |
| 3562 | if (b5 > 0) { |
| 3563 | if (leftright) { |
| 3564 | if (m5 > 0) { |
| 3565 | mhi = pow5mult(mhi, m5 MTb); |
| 3566 | b1 = mult(mhi, b MTb); |
| 3567 | Bfree(b MTb); |
| 3568 | b = b1; |
| 3569 | } |
| 3570 | if ((j = b5 - m5)) |
| 3571 | b = pow5mult(b, j MTb); |
| 3572 | } |
| 3573 | else |
| 3574 | b = pow5mult(b, b5 MTb); |
| 3575 | } |
| 3576 | S = i2b(1 MTb); |
| 3577 | if (s5 > 0) |
| 3578 | S = pow5mult(S, s5 MTb); |
| 3579 | |
| 3580 | if (spec_case) { |
| 3581 | b2 += Log2P1; |
| 3582 | s2 += Log2P1; |
| 3583 | } |
| 3584 | |
| 3585 | /* Arrange for convenient computation of quotients: |
| 3586 | * shift left if necessary so divisor has 4 leading 0 bits. |
| 3587 | * |
| 3588 | * Perhaps we should just compute leading 28 bits of S once |
| 3589 | * and for all and pass them and a shift to quorem, so it |
| 3590 | * can do shifts and ors to compute the numerator for q. |
| 3591 | */ |
| 3592 | i = dshift(S, s2); |
| 3593 | b2 += i; |
| 3594 | m2 += i; |
| 3595 | s2 += i; |
| 3596 | if (b2 > 0) |
| 3597 | b = lshift(b, b2 MTb); |
| 3598 | if (s2 > 0) |
| 3599 | S = lshift(S, s2 MTb); |
| 3600 | #ifndef USE_BF96 |
| 3601 | if (k_check) { |
| 3602 | if (cmp(b,S) < 0) { |
| 3603 | k--; |
| 3604 | b = multadd(b, 10, 0 MTb); /* we botched the k estimate */ |
| 3605 | if (leftright) |
| 3606 | mhi = multadd(mhi, 10, 0 MTb); |
| 3607 | ilim = ilim1; |
| 3608 | } |
| 3609 | } |
| 3610 | #endif |
| 3611 | if (ilim <= 0 && (mode == 3 || mode == 5)) { |
| 3612 | if (ilim < 0 || cmp(b,S = multadd(S,5,0 MTb)) <= 0) { |
| 3613 | /* no digits, fcvt style */ |
| 3614 | no_digits: |
| 3615 | k = -1 - ndigits; |
| 3616 | goto ret; |
| 3617 | } |
| 3618 | one_digit: |
| 3619 | *s++ = '1'; |
| 3620 | ++k; |
| 3621 | goto ret; |
| 3622 | } |
| 3623 | if (leftright) { |
| 3624 | if (m2 > 0) |
| 3625 | mhi = lshift(mhi, m2 MTb); |
| 3626 | |
| 3627 | /* Compute mlo -- check for special case |
| 3628 | * that d is a normalized power of 2. |
| 3629 | */ |
| 3630 | |
| 3631 | mlo = mhi; |
| 3632 | if (spec_case) { |
| 3633 | mhi = Balloc(mhi->k MTb); |
| 3634 | Bcopy(mhi, mlo)memcpy((char *)&mhi->sign, (char *)&mlo->sign, mlo ->wds*sizeof(int) + 2*sizeof(int)); |
| 3635 | mhi = lshift(mhi, Log2P1 MTb); |
| 3636 | } |
| 3637 | |
| 3638 | for(i = 1;;i++) { |
| 3639 | dig = quorem(b,S) + '0'; |
| 3640 | /* Do we yet have the shortest decimal string |
| 3641 | * that will round to d? |
| 3642 | */ |
| 3643 | j = cmp(b, mlo); |
| 3644 | delta = diff(S, mhi MTb); |
| 3645 | j1 = delta->sign ? 1 : cmp(b, delta); |
| 3646 | Bfree(delta MTb); |
| 3647 | #ifndef ROUND_BIASED |
| 3648 | if (j1 == 0 && mode != 1 && !(word1(&u)(&u)->L[0] & 1) |
| 3649 | #ifdef Honor_FLT_ROUNDS |
| 3650 | && (mode <= 1 || Rounding(__builtin_flt_rounds()) >= 1) |
| 3651 | #endif |
| 3652 | ) { |
| 3653 | if (dig == '9') |
| 3654 | goto round_9_up; |
| 3655 | if (j > 0) |
| 3656 | dig++; |
| 3657 | #ifdef SET_INEXACT |
| 3658 | else if (!b->x[0] && b->wds <= 1) |
| 3659 | inexact = 0; |
| 3660 | #endif |
| 3661 | *s++ = dig; |
| 3662 | goto ret; |
| 3663 | } |
| 3664 | #endif |
| 3665 | if (j < 0 || (j == 0 && mode != 1 |
| 3666 | #ifndef ROUND_BIASED |
| 3667 | && !(word1(&u)(&u)->L[0] & 1) |
| 3668 | #endif |
| 3669 | )) { |
| 3670 | if (!b->x[0] && b->wds <= 1) { |
| 3671 | #ifdef SET_INEXACT |
| 3672 | inexact = 0; |
| 3673 | #endif |
| 3674 | goto accept_dig; |
| 3675 | } |
| 3676 | #ifdef Honor_FLT_ROUNDS |
| 3677 | if (mode > 1) |
| 3678 | switch(Rounding(__builtin_flt_rounds())) { |
| 3679 | case 0: goto accept_dig; |
| 3680 | case 2: goto keep_dig; |
| 3681 | } |
| 3682 | #endif /*Honor_FLT_ROUNDS*/ |
| 3683 | if (j1 > 0) { |
| 3684 | b = lshift(b, 1 MTb); |
| 3685 | j1 = cmp(b, S); |
| 3686 | #ifdef ROUND_BIASED |
| 3687 | if (j1 >= 0 /*)*/ |
| 3688 | #else |
| 3689 | if ((j1 > 0 || (j1 == 0 && dig & 1)) |
| 3690 | #endif |
| 3691 | && dig++ == '9') |
| 3692 | goto round_9_up; |
| 3693 | } |
| 3694 | accept_dig: |
| 3695 | *s++ = dig; |
| 3696 | goto ret; |
| 3697 | } |
| 3698 | if (j1 > 0) { |
| 3699 | #ifdef Honor_FLT_ROUNDS |
| 3700 | if (!Rounding(__builtin_flt_rounds()) && mode > 1) |
| 3701 | goto accept_dig; |
| 3702 | #endif |
| 3703 | if (dig == '9') { /* possible if i == 1 */ |
| 3704 | round_9_up: |
| 3705 | *s++ = '9'; |
| 3706 | goto roundoff; |
| 3707 | } |
| 3708 | *s++ = dig + 1; |
| 3709 | goto ret; |
| 3710 | } |
| 3711 | #ifdef Honor_FLT_ROUNDS |
| 3712 | keep_dig: |
| 3713 | #endif |
| 3714 | *s++ = dig; |
| 3715 | if (i == ilim) |
| 3716 | break; |
| 3717 | b = multadd(b, 10, 0 MTb); |
| 3718 | if (mlo == mhi) |
| 3719 | mlo = mhi = multadd(mhi, 10, 0 MTb); |
| 3720 | else { |
| 3721 | mlo = multadd(mlo, 10, 0 MTb); |
| 3722 | mhi = multadd(mhi, 10, 0 MTb); |
| 3723 | } |
| 3724 | } |
| 3725 | } |
| 3726 | else |
| 3727 | for(i = 1;; i++) { |
| 3728 | dig = quorem(b,S) + '0'; |
| 3729 | *s++ = dig; |
| 3730 | if (!b->x[0] && b->wds <= 1) { |
| 3731 | #ifdef SET_INEXACT |
| 3732 | inexact = 0; |
| 3733 | #endif |
| 3734 | goto ret; |
| 3735 | } |
| 3736 | if (i >= ilim) |
| 3737 | break; |
| 3738 | b = multadd(b, 10, 0 MTb); |
| 3739 | } |
| 3740 | |
| 3741 | /* Round off last digit */ |
| 3742 | |
| 3743 | #ifdef Honor_FLT_ROUNDS |
| 3744 | if (mode > 1) |
| 3745 | switch(Rounding(__builtin_flt_rounds())) { |
| 3746 | case 0: goto ret; |
| 3747 | case 2: goto roundoff; |
| 3748 | } |
| 3749 | #endif |
| 3750 | b = lshift(b, 1 MTb); |
| 3751 | j = cmp(b, S); |
| 3752 | #ifdef ROUND_BIASED |
| 3753 | if (j >= 0) |
| 3754 | #else |
| 3755 | if (j > 0 || (j == 0 && dig & 1)) |
| 3756 | #endif |
| 3757 | { |
| 3758 | roundoff: |
| 3759 | while(*--s == '9') |
| 3760 | if (s == buf) { |
| 3761 | k++; |
| 3762 | *s++ = '1'; |
| 3763 | goto ret; |
| 3764 | } |
| 3765 | ++*s++; |
| 3766 | } |
| 3767 | ret: |
| 3768 | Bfree(S MTb); |
| 3769 | if (mhi) { |
| 3770 | if (mlo && mlo != mhi) |
| 3771 | Bfree(mlo MTb); |
| 3772 | Bfree(mhi MTb); |
| 3773 | } |
| 3774 | retc: |
| 3775 | while(s > buf && s[-1] == '0') |
| 3776 | --s; |
| 3777 | ret1: |
| 3778 | if (b) |
| 3779 | Bfree(b MTb); |
| 3780 | *s = 0; |
| 3781 | *decpt = k + 1; |
| 3782 | if (rve) |
| 3783 | *rve = s; |
| 3784 | #ifdef SET_INEXACT |
| 3785 | if (inexact) { |
| 3786 | if (!oldinexact) { |
| 3787 | word0(&u)(&u)->L[1] = Exp_10x3ff00000 + (70 << Exp_shift20); |
| 3788 | word1(&u)(&u)->L[0] = 0; |
| 3789 | dval(&u)(&u)->d += 1.; |
| 3790 | } |
| 3791 | } |
| 3792 | else if (!oldinexact) |
| 3793 | clear_inexact(); |
| 3794 | #endif |
| 3795 | return buf; |
| 3796 | } |
| 3797 | |
| 3798 | char * |
| 3799 | dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve) |
| 3800 | { |
| 3801 | /* Sufficient space is allocated to the return value |
| 3802 | to hold the suppressed trailing zeros. |
| 3803 | See dtoa_r() above for details on the other arguments. |
| 3804 | */ |
| 3805 | #ifndef MULTIPLE_THREADS |
| 3806 | if (dtoa_result) |
| 3807 | freedtoa(dtoa_result); |
| 3808 | #endif |
| 3809 | return dtoa_r(dd, mode, ndigits, decpt, sign, rve, 0, 0); |
| 3810 | } |
| 3811 | |
| 3812 | |
| 3813 | char * |
| 3814 | dtoa_g_fmt(register char *b, double x) |
| 3815 | { |
| 3816 | register int i, k; |
| 3817 | register char *s; |
| 3818 | int decpt, j, sign; |
| 3819 | char *b0, *s0, *se; |
| 3820 | |
| 3821 | b0 = b; |
| 3822 | #ifdef IGNORE_ZERO_SIGN |
| 3823 | if (!x) { |
| 3824 | *b++ = '0'; |
| 3825 | *b = 0; |
| 3826 | goto done; |
| 3827 | } |
| 3828 | #endif |
| 3829 | s = s0 = dtoa(x, 0, 0, &decpt, &sign, &se); |
| 3830 | if (sign) |
| 3831 | *b++ = '-'; |
| 3832 | if (decpt == 9999) /* Infinity or Nan */ { |
| 3833 | while((*b++ = *s++)); |
| 3834 | goto done0; |
| 3835 | } |
| 3836 | if (decpt <= -4 || decpt > se - s + 5) { |
| 3837 | *b++ = *s++; |
| 3838 | if (*s) { |
| 3839 | *b++ = '.'; |
| 3840 | while((*b = *s++)) |
| 3841 | b++; |
| 3842 | } |
| 3843 | *b++ = 'e'; |
| 3844 | /* sprintf(b, "%+.2d", decpt - 1); */ |
| 3845 | if (--decpt < 0) { |
| 3846 | *b++ = '-'; |
| 3847 | decpt = -decpt; |
| 3848 | } |
| 3849 | else |
| 3850 | *b++ = '+'; |
| 3851 | for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10); |
| 3852 | for(;;) { |
| 3853 | i = decpt / k; |
| 3854 | *b++ = i + '0'; |
| 3855 | if (--j <= 0) |
| 3856 | break; |
| 3857 | decpt -= i*k; |
| 3858 | decpt *= 10; |
| 3859 | } |
| 3860 | *b = 0; |
| 3861 | } |
| 3862 | else if (decpt <= 0) { |
| 3863 | *b++ = '0'; // Add leading zero, not in dmg's original |
| 3864 | *b++ = '.'; |
| 3865 | for(; decpt < 0; decpt++) |
| 3866 | *b++ = '0'; |
| 3867 | while((*b++ = *s++)); |
| 3868 | } |
| 3869 | else { |
| 3870 | while((*b = *s++)) { |
| 3871 | b++; |
| 3872 | if (--decpt == 0 && *s) |
| 3873 | *b++ = '.'; |
| 3874 | } |
| 3875 | for(; decpt > 0; decpt--) |
| 3876 | *b++ = '0'; |
| 3877 | *b = 0; |
| 3878 | } |
| 3879 | done0: |
| 3880 | freedtoa(s0); |
| 3881 | #ifdef IGNORE_ZERO_SIGN |
| 3882 | done: |
| 3883 | #endif |
| 3884 | return b0; |
| 3885 | } |
| 3886 | |
| 3887 | |
| 3888 | #ifdef __cplusplus |
| 3889 | } |
| 3890 | #endif |