Fix mdoc(7)/man(7) mix up.
[netbsd-mini2440.git] / lib / libc / gdtoa / gdtoa.h
blobf315cc24b0f7a8e2b83ff61c1c83e7cc8d7b7126
1 /* $NetBSD: gdtoa.h,v 1.7 2007/02/02 23:05:56 christos Exp $ */
3 /****************************************************************
5 The author of this software is David M. Gay.
7 Copyright (C) 1998 by Lucent Technologies
8 All Rights Reserved
10 Permission to use, copy, modify, and distribute this software and
11 its documentation for any purpose and without fee is hereby
12 granted, provided that the above copyright notice appear in all
13 copies and that both that the copyright notice and this
14 permission notice and warranty disclaimer appear in supporting
15 documentation, and that the name of Lucent or any of its entities
16 not be used in advertising or publicity pertaining to
17 distribution of the software without specific, written prior
18 permission.
20 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
22 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
23 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
25 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
26 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
27 THIS SOFTWARE.
29 ****************************************************************/
31 /* Please send bug reports to David M. Gay (dmg at acm dot org,
32 * with " at " changed at "@" and " dot " changed to "."). */
34 #ifndef GDTOA_H_INCLUDED
35 #define GDTOA_H_INCLUDED
37 #include "arith.h"
39 #ifndef Long
40 #define Long int32_t
41 #endif
42 #ifndef ULong
43 #define ULong uint32_t
44 #endif
45 #ifndef UShort
46 #define UShort uint16_t
47 #endif
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 */
59 #ifndef CONST
60 #ifdef KR_headers
61 #define CONST /* blank */
62 #else
63 #define CONST const
64 #endif
65 #endif /* CONST */
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,
77 /* The following may be or-ed into one of the above values. */
79 STRTOG_Neg = 0x08,
80 STRTOG_Inexlo = 0x10,
81 STRTOG_Inexhi = 0x20,
82 STRTOG_Inexact = 0x30,
83 STRTOG_Underflow= 0x40,
84 STRTOG_Overflow = 0x80,
85 STRTOG_NoMemory = 0x100
88 typedef struct
89 FPI {
90 int nbits;
91 int emin;
92 int emax;
93 int rounding;
94 int sudden_underflow;
95 } FPI;
97 enum { /* FPI.rounding values: same as FLT_ROUNDS */
98 FPI_Round_zero = 0,
99 FPI_Round_near = 1,
100 FPI_Round_up = 2,
101 FPI_Round_down = 3
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
108 #define dtoa __dtoa
109 #define gdtoa __gdtoa
110 #define ldtoa __ldtoa
111 #define hldtoa __hldtoa
112 #define hdtoa __hdtoa
113 #define freedtoa __freedtoa
114 #define strtodg __strtodg_D2A
115 #define strtopQ __strtopQ_D2A
116 #define strtopx __strtopx_D2A
117 #define strtopxL __strtopxL_D2A
118 #define strtord __strtord_D2A
120 extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
121 int *sign, char **rve));
122 extern char* hdtoa ANSI((double d, const char *xdigs, int ndigits, int *decpt,
123 int *sign, char **rve));
124 extern char* ldtoa ANSI((long double *ld, int mode, int ndigits, int *decpt,
125 int *sign, char **rve));
126 extern char* hldtoa ANSI((long double e, const char *xdigs, int ndigits,
127 int *decpt, int *sign, char **rve));
129 extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
130 int mode, int ndigits, int *decpt, char **rve));
131 extern void freedtoa ANSI((char*));
132 extern float strtof ANSI((CONST char *, char **));
133 extern double strtod ANSI((CONST char *, char **));
134 extern int strtodg ANSI((CONST char*, char**, CONST FPI*, Long*, ULong*));
136 extern char* g_ddfmt ANSI((char*, double*, int, unsigned));
137 extern char* g_dfmt ANSI((char*, double*, int, unsigned));
138 extern char* g_ffmt ANSI((char*, float*, int, unsigned));
139 extern char* g_Qfmt ANSI((char*, void*, int, unsigned));
140 extern char* g_xfmt ANSI((char*, void*, int, unsigned));
141 extern char* g_xLfmt ANSI((char*, void*, int, unsigned));
143 extern int strtoId ANSI((CONST char*, char**, double*, double*));
144 extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
145 extern int strtoIf ANSI((CONST char*, char**, float*, float*));
146 extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
147 extern int strtoIx ANSI((CONST char*, char**, void*, void*));
148 extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
149 extern int strtord ANSI((CONST char*, char**, int, double*));
150 extern int strtordd ANSI((CONST char*, char**, int, double*));
151 extern int strtorf ANSI((CONST char*, char**, int, float*));
152 extern int strtorQ ANSI((CONST char*, char**, int, void*));
153 extern int strtorx ANSI((CONST char*, char**, int, void*));
154 extern int strtorxL ANSI((CONST char*, char**, int, void*));
155 #if 1
156 extern int strtodI ANSI((CONST char*, char**, double*));
157 extern int strtopd ANSI((CONST char*, char**, double*));
158 extern int strtopdd ANSI((CONST char*, char**, double*));
159 extern int strtopf ANSI((CONST char*, char**, float*));
160 extern int strtopQ ANSI((CONST char*, char**, void*));
161 extern int strtopx ANSI((CONST char*, char**, void*));
162 extern int strtopxL ANSI((CONST char*, char**, void*));
163 #else
164 #define strtopd(s,se,x) strtord(s,se,1,x)
165 #define strtopdd(s,se,x) strtordd(s,se,1,x)
166 #define strtopf(s,se,x) strtorf(s,se,1,x)
167 #define strtopQ(s,se,x) strtorQ(s,se,1,x)
168 #define strtopx(s,se,x) strtorx(s,se,1,x)
169 #define strtopxL(s,se,x) strtorxL(s,se,1,x)
170 #endif
172 #ifdef __cplusplus
174 #endif
175 #endif /* GDTOA_H_INCLUDED */