]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/gdtoa/gdtoa.h
QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix SubmitCommand() out size
[mirror_edk2.git] / StdLib / LibC / gdtoa / gdtoa.h
1 /** @file
2
3 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials are licensed and made available under
5 the terms and conditions of the BSD License that accompanies this distribution.
6 The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 The author of this software is David M. Gay.
13
14 Copyright (C) 1998 by Lucent Technologies
15 All Rights Reserved
16
17 Permission to use, copy, modify, and distribute this software and
18 its documentation for any purpose and without fee is hereby
19 granted, provided that the above copyright notice appear in all
20 copies and that both that the copyright notice and this
21 permission notice and warranty disclaimer appear in supporting
22 documentation, and that the name of Lucent or any of its entities
23 not be used in advertising or publicity pertaining to
24 distribution of the software without specific, written prior
25 permission.
26
27 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
28 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
29 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
30 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
31 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
32 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
33 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
34 THIS SOFTWARE.
35
36 $NetBSD: gdtoa.h,v 1.6.4.1.4.1 2008/04/08 21:10:55 jdc Exp
37
38 ****************************************************************/
39
40 /* Please send bug reports to David M. Gay (dmg at acm dot org,
41 * with " at " changed at "@" and " dot " changed to "."). */
42
43 #ifndef GDTOA_H_INCLUDED
44 #define GDTOA_H_INCLUDED
45 #include <LibConfig.h>
46
47 #include "arith.h"
48
49 #ifndef Long
50 #define Long int32_t
51 #endif
52 #ifndef ULong
53 #define ULong uint32_t
54 #endif
55 #ifndef UShort
56 #define UShort uint16_t
57 #endif
58
59 #ifndef ANSI
60 #define ANSI(x) x
61 #define Void void
62 #endif /* ANSI */
63
64 #ifndef CONST
65 #define CONST const
66 #endif /* CONST */
67
68 enum { /* return values from strtodg */
69 STRTOG_Zero = 0,
70 STRTOG_Normal = 1,
71 STRTOG_Denormal = 2,
72 STRTOG_Infinite = 3,
73 STRTOG_NaN = 4,
74 STRTOG_NaNbits = 5,
75 STRTOG_NoNumber = 6,
76 STRTOG_Retmask = 7,
77
78 /* The following may be or-ed into one of the above values. */
79
80 STRTOG_Neg = 0x08,
81 STRTOG_Inexlo = 0x10,
82 STRTOG_Inexhi = 0x20,
83 STRTOG_Inexact = 0x30,
84 STRTOG_Underflow= 0x40,
85 STRTOG_Overflow = 0x80,
86 STRTOG_NoMemory = 0x100
87 };
88
89 typedef struct
90 FPI {
91 int nbits;
92 int emin;
93 int emax;
94 int rounding;
95 int sudden_underflow;
96 } FPI;
97
98 enum { /* FPI.rounding values: same as FLT_ROUNDS */
99 FPI_Round_zero = 0,
100 FPI_Round_near = 1,
101 FPI_Round_up = 2,
102 FPI_Round_down = 3
103 };
104
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108
109 #define dtoa __dtoa
110 #define gdtoa __gdtoa
111 #define ldtoa __ldtoa
112 #define hldtoa __hldtoa
113 #define hdtoa __hdtoa
114 #define freedtoa __freedtoa
115 #define strtodg __strtodg_D2A
116 #define strtopQ __strtopQ_D2A
117 #define strtopx __strtopx_D2A
118 #define strtopxL __strtopxL_D2A
119 #define strtord __strtord_D2A
120
121 extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
122 int *sign, char **rve));
123 extern char* hdtoa ANSI((double d, const char *xdigs, int ndigits, int *decpt,
124 int *sign, char **rve));
125 extern char* ldtoa ANSI((long double *ld, int mode, int ndigits, int *decpt,
126 int *sign, char **rve));
127 extern char* hldtoa ANSI((long double e, const char *xdigs, int ndigits,
128 int *decpt, int *sign, char **rve));
129
130 extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
131 int mode, int ndigits, int *decpt, char **rve));
132 extern void freedtoa ANSI((char*));
133 extern float strtof ANSI((CONST char *, char **));
134 extern double strtod ANSI((CONST char *, char **));
135 extern int strtodg ANSI((CONST char*, char**, CONST FPI*, Long*, ULong*));
136
137 extern char* g_ddfmt ANSI((char*, double*, int, unsigned));
138 extern char* g_dfmt ANSI((char*, double*, int, unsigned));
139 extern char* g_ffmt ANSI((char*, float*, int, unsigned));
140 extern char* g_Qfmt ANSI((char*, void*, int, unsigned));
141 extern char* g_xfmt ANSI((char*, void*, int, unsigned));
142 extern char* g_xLfmt ANSI((char*, void*, int, unsigned));
143
144 extern int strtoId ANSI((CONST char*, char**, double*, double*));
145 extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
146 extern int strtoIf ANSI((CONST char*, char**, float*, float*));
147 extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
148 extern int strtoIx ANSI((CONST char*, char**, void*, void*));
149 extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
150 extern int strtord ANSI((CONST char*, char**, int, double*));
151 extern int strtordd ANSI((CONST char*, char**, int, double*));
152 extern int strtorf ANSI((CONST char*, char**, int, float*));
153 extern int strtorQ ANSI((CONST char*, char**, int, void*));
154 extern int strtorx ANSI((CONST char*, char**, int, void*));
155 extern int strtorxL ANSI((CONST char*, char**, int, void*));
156
157 extern int strtodI ANSI((CONST char*, char**, double*));
158 extern int strtopd ANSI((CONST char*, char**, double*));
159 extern int strtopdd ANSI((CONST char*, char**, double*));
160 extern int strtopf ANSI((CONST char*, char**, float*));
161 extern int strtopQ ANSI((CONST char*, char**, void*));
162 extern int strtopx ANSI((CONST char*, char**, void*));
163 extern int strtopxL ANSI((CONST char*, char**, void*));
164
165 #ifdef __cplusplus
166 }
167 #endif
168 #endif /* GDTOA_H_INCLUDED */