OSDN Git Service

* printf/quadmath-printf.c: Also check __GLIBC__ when checking
[pf3gnuchains/gcc-fork.git] / libquadmath / gdtoa / gdtoa.h
1 /****************************************************************
2
3 The author of this software is David M. Gay.
4
5 Copyright (C) 1998 by Lucent Technologies
6 All Rights Reserved
7
8 Permission to use, copy, modify, and distribute this software and
9 its documentation for any purpose and without fee is hereby
10 granted, provided that the above copyright notice appear in all
11 copies and that both that the copyright notice and this
12 permission notice and warranty disclaimer appear in supporting
13 documentation, and that the name of Lucent or any of its entities
14 not be used in advertising or publicity pertaining to
15 distribution of the software without specific, written prior
16 permission.
17
18 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
20 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
21 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
23 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25 THIS SOFTWARE.
26
27 ****************************************************************/
28
29 /* Please send bug reports to David M. Gay (dmg at acm dot org,
30  * with " at " changed at "@" and " dot " changed to ".").      */
31
32 #ifndef GDTOA_H_INCLUDED
33 #define GDTOA_H_INCLUDED
34
35 #include "arith.h"
36 #include <stddef.h> /* for size_t */
37 #include <stdlib.h> /* for strtod */
38
39 #ifndef Long
40 #define Long long
41 #endif
42 #ifndef ULong
43 typedef unsigned Long ULong;
44 #endif
45 #ifndef UShort
46 typedef unsigned short UShort;
47 #endif
48
49 #ifndef ANSI
50 #ifdef KR_headers
51 #define ANSI(x) ()
52 #define Void /*nothing*/
53 #else
54 #define ANSI(x) x
55 #define Void void
56 #endif
57 #endif /* ANSI */
58
59 #ifndef CONST
60 #ifdef KR_headers
61 #define CONST /* blank */
62 #else
63 #define CONST const
64 #endif
65 #endif /* CONST */
66
67  enum { /* return values from strtodg */
68         STRTOG_Zero     = 0,
69         STRTOG_Normal   = 1,
70         STRTOG_Denormal = 2,
71         STRTOG_Infinite = 3,
72         STRTOG_NaN      = 4,
73         STRTOG_NaNbits  = 5,
74         STRTOG_NoNumber = 6,
75         STRTOG_Retmask  = 7,
76
77         /* The following may be or-ed into one of the above values. */
78
79         STRTOG_Neg      = 0x08, /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */
80         STRTOG_Inexlo   = 0x10, /* returned result rounded toward zero */
81         STRTOG_Inexhi   = 0x20, /* returned result rounded away from zero */
82         STRTOG_Inexact  = 0x30,
83         STRTOG_Underflow= 0x40,
84         STRTOG_Overflow = 0x80
85         };
86
87  typedef struct
88 FPI {
89         int nbits;
90         int emin;
91         int emax;
92         int rounding;
93         int sudden_underflow;
94         } FPI;
95
96 enum {  /* FPI.rounding values: same as FLT_ROUNDS */
97         FPI_Round_zero = 0,
98         FPI_Round_near = 1,
99         FPI_Round_up = 2,
100         FPI_Round_down = 3
101         };
102
103 #ifdef __cplusplus
104 extern "C" {
105 #endif
106
107 extern char* dtoa  ANSI((double d, int mode, int ndigits, int *decpt,
108                         int *sign, char **rve));
109 extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
110                         int mode, int ndigits, int *decpt, char **rve));
111 extern void freedtoa ANSI((char*));
112 extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
113
114 extern char*    g_ddfmt  ANSI((char*, double*, int, size_t));
115 extern char*    g_dfmt   ANSI((char*, double*, int, size_t));
116 extern char*    g_ffmt   ANSI((char*, float*,  int, size_t));
117 extern char*    g_Qfmt   ANSI((char*, void*,   int, size_t));
118 extern char*    g_xfmt   ANSI((char*, void*,   int, size_t));
119 extern char*    g_xLfmt  ANSI((char*, void*,   int, size_t));
120
121 extern int      strtoId  ANSI((CONST char*, char**, double*, double*));
122 extern int      strtoIdd ANSI((CONST char*, char**, double*, double*));
123 extern int      strtoIf  ANSI((CONST char*, char**, float*, float*));
124 extern int      strtoIQ  ANSI((CONST char*, char**, void*, void*));
125 extern int      strtoIx  ANSI((CONST char*, char**, void*, void*));
126 extern int      strtoIxL ANSI((CONST char*, char**, void*, void*));
127 extern int      strtord  ANSI((CONST char*, char**, int, double*));
128 extern int      strtordd ANSI((CONST char*, char**, int, double*));
129 extern int      strtorf  ANSI((CONST char*, char**, int, float*));
130 extern int      strtorQ  ANSI((CONST char*, char**, int, void*));
131 extern int      strtorx  ANSI((CONST char*, char**, int, void*));
132 extern int      strtorxL ANSI((CONST char*, char**, int, void*));
133 #if 1
134 extern int      strtodI  ANSI((CONST char*, char**, double*));
135 extern int      strtopd  ANSI((CONST char*, char**, double*));
136 extern int      strtopdd ANSI((CONST char*, char**, double*));
137 extern int      strtopf  ANSI((CONST char*, char**, float*));
138 extern int      quadmath_strtopQ  ANSI((CONST char*, char**, void*));
139 extern int      strtopx  ANSI((CONST char*, char**, void*));
140 extern int      strtopxL ANSI((CONST char*, char**, void*));
141 #else
142 #define strtopd(s,se,x) strtord(s,se,1,x)
143 #define strtopdd(s,se,x) strtordd(s,se,1,x)
144 #define strtopf(s,se,x) strtorf(s,se,1,x)
145 #define strtopQ(s,se,x) strtorQ(s,se,1,x)
146 #define strtopx(s,se,x) strtorx(s,se,1,x)
147 #define strtopxL(s,se,x) strtorxL(s,se,1,x)
148 #endif
149
150 #ifdef __cplusplus
151 }
152 #endif
153 #endif /* GDTOA_H_INCLUDED */