1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/inc/gdtoaimp.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,713 @@
1.4 +/****************************************************************
1.5 +
1.6 +The author of this software is David M. Gay.
1.7 +
1.8 +Copyright (C) 1998-2000 by Lucent Technologies
1.9 +All Rights Reserved
1.10 +
1.11 +Permission to use, copy, modify, and distribute this software and
1.12 +its documentation for any purpose and without fee is hereby
1.13 +granted, provided that the above copyright notice appear in all
1.14 +copies and that both that the copyright notice and this
1.15 +permission notice and warranty disclaimer appear in supporting
1.16 +documentation, and that the name of Lucent or any of its entities
1.17 +not be used in advertising or publicity pertaining to
1.18 +distribution of the software without specific, written prior
1.19 +permission.
1.20 +
1.21 +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1.22 +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
1.23 +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
1.24 +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1.25 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
1.26 +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1.27 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
1.28 +THIS SOFTWARE.
1.29 +
1.30 +****************************************************************/
1.31 +
1.32 +/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.7 2005/01/18 18:56:18 das Exp $ */
1.33 +
1.34 +/* This is a variation on dtoa.c that converts arbitary binary
1.35 + floating-point formats to and from decimal notation. It uses
1.36 + double-precision arithmetic internally, so there are still
1.37 + various #ifdefs that adapt the calculations to the native
1.38 + double-precision arithmetic (any of IEEE, VAX D_floating,
1.39 + or IBM mainframe arithmetic).
1.40 +
1.41 + Please send bug reports to
1.42 + David M. Gay
1.43 + Bell Laboratories, Room 2C-463
1.44 + 600 Mountain Avenue
1.45 + Murray Hill, NJ 07974-0636
1.46 + U.S.A.
1.47 + dmg@bell-labs.com
1.48 + */
1.49 +
1.50 +/* On a machine with IEEE extended-precision registers, it is
1.51 + * necessary to specify double-precision (53-bit) rounding precision
1.52 + * before invoking strtod or dtoa. If the machine uses (the equivalent
1.53 + * of) Intel 80x87 arithmetic, the call
1.54 + * _control87(PC_53, MCW_PC);
1.55 + * does this with many compilers. Whether this or another call is
1.56 + * appropriate depends on the compiler; for this to work, it may be
1.57 + * necessary to #include "float.h" or another system-dependent header
1.58 + * file.
1.59 + */
1.60 +
1.61 +/* strtod for IEEE-, VAX-, and IBM-arithmetic machines.
1.62 + *
1.63 + * This strtod returns a nearest machine number to the input decimal
1.64 + * string (or sets errno to ERANGE). With IEEE arithmetic, ties are
1.65 + * broken by the IEEE round-even rule. Otherwise ties are broken by
1.66 + * biased rounding (add half and chop).
1.67 + *
1.68 + * Inspired loosely by William D. Clinger's paper "How to Read Floating
1.69 + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101].
1.70 + *
1.71 + * Modifications:
1.72 + *
1.73 + * 1. We only require IEEE, IBM, or VAX double-precision
1.74 + * arithmetic (not IEEE double-extended).
1.75 + * 2. We get by with floating-point arithmetic in a case that
1.76 + * Clinger missed -- when we're computing d * 10^n
1.77 + * for a small integer d and the integer n is not too
1.78 + * much larger than 22 (the maximum integer k for which
1.79 + * we can represent 10^k exactly), we may be able to
1.80 + * compute (d*10^k) * 10^(e-k) with just one roundoff.
1.81 + * 3. Rather than a bit-at-a-time adjustment of the binary
1.82 + * result in the hard case, we use floating-point
1.83 + * arithmetic to determine the adjustment to within
1.84 + * one bit; only in really hard cases do we need to
1.85 + * compute a second residual.
1.86 + * 4. Because of 3., we don't need a large table of powers of 10
1.87 + * for ten-to-e (just some small tables, e.g. of 10^k
1.88 + * for 0 <= k <= 22).
1.89 + */
1.90 +
1.91 +/*
1.92 + * #define IEEE_8087 for IEEE-arithmetic machines where the least
1.93 + * significant byte has the lowest address.
1.94 + * #define IEEE_MC68k for IEEE-arithmetic machines where the most
1.95 + * significant byte has the lowest address.
1.96 + * #define Long int on machines with 32-bit ints and 64-bit longs.
1.97 + * #define Sudden_Underflow for IEEE-format machines without gradual
1.98 + * underflow (i.e., that flush to zero on underflow).
1.99 + * #define IBM for IBM mainframe-style floating-point arithmetic.
1.100 + * #define VAX for VAX-style floating-point arithmetic (D_floating).
1.101 + * #define No_leftright to omit left-right logic in fast floating-point
1.102 + * computation of dtoa.
1.103 + * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3.
1.104 + * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
1.105 + * that use extended-precision instructions to compute rounded
1.106 + * products and quotients) with IBM.
1.107 + * #define ROUND_BIASED for IEEE-format with biased rounding.
1.108 + * #define Inaccurate_Divide for IEEE-format with correctly rounded
1.109 + * products but inaccurate quotients, e.g., for Intel i860.
1.110 + * #define NO_LONG_LONG on machines that do not have a "long long"
1.111 + * integer type (of >= 64 bits). On such machines, you can
1.112 + * #define Just_16 to store 16 bits per 32-bit Long when doing
1.113 + * high-precision integer arithmetic. Whether this speeds things
1.114 + * up or slows things down depends on the machine and the number
1.115 + * being converted. If long long is available and the name is
1.116 + * something other than "long long", #define Llong to be the name,
1.117 + * and if "unsigned Llong" does not work as an unsigned version of
1.118 + * Llong, #define #ULLong to be the corresponding unsigned type.
1.119 + * #define KR_headers for old-style C function headers.
1.120 + * #define Bad_float_h if your system lacks a float.h or if it does not
1.121 + * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
1.122 + * FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
1.123 + * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
1.124 + * if memory is available and otherwise does something you deem
1.125 + * appropriate. If MALLOC is undefined, malloc will be invoked
1.126 + * directly -- and assumed always to succeed.
1.127 + * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making
1.128 + * memory allocations from a private pool of memory when possible.
1.129 + * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes,
1.130 + * unless #defined to be a different length. This default length
1.131 + * suffices to get rid of MALLOC calls except for unusual cases,
1.132 + * such as decimal-to-binary conversion of a very long string of
1.133 + * digits. When converting IEEE double precision values, the
1.134 + * longest string gdtoa can return is about 751 bytes long. For
1.135 + * conversions by strtod of strings of 800 digits and all gdtoa
1.136 + * conversions of IEEE doubles in single-threaded executions with
1.137 + * 8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with
1.138 + * 4-byte pointers, PRIVATE_MEM >= 7112 appears adequate.
1.139 + * #define INFNAN_CHECK on IEEE systems to cause strtod to check for
1.140 + * Infinity and NaN (case insensitively). On some systems (e.g.,
1.141 + * some HP systems), it may be necessary to #define NAN_WORD0
1.142 + * appropriately -- to the most significant word of a quiet NaN.
1.143 + * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
1.144 + * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
1.145 + * strtodg also accepts (case insensitively) strings of the form
1.146 + * NaN(x), where x is a string of hexadecimal digits and spaces;
1.147 + * if there is only one string of hexadecimal digits, it is taken
1.148 + * for the fraction bits of the resulting NaN; if there are two or
1.149 + * more strings of hexadecimal digits, each string is assigned
1.150 + * to the next available sequence of 32-bit words of fractions
1.151 + * bits (starting with the most significant), right-aligned in
1.152 + * each sequence.
1.153 + * #define MULTIPLE_THREADS if the system offers preemptively scheduled
1.154 + * multiple threads. In this case, you must provide (or suitably
1.155 + * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
1.156 + * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed
1.157 + * in pow5mult, ensures lazy evaluation of only one copy of high
1.158 + * powers of 5; omitting this lock would introduce a small
1.159 + * probability of wasting memory, but would otherwise be harmless.)
1.160 + * You must also invoke freedtoa(s) to free the value s returned by
1.161 + * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined.
1.162 + * #define IMPRECISE_INEXACT if you do not care about the setting of
1.163 + * the STRTOG_Inexact bits in the special case of doing IEEE double
1.164 + * precision conversions (which could also be done by the strtog in
1.165 + * dtoa.c).
1.166 + * #define NO_HEX_FP to disable recognition of C9x's hexadecimal
1.167 + * floating-point constants.
1.168 + * #define -DNO_ERRNO to suppress setting errno (in strtod.c and
1.169 + * strtodg.c).
1.170 + * #define NO_STRING_H to use private versions of memcpy.
1.171 + * On some K&R systems, it may also be necessary to
1.172 + * #define DECLARE_SIZE_T in this case.
1.173 + * #define YES_ALIAS to permit aliasing certain double values with
1.174 + * arrays of ULongs. This leads to slightly better code with
1.175 + * some compilers and was always used prior to 19990916, but it
1.176 + * is not strictly legal and can cause trouble with aggressively
1.177 + * optimizing compilers (e.g., gcc 2.95.1 under -O2).
1.178 + * #define USE_LOCALE to use the current locale's decimal_point value.
1.179 + */
1.180 +
1.181 +#ifndef GDTOAIMP_H_INCLUDED
1.182 +#define GDTOAIMP_H_INCLUDED
1.183 +#include "gdtoa.h"
1.184 +
1.185 +#ifdef DEBUG
1.186 +#include "stdio.h"
1.187 +#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
1.188 +#endif
1.189 +
1.190 +#include "limits.h"
1.191 +#include "stdlib.h"
1.192 +#include "string.h"
1.193 +#include "libc_private.h"
1.194 +
1.195 +#include "namespace.h"
1.196 +#include <pthread.h>
1.197 +#include "un-namespace.h"
1.198 +
1.199 +#ifdef __SYMBIAN32__
1.200 +#ifdef __WINSCW__
1.201 +#pragma warn_unusedarg off
1.202 +#pragma warn_possunwant off
1.203 +#endif//__WINSCW__
1.204 +#endif//__SYMBIAN32__
1.205 +
1.206 +#ifdef KR_headers
1.207 +#define Char char
1.208 +#else
1.209 +#define Char void
1.210 +#endif
1.211 +
1.212 +#ifdef MALLOC
1.213 +extern Char *MALLOC ANSI((size_t));
1.214 +#else
1.215 +#define MALLOC malloc
1.216 +#endif
1.217 +
1.218 +#define INFNAN_CHECK
1.219 +#define USE_LOCALE
1.220 +#define Honor_FLT_ROUNDS
1.221 +
1.222 +#undef IEEE_Arith
1.223 +#undef Avoid_Underflow
1.224 +#ifdef IEEE_MC68k
1.225 +#define IEEE_Arith
1.226 +#endif
1.227 +#ifdef IEEE_8087
1.228 +#define IEEE_Arith
1.229 +#endif
1.230 +
1.231 +#include "errno.h"
1.232 +#ifdef Bad_float_h
1.233 +
1.234 +#ifdef IEEE_Arith
1.235 +#define DBL_DIG 15
1.236 +#define DBL_MAX_10_EXP 308
1.237 +#define DBL_MAX_EXP 1024
1.238 +#define FLT_RADIX 2
1.239 +#define DBL_MAX 1.7976931348623157e+308
1.240 +#endif
1.241 +
1.242 +#ifdef IBM
1.243 +#define DBL_DIG 16
1.244 +#define DBL_MAX_10_EXP 75
1.245 +#define DBL_MAX_EXP 63
1.246 +#define FLT_RADIX 16
1.247 +#define DBL_MAX 7.2370055773322621e+75
1.248 +#endif
1.249 +
1.250 +#ifdef VAX
1.251 +#define DBL_DIG 16
1.252 +#define DBL_MAX_10_EXP 38
1.253 +#define DBL_MAX_EXP 127
1.254 +#define FLT_RADIX 2
1.255 +#define DBL_MAX 1.7014118346046923e+38
1.256 +#define n_bigtens 2
1.257 +#endif
1.258 +
1.259 +#ifndef LONG_MAX
1.260 +#define LONG_MAX 2147483647
1.261 +#endif
1.262 +
1.263 +#else /* ifndef Bad_float_h */
1.264 +#include "float.h"
1.265 +#endif /* Bad_float_h */
1.266 +
1.267 +#ifdef IEEE_Arith
1.268 +#define Scale_Bit 0x10
1.269 +#define n_bigtens 5
1.270 +#endif
1.271 +
1.272 +#ifdef IBM
1.273 +#define n_bigtens 3
1.274 +#endif
1.275 +
1.276 +#ifdef VAX
1.277 +#define n_bigtens 2
1.278 +#endif
1.279 +
1.280 +#ifndef __MATH_H__
1.281 +#include "math.h"
1.282 +#endif
1.283 +
1.284 +#ifdef __cplusplus
1.285 +extern "C" {
1.286 +#endif
1.287 +
1.288 +#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
1.289 +//Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
1.290 +#endif
1.291 +
1.292 +typedef union { double d; ULong L[2]; } U;
1.293 +
1.294 +#ifdef YES_ALIAS
1.295 +#define dval(x) x
1.296 +#ifdef IEEE_8087
1.297 +#define word0(x) ((ULong *)&x)[1]
1.298 +#define word1(x) ((ULong *)&x)[0]
1.299 +#else
1.300 +#define word0(x) ((ULong *)&x)[0]
1.301 +#define word1(x) ((ULong *)&x)[1]
1.302 +#endif
1.303 +#else /* !YES_ALIAS */
1.304 +#ifdef IEEE_8087
1.305 +#define word0(x) ((U*)&x)->L[1]
1.306 +#define word1(x) ((U*)&x)->L[0]
1.307 +#else
1.308 +#define word0(x) ((U*)&x)->L[0]
1.309 +#define word1(x) ((U*)&x)->L[1]
1.310 +#endif
1.311 +#define dval(x) ((U*)&x)->d
1.312 +#endif /* YES_ALIAS */
1.313 +
1.314 +/* The following definition of Storeinc is appropriate for MIPS processors.
1.315 + * An alternative that might be better on some machines is
1.316 + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
1.317 + */
1.318 +#if defined(IEEE_8087) + defined(VAX)
1.319 +#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
1.320 +((unsigned short *)a)[0] = (unsigned short)c, a++)
1.321 +#else
1.322 +#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
1.323 +((unsigned short *)a)[1] = (unsigned short)c, a++)
1.324 +#endif
1.325 +
1.326 +/* #define P DBL_MANT_DIG */
1.327 +/* Ten_pmax = floor(P*log(2)/log(5)) */
1.328 +/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */
1.329 +/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */
1.330 +/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
1.331 +
1.332 +#ifdef IEEE_Arith
1.333 +#define Exp_shift 20
1.334 +#define Exp_shift1 20
1.335 +#define Exp_msk1 0x100000
1.336 +#define Exp_msk11 0x100000
1.337 +#define Exp_mask 0x7ff00000
1.338 +#define P 53
1.339 +#define Bias 1023
1.340 +#define Emin (-1022)
1.341 +#define Exp_1 0x3ff00000
1.342 +#define Exp_11 0x3ff00000
1.343 +#define Ebits 11
1.344 +#define Frac_mask 0xfffff
1.345 +#define Frac_mask1 0xfffff
1.346 +#define Ten_pmax 22
1.347 +#define Bletch 0x10
1.348 +#define Bndry_mask 0xfffff
1.349 +#define Bndry_mask1 0xfffff
1.350 +#define LSB 1
1.351 +#define Sign_bit 0x80000000
1.352 +#define Log2P 1
1.353 +#define Tiny0 0
1.354 +#define Tiny1 1
1.355 +#define Quick_max 14
1.356 +#define Int_max 14
1.357 +
1.358 +#ifndef Flt_Rounds
1.359 +#ifdef FLT_ROUNDS
1.360 +#define Flt_Rounds FLT_ROUNDS
1.361 +#else
1.362 +#define Flt_Rounds 1
1.363 +#endif
1.364 +#endif /*Flt_Rounds*/
1.365 +
1.366 +#else /* ifndef IEEE_Arith */
1.367 +#undef Sudden_Underflow
1.368 +#define Sudden_Underflow
1.369 +#ifdef IBM
1.370 +#undef Flt_Rounds
1.371 +#define Flt_Rounds 0
1.372 +#define Exp_shift 24
1.373 +#define Exp_shift1 24
1.374 +#define Exp_msk1 0x1000000
1.375 +#define Exp_msk11 0x1000000
1.376 +#define Exp_mask 0x7f000000
1.377 +#define P 14
1.378 +#define Bias 65
1.379 +#define Exp_1 0x41000000
1.380 +#define Exp_11 0x41000000
1.381 +#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
1.382 +#define Frac_mask 0xffffff
1.383 +#define Frac_mask1 0xffffff
1.384 +#define Bletch 4
1.385 +#define Ten_pmax 22
1.386 +#define Bndry_mask 0xefffff
1.387 +#define Bndry_mask1 0xffffff
1.388 +#define LSB 1
1.389 +#define Sign_bit 0x80000000
1.390 +#define Log2P 4
1.391 +#define Tiny0 0x100000
1.392 +#define Tiny1 0
1.393 +#define Quick_max 14
1.394 +#define Int_max 15
1.395 +#else /* VAX */
1.396 +#undef Flt_Rounds
1.397 +#define Flt_Rounds 1
1.398 +#define Exp_shift 23
1.399 +#define Exp_shift1 7
1.400 +#define Exp_msk1 0x80
1.401 +#define Exp_msk11 0x800000
1.402 +#define Exp_mask 0x7f80
1.403 +#define P 56
1.404 +#define Bias 129
1.405 +#define Exp_1 0x40800000
1.406 +#define Exp_11 0x4080
1.407 +#define Ebits 8
1.408 +#define Frac_mask 0x7fffff
1.409 +#define Frac_mask1 0xffff007f
1.410 +#define Ten_pmax 24
1.411 +#define Bletch 2
1.412 +#define Bndry_mask 0xffff007f
1.413 +#define Bndry_mask1 0xffff007f
1.414 +#define LSB 0x10000
1.415 +#define Sign_bit 0x8000
1.416 +#define Log2P 1
1.417 +#define Tiny0 0x80
1.418 +#define Tiny1 0
1.419 +#define Quick_max 15
1.420 +#define Int_max 15
1.421 +#endif /* IBM, VAX */
1.422 +#endif /* IEEE_Arith */
1.423 +
1.424 +#ifndef IEEE_Arith
1.425 +#define ROUND_BIASED
1.426 +#endif
1.427 +
1.428 +#ifdef RND_PRODQUOT
1.429 +#define rounded_product(a,b) a = rnd_prod(a, b)
1.430 +#define rounded_quotient(a,b) a = rnd_quot(a, b)
1.431 +#ifdef KR_headers
1.432 +extern double rnd_prod(), rnd_quot();
1.433 +#else
1.434 +extern double rnd_prod(double, double), rnd_quot(double, double);
1.435 +#endif
1.436 +#else
1.437 +#define rounded_product(a,b) a *= b
1.438 +#define rounded_quotient(a,b) a /= b
1.439 +#endif
1.440 +
1.441 +#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
1.442 +#define Big1 0xffffffff
1.443 +
1.444 +#undef Pack_16
1.445 +#ifndef Pack_32
1.446 +#define Pack_32
1.447 +#endif
1.448 +
1.449 +#ifdef NO_LONG_LONG
1.450 +#undef ULLong
1.451 +#ifdef Just_16
1.452 +#undef Pack_32
1.453 +#define Pack_16
1.454 +/* When Pack_32 is not defined, we store 16 bits per 32-bit Long.
1.455 + * This makes some inner loops simpler and sometimes saves work
1.456 + * during multiplications, but it often seems to make things slightly
1.457 + * slower. Hence the default is now to store 32 bits per Long.
1.458 + */
1.459 +#endif
1.460 +#else /* long long available */
1.461 +#ifndef Llong
1.462 +#define Llong long long
1.463 +#endif
1.464 +#ifndef ULLong
1.465 +#define ULLong unsigned Llong
1.466 +#endif
1.467 +#endif /* NO_LONG_LONG */
1.468 +
1.469 +#ifdef Pack_32
1.470 +#define ULbits 32
1.471 +#define kshift 5
1.472 +#define kmask 31
1.473 +#define ALL_ON 0xffffffff
1.474 +#else
1.475 +#define ULbits 16
1.476 +#define kshift 4
1.477 +#define kmask 15
1.478 +#define ALL_ON 0xffff
1.479 +#endif
1.480 +
1.481 +#define MULTIPLE_THREADS
1.482 +
1.483 +#ifndef EMULATOR
1.484 +extern pthread_mutex_t __gdtoa_locks[2];
1.485 +#else
1.486 +#define __gdtoa_locks (RETURN_WSD_VAR(__gdtoa_locks, g))
1.487 +#endif
1.488 +
1.489 +#define ACQUIRE_DTOA_LOCK(n) do { \
1.490 + if (__isthreaded) \
1.491 + _pthread_mutex_lock(&__gdtoa_locks[n]); \
1.492 +}while(0)
1.493 +#define FREE_DTOA_LOCK(n) do { \
1.494 + if (__isthreaded) \
1.495 + _pthread_mutex_unlock(&__gdtoa_locks[n]); \
1.496 +} while(0)
1.497 +
1.498 +#ifndef __SYMBIAN32__
1.499 +#define Kmax 15
1.500 +
1.501 + struct
1.502 +Bigint {
1.503 + struct Bigint *next;
1.504 + int k, maxwds, sign, wds;
1.505 + ULong x[1];
1.506 + };
1.507 +
1.508 + typedef struct Bigint Bigint;
1.509 +
1.510 +#endif
1.511 +
1.512 +#include "gdtoatypes.h"
1.513 +
1.514 +#ifdef NO_STRING_H
1.515 +#ifdef DECLARE_SIZE_T
1.516 +typedef unsigned int size_t;
1.517 +#endif
1.518 +extern void memcpy_D2A ANSI((void*, const void*, size_t));
1.519 +#define Bcopy(x,y) memcpy_D2A(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
1.520 +#else /* !NO_STRING_H */
1.521 +#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
1.522 +#endif /* NO_STRING_H */
1.523 +
1.524 +/*
1.525 + * Paranoia: Protect exported symbols, including ones in files we don't
1.526 + * compile right now. The standard strtof and strtod survive.
1.527 + */
1.528 +#define dtoa __dtoa
1.529 +#define gdtoa __gdtoa
1.530 +#define freedtoa __freedtoa
1.531 +#define strtodg __strtodg
1.532 +#define g_ddfmt __g_ddfmt
1.533 +#define g_dfmt __g_dfmt
1.534 +#define g_ffmt __g_ffmt
1.535 +#define g_Qfmt __g_Qfmt
1.536 +#define g_xfmt __g_xfmt
1.537 +#define g_xLfmt __g_xLfmt
1.538 +#define strtoId __strtoId
1.539 +#define strtoIdd __strtoIdd
1.540 +#define strtoIf __strtoIf
1.541 +#define strtoIQ __strtoIQ
1.542 +#define strtoIx __strtoIx
1.543 +#define strtoIxL __strtoIxL
1.544 +#define strtord __strtord
1.545 +#define strtordd __strtordd
1.546 +#define strtorf __strtorf
1.547 +#define strtorQ __strtorQ
1.548 +#define strtorx __strtorx
1.549 +#define strtorxL __strtorxL
1.550 +#define strtodI __strtodI
1.551 +#define strtopd __strtopd
1.552 +#define strtopdd __strtopdd
1.553 +#define strtopf __strtopf
1.554 +#define strtopQ __strtopQ
1.555 +#define strtopx __strtopx
1.556 +#define strtopxL __strtopxL
1.557 +
1.558 +/* Protect gdtoa-internal symbols */
1.559 +#define Balloc __Balloc_D2A
1.560 +#define Bfree __Bfree_D2A
1.561 +#define ULtoQ __ULtoQ_D2A
1.562 +#define ULtof __ULtof_D2A
1.563 +#define ULtod __ULtod_D2A
1.564 +#define ULtodd __ULtodd_D2A
1.565 +#define ULtox __ULtox_D2A
1.566 +#define ULtoxL __ULtoxL_D2A
1.567 +#define any_on __any_on_D2A
1.568 +#define b2d __b2d_D2A
1.569 +#define bigtens __bigtens_D2A
1.570 +#define cmp __cmp_D2A
1.571 +#define copybits __copybits_D2A
1.572 +#define d2b __d2b_D2A
1.573 +#define decrement __decrement_D2A
1.574 +#define diff __diff_D2A
1.575 +#define dtoa_result __dtoa_result_D2A
1.576 +#define g__fmt __g__fmt_D2A
1.577 +#define gethex __gethex_D2A
1.578 +#define hexdig __hexdig_D2A
1.579 +#define hexdig_init_D2A __hexdig_init_D2A
1.580 +#define hexnan __hexnan_D2A
1.581 +#define hi0bits __hi0bits_D2A
1.582 +#define i2b __i2b_D2A
1.583 +#define increment __increment_D2A
1.584 +#define lo0bits __lo0bits_D2A
1.585 +#define lshift __lshift_D2A
1.586 +#define match __match_D2A
1.587 +#define mult __mult_D2A
1.588 +#define multadd __multadd_D2A
1.589 +#define nrv_alloc __nrv_alloc_D2A
1.590 +#define pow5mult __pow5mult_D2A
1.591 +#define quorem __quorem_D2A
1.592 +#define ratio __ratio_D2A
1.593 +#define rshift __rshift_D2A
1.594 +#define rv_alloc __rv_alloc_D2A
1.595 +#define s2b __s2b_D2A
1.596 +#define set_ones __set_ones_D2A
1.597 +#define strcp __strcp_D2A
1.598 +#define strcp_D2A __strcp_D2A
1.599 +#define strtoIg __strtoIg_D2A
1.600 +#define sum __sum_D2A
1.601 +#define tens __tens_D2A
1.602 +#define tinytens __tinytens_D2A
1.603 +#define tinytens __tinytens_D2A
1.604 +#define trailz __trailz_D2A
1.605 +#define ulp __ulp_D2A
1.606 +
1.607 + extern char *dtoa_result;
1.608 + extern CONST double bigtens[], tens[], tinytens[];
1.609 +
1.610 +#ifdef __SYMBIAN32__
1.611 + extern unsigned const char hexdig[];
1.612 +#endif
1.613 +
1.614 + extern Bigint *Balloc ANSI((int));
1.615 + extern void Bfree ANSI((Bigint*));
1.616 + extern void ULtof ANSI((ULong*, ULong*, Long, int));
1.617 + extern void ULtod ANSI((ULong*, ULong*, Long, int));
1.618 + extern void ULtodd ANSI((ULong*, ULong*, Long, int));
1.619 + extern void ULtoQ ANSI((ULong*, ULong*, Long, int));
1.620 + extern void ULtox ANSI((UShort*, ULong*, Long, int));
1.621 + extern void ULtoxL ANSI((ULong*, ULong*, Long, int));
1.622 + extern ULong any_on ANSI((Bigint*, int));
1.623 + extern double b2d ANSI((Bigint*, int*));
1.624 + extern int cmp ANSI((Bigint*, Bigint*));
1.625 + extern void copybits ANSI((ULong*, int, Bigint*));
1.626 + extern Bigint *d2b ANSI((double, int*, int*));
1.627 + extern int decrement ANSI((Bigint*));
1.628 + extern Bigint *diff ANSI((Bigint*, Bigint*));
1.629 + extern char *dtoa ANSI((double d, int mode, int ndigits,
1.630 + int *decpt, int *sign, char **rve));
1.631 + extern void freedtoa ANSI((char*));
1.632 + extern char *gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
1.633 + int mode, int ndigits, int *decpt, char **rve));
1.634 + extern char *g__fmt ANSI((char*, char*, char*, int, ULong));
1.635 + extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
1.636 + extern void hexdig_init_D2A(Void);
1.637 + extern int hexnan ANSI((CONST char**, FPI*, ULong*));
1.638 + extern int hi0bits ANSI((ULong));
1.639 + extern Bigint *i2b ANSI((int));
1.640 + extern Bigint *increment ANSI((Bigint*));
1.641 + extern int lo0bits ANSI((ULong*));
1.642 + extern Bigint *lshift ANSI((Bigint*, int));
1.643 + extern int match ANSI((CONST char**, char*));
1.644 + extern Bigint *mult ANSI((Bigint*, Bigint*));
1.645 + extern Bigint *multadd ANSI((Bigint*, int, int));
1.646 + extern char *nrv_alloc ANSI((char*, char **, int));
1.647 + extern Bigint *pow5mult ANSI((Bigint*, int));
1.648 + extern int quorem ANSI((Bigint*, Bigint*));
1.649 + extern double ratio ANSI((Bigint*, Bigint*));
1.650 + extern void rshift ANSI((Bigint*, int));
1.651 + extern char *rv_alloc ANSI((int));
1.652 + extern Bigint *s2b ANSI((CONST char*, int, int, ULong));
1.653 + extern Bigint *set_ones ANSI((Bigint*, int));
1.654 + extern char *strcp ANSI((char*, const char*));
1.655 + extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
1.656 +
1.657 + extern int strtoId ANSI((CONST char *, char **, double *, double *));
1.658 + extern int strtoIdd ANSI((CONST char *, char **, double *, double *));
1.659 + extern int strtoIf ANSI((CONST char *, char **, float *, float *));
1.660 + extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
1.661 + extern int strtoIQ ANSI((CONST char *, char **, void *, void *));
1.662 + extern int strtoIx ANSI((CONST char *, char **, void *, void *));
1.663 + extern int strtoIxL ANSI((CONST char *, char **, void *, void *));
1.664 + extern double strtod ANSI((const char *s00, char **se));
1.665 + extern int strtopQ ANSI((CONST char *, char **, Void *));
1.666 + extern int strtopf ANSI((CONST char *, char **, float *));
1.667 + extern int strtopd ANSI((CONST char *, char **, double *));
1.668 + extern int strtopdd ANSI((CONST char *, char **, double *));
1.669 + extern int strtopx ANSI((CONST char *, char **, Void *));
1.670 + extern int strtopxL ANSI((CONST char *, char **, Void *));
1.671 + extern int strtord ANSI((CONST char *, char **, int, double *));
1.672 + extern int strtordd ANSI((CONST char *, char **, int, double *));
1.673 + extern int strtorf ANSI((CONST char *, char **, int, float *));
1.674 + extern int strtorQ ANSI((CONST char *, char **, int, void *));
1.675 + extern int strtorx ANSI((CONST char *, char **, int, void *));
1.676 + extern int strtorxL ANSI((CONST char *, char **, int, void *));
1.677 + extern Bigint *sum ANSI((Bigint*, Bigint*));
1.678 + extern int trailz ANSI((Bigint*));
1.679 + extern double ulp ANSI((double));
1.680 +
1.681 +#ifdef __cplusplus
1.682 +}
1.683 +#endif
1.684 +
1.685 +
1.686 +#ifdef IEEE_Arith
1.687 +#ifdef IEEE_MC68k
1.688 +#define _0 0
1.689 +#define _1 1
1.690 +#else
1.691 +#define _0 1
1.692 +#define _1 0
1.693 +#endif
1.694 +#else
1.695 +#undef INFNAN_CHECK
1.696 +#endif
1.697 +
1.698 +#ifdef INFNAN_CHECK
1.699 +
1.700 +#ifndef NAN_WORD0
1.701 +#define NAN_WORD0 0x7ff80000
1.702 +#endif
1.703 +
1.704 +#ifndef NAN_WORD1
1.705 +#define NAN_WORD1 0
1.706 +#endif
1.707 +#endif /* INFNAN_CHECK */
1.708 +
1.709 +#undef SI
1.710 +#ifdef Sudden_Underflow
1.711 +#define SI 1
1.712 +#else
1.713 +#define SI 0
1.714 +#endif
1.715 +
1.716 +#endif /* GDTOAIMP_H_INCLUDED */