Mercurial > hg > CbC > CbC_gcc
comparison libdecnumber/decDouble.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
24 <http://www.gnu.org/licenses/>. */ | 24 <http://www.gnu.org/licenses/>. */ |
25 | 25 |
26 /* ------------------------------------------------------------------ */ | 26 /* ------------------------------------------------------------------ */ |
27 /* decDouble.h -- Decimal 64-bit format module header */ | 27 /* decDouble.h -- Decimal 64-bit format module header */ |
28 /* ------------------------------------------------------------------ */ | 28 /* ------------------------------------------------------------------ */ |
29 /* Please see decFloats.h for an overview and documentation details. */ | |
30 /* ------------------------------------------------------------------ */ | |
31 | 29 |
32 #if !defined(DECDOUBLE) | 30 #if !defined(DECDOUBLE) |
33 #define DECDOUBLE | 31 #define DECDOUBLE |
34 | 32 |
35 #define DECDOUBLENAME "decimalDouble" /* Short name */ | 33 #define DECDOUBLENAME "decimalDouble" /* Short name */ |
36 #define DECDOUBLETITLE "Decimal 64-bit datum" /* Verbose name */ | 34 #define DECDOUBLETITLE "Decimal 64-bit datum" /* Verbose name */ |
37 #define DECDOUBLEAUTHOR "Mike Cowlishaw" /* Who to blame */ | 35 #define DECDOUBLEAUTHOR "Mike Cowlishaw" /* Who to blame */ |
38 | 36 |
39 /* parameters for decDoubles */ | 37 /* parameters for decDoubles */ |
40 #define DECDOUBLE_Bytes 8 /* length */ | 38 #define DECDOUBLE_Bytes 8 /* length */ |
41 #define DECDOUBLE_Pmax 16 /* maximum precision (digits) */ | 39 #define DECDOUBLE_Pmax 16 /* maximum precision (digits) */ |
42 #define DECDOUBLE_Emin -383 /* minimum adjusted exponent */ | 40 #define DECDOUBLE_Emin -383 /* minimum adjusted exponent */ |
43 #define DECDOUBLE_Emax 384 /* maximum adjusted exponent */ | 41 #define DECDOUBLE_Emax 384 /* maximum adjusted exponent */ |
44 #define DECDOUBLE_EmaxD 3 /* maximum exponent digits */ | 42 #define DECDOUBLE_EmaxD 3 /* maximum exponent digits */ |
45 #define DECDOUBLE_Bias 398 /* bias for the exponent */ | 43 #define DECDOUBLE_Bias 398 /* bias for the exponent */ |
46 #define DECDOUBLE_String 25 /* maximum string length, +1 */ | 44 #define DECDOUBLE_String 25 /* maximum string length, +1 */ |
47 #define DECDOUBLE_EconL 8 /* exponent continuation length */ | 45 #define DECDOUBLE_EconL 8 /* exponent continuation length */ |
48 #define DECDOUBLE_Declets 5 /* count of declets */ | 46 #define DECDOUBLE_Declets 5 /* count of declets */ |
49 /* highest biased exponent (Elimit-1) */ | 47 /* highest biased exponent (Elimit-1) */ |
50 #define DECDOUBLE_Ehigh (DECDOUBLE_Emax + DECDOUBLE_Bias - (DECDOUBLE_Pmax-1)) | 48 #define DECDOUBLE_Ehigh (DECDOUBLE_Emax + DECDOUBLE_Bias - (DECDOUBLE_Pmax-1)) |
51 | 49 |
52 /* Required includes */ | 50 /* Required includes */ |
53 #include "decContext.h" | 51 #include "decContext.h" |
54 #include "decQuad.h" | 52 #include "decQuad.h" |
55 | 53 |
56 /* The decDouble decimal 64-bit type, accessible by various types */ | 54 /* The decDouble decimal 64-bit type, accessible by all sizes */ |
57 typedef union { | 55 typedef union { |
58 uint8_t bytes[DECDOUBLE_Bytes]; /* fields: 1, 5, 8, 50 bits */ | 56 uint8_t bytes[DECDOUBLE_Bytes]; /* fields: 1, 5, 8, 50 bits */ |
59 uint16_t shorts[DECDOUBLE_Bytes/2]; | 57 uint16_t shorts[DECDOUBLE_Bytes/2]; |
60 uint32_t words[DECDOUBLE_Bytes/4]; | 58 uint32_t words[DECDOUBLE_Bytes/4]; |
59 #if DECUSE64 | |
60 uint64_t longs[DECDOUBLE_Bytes/8]; | |
61 #endif | |
61 } decDouble; | 62 } decDouble; |
62 | 63 |
63 /* ---------------------------------------------------------------- */ | 64 /* ---------------------------------------------------------------- */ |
64 /* Routines -- implemented as decFloat routines in common files */ | 65 /* Routines -- implemented as decFloat routines in common files */ |
65 /* ---------------------------------------------------------------- */ | 66 /* ---------------------------------------------------------------- */ |
68 | 69 |
69 /* Utilities and conversions, extractors, etc.) */ | 70 /* Utilities and conversions, extractors, etc.) */ |
70 extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t); | 71 extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t); |
71 extern decDouble * decDoubleFromInt32(decDouble *, int32_t); | 72 extern decDouble * decDoubleFromInt32(decDouble *, int32_t); |
72 extern decDouble * decDoubleFromPacked(decDouble *, int32_t, const uint8_t *); | 73 extern decDouble * decDoubleFromPacked(decDouble *, int32_t, const uint8_t *); |
74 extern decDouble * decDoubleFromPackedChecked(decDouble *, int32_t, const uint8_t *); | |
73 extern decDouble * decDoubleFromString(decDouble *, const char *, decContext *); | 75 extern decDouble * decDoubleFromString(decDouble *, const char *, decContext *); |
74 extern decDouble * decDoubleFromUInt32(decDouble *, uint32_t); | 76 extern decDouble * decDoubleFromUInt32(decDouble *, uint32_t); |
75 extern decDouble * decDoubleFromWider(decDouble *, const decQuad *, decContext *); | 77 extern decDouble * decDoubleFromWider(decDouble *, const decQuad *, decContext *); |
76 extern int32_t decDoubleGetCoefficient(const decDouble *, uint8_t *); | 78 extern int32_t decDoubleGetCoefficient(const decDouble *, uint8_t *); |
77 extern int32_t decDoubleGetExponent(const decDouble *); | 79 extern int32_t decDoubleGetExponent(const decDouble *); |
153 extern uint32_t decDoubleSameQuantum(const decDouble *, const decDouble *); | 155 extern uint32_t decDoubleSameQuantum(const decDouble *, const decDouble *); |
154 extern const char * decDoubleVersion(void); | 156 extern const char * decDoubleVersion(void); |
155 | 157 |
156 /* decNumber conversions; these are implemented as macros so as not */ | 158 /* decNumber conversions; these are implemented as macros so as not */ |
157 /* to force a dependency on decimal64 and decNumber in decDouble. */ | 159 /* to force a dependency on decimal64 and decNumber in decDouble. */ |
160 /* decDoubleFromNumber returns a decimal64 * to avoid warnings. */ | |
158 #define decDoubleToNumber(dq, dn) decimal64ToNumber((decimal64 *)(dq), dn) | 161 #define decDoubleToNumber(dq, dn) decimal64ToNumber((decimal64 *)(dq), dn) |
159 #define decDoubleFromNumber(dq, dn, set) (decDouble *)decimal64FromNumber((decimal64 *)(dq), dn, set) | 162 #define decDoubleFromNumber(dq, dn, set) decimal64FromNumber((decimal64 *)(dq), dn, set) |
160 | 163 |
161 #endif | 164 #endif |