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