]> git.saurik.com Git - apple/libc.git/blame - gdtoa/FreeBSD/gdtoa.h
Libc-498.1.7.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
3d9156a7
A
29/* Please send bug reports to David M. Gay (dmg at acm dot org,
30 * with " at " changed at "@" and " dot " changed to "."). */
9385eb3d
A
31
32#ifndef GDTOA_H_INCLUDED
33#define GDTOA_H_INCLUDED
34
35#include "arith.h"
36
37#ifndef Long
38#define Long long
39#endif
40#ifndef ULong
41typedef unsigned Long ULong;
42#endif
43#ifndef UShort
44typedef unsigned short UShort;
45#endif
46
47#ifndef ANSI
48#ifdef KR_headers
49#define ANSI(x) ()
50#define Void /*nothing*/
51#else
52#define ANSI(x) x
53#define Void void
54#endif
55#endif /* ANSI */
56
57#ifndef CONST
58#ifdef KR_headers
59#define CONST /* blank */
60#else
61#define CONST const
62#endif
63#endif /* CONST */
64
65 enum { /* return values from strtodg */
66 STRTOG_Zero = 0,
67 STRTOG_Normal = 1,
68 STRTOG_Denormal = 2,
69 STRTOG_Infinite = 3,
70 STRTOG_NaN = 4,
71 STRTOG_NaNbits = 5,
72 STRTOG_NoNumber = 6,
73 STRTOG_Retmask = 7,
74
75 /* The following may be or-ed into one of the above values. */
76
77 STRTOG_Neg = 0x08,
78 STRTOG_Inexlo = 0x10,
79 STRTOG_Inexhi = 0x20,
80 STRTOG_Inexact = 0x30,
81 STRTOG_Underflow= 0x40,
82 STRTOG_Overflow = 0x80
83 };
84
85 typedef struct
86FPI {
87 int nbits;
88 int emin;
89 int emax;
90 int rounding;
91 int sudden_underflow;
92 } FPI;
93
94enum { /* FPI.rounding values: same as FLT_ROUNDS */
95 FPI_Round_zero = 0,
96 FPI_Round_near = 1,
97 FPI_Round_up = 2,
98 FPI_Round_down = 3
99 };
100
101#ifdef __cplusplus
102extern "C" {
103#endif
104
105extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
106 int *sign, char **rve));
107extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
108 int mode, int ndigits, int *decpt, char **rve));
109extern void freedtoa ANSI((char*));
110extern float strtof ANSI((CONST char *, char **));
111extern double strtod ANSI((CONST char *, char **));
112extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
113
114extern char* g_ddfmt ANSI((char*, double*, int, unsigned));
115extern char* g_dfmt ANSI((char*, double*, int, unsigned));
116extern char* g_ffmt ANSI((char*, float*, int, unsigned));
117extern char* g_Qfmt ANSI((char*, void*, int, unsigned));
118extern char* g_xfmt ANSI((char*, void*, int, unsigned));
119extern char* g_xLfmt ANSI((char*, void*, int, unsigned));
120
121extern int strtoId ANSI((CONST char*, char**, double*, double*));
122extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
123extern int strtoIf ANSI((CONST char*, char**, float*, float*));
124extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
125extern int strtoIx ANSI((CONST char*, char**, void*, void*));
126extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
127extern int strtord ANSI((CONST char*, char**, int, double*));
128extern int strtordd ANSI((CONST char*, char**, int, double*));
129extern int strtorf ANSI((CONST char*, char**, int, float*));
130extern int strtorQ ANSI((CONST char*, char**, int, void*));
131extern int strtorx ANSI((CONST char*, char**, int, void*));
132extern int strtorxL ANSI((CONST char*, char**, int, void*));
133#if 1
134extern int strtodI ANSI((CONST char*, char**, double*));
135extern int strtopd ANSI((CONST char*, char**, double*));
136extern int strtopdd ANSI((CONST char*, char**, double*));
137extern int strtopf ANSI((CONST char*, char**, float*));
138extern int strtopQ ANSI((CONST char*, char**, void*));
139extern int strtopx ANSI((CONST char*, char**, void*));
140extern 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 */