Mercurial > hg > CbC > CbC_gcc
annotate libdecnumber/dpd/decimal64.h @ 143:76e1cf5455ef
add cbc_gc test
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 23 Dec 2018 19:24:05 +0900 |
parents | 84e7813d76e9 |
children | 1830386684a0 |
rev | line source |
---|---|
0 | 1 /* Decimal 64-bit format module header for the decNumber C Library. |
131 | 2 Copyright (C) 2005-2018 Free Software Foundation, Inc. |
0 | 3 Contributed by IBM Corporation. Author Mike Cowlishaw. |
4 | |
5 This file is part of GCC. | |
6 | |
7 GCC is free software; you can redistribute it and/or modify it under | |
8 the terms of the GNU General Public License as published by the Free | |
9 Software Foundation; either version 3, or (at your option) any later | |
10 version. | |
11 | |
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 Under Section 7 of GPL version 3, you are granted additional | |
18 permissions described in the GCC Runtime Library Exception, version | |
19 3.1, as published by the Free Software Foundation. | |
20 | |
21 You should have received a copy of the GNU General Public License and | |
22 a copy of the GCC Runtime Library Exception along with this program; | |
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
24 <http://www.gnu.org/licenses/>. */ | |
25 | |
26 /* ------------------------------------------------------------------ */ | |
27 /* Decimal 64-bit format module header */ | |
28 /* ------------------------------------------------------------------ */ | |
29 | |
30 #if !defined(DECIMAL64) | |
31 #define DECIMAL64 | |
32 #define DEC64NAME "decimal64" /* Short name */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 #define DEC64FULLNAME "Decimal 64-bit Number" /* Verbose name */ |
0 | 34 #define DEC64AUTHOR "Mike Cowlishaw" /* Who to blame */ |
35 | |
36 | |
37 /* parameters for decimal64s */ | |
38 #define DECIMAL64_Bytes 8 /* length */ | |
39 #define DECIMAL64_Pmax 16 /* maximum precision (digits) */ | |
40 #define DECIMAL64_Emax 384 /* maximum adjusted exponent */ | |
41 #define DECIMAL64_Emin -383 /* minimum adjusted exponent */ | |
42 #define DECIMAL64_Bias 398 /* bias for the exponent */ | |
43 #define DECIMAL64_String 24 /* maximum string length, +1 */ | |
44 #define DECIMAL64_EconL 8 /* exp. continuation length */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
45 /* highest biased exponent (Elimit-1) */ |
0 | 46 #define DECIMAL64_Ehigh (DECIMAL64_Emax+DECIMAL64_Bias-DECIMAL64_Pmax+1) |
47 | |
48 /* check enough digits, if pre-defined */ | |
49 #if defined(DECNUMDIGITS) | |
50 #if (DECNUMDIGITS<DECIMAL64_Pmax) | |
51 #error decimal64.h needs pre-defined DECNUMDIGITS>=16 for safe use | |
52 #endif | |
53 #endif | |
54 | |
55 | |
56 #ifndef DECNUMDIGITS | |
57 #define DECNUMDIGITS DECIMAL64_Pmax /* size if not already defined*/ | |
58 #endif | |
59 #ifndef DECNUMBER | |
60 #include "decNumber.h" /* context and number library */ | |
61 #endif | |
62 | |
63 /* Decimal 64-bit type, accessible by bytes */ | |
64 typedef struct { | |
65 uint8_t bytes[DECIMAL64_Bytes]; /* decimal64: 1, 5, 8, 50 bits*/ | |
66 } decimal64; | |
67 | |
68 /* special values [top byte excluding sign bit; last two bits are */ | |
69 /* don't-care for Infinity on input, last bit don't-care for NaN] */ | |
70 #if !defined(DECIMAL_NaN) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
71 #define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */ |
0 | 72 #define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
73 #define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */ |
0 | 74 #endif |
75 | |
76 /* ---------------------------------------------------------------- */ | |
77 /* Routines */ | |
78 /* ---------------------------------------------------------------- */ | |
79 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
80 #include "decimal64Symbols.h" |
0 | 81 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
82 #ifdef __cplusplus |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
83 extern "C" { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
84 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
85 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
86 /* String conversions */ |
0 | 87 decimal64 * decimal64FromString(decimal64 *, const char *, decContext *); |
88 char * decimal64ToString(const decimal64 *, char *); | |
89 char * decimal64ToEngString(const decimal64 *, char *); | |
90 | |
91 /* decNumber conversions */ | |
92 decimal64 * decimal64FromNumber(decimal64 *, const decNumber *, | |
93 decContext *); | |
94 decNumber * decimal64ToNumber(const decimal64 *, decNumber *); | |
95 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
96 /* Format-dependent utilities */ |
0 | 97 uint32_t decimal64IsCanonical(const decimal64 *); |
98 decimal64 * decimal64Canonical(decimal64 *, const decimal64 *); | |
99 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
100 #ifdef __cplusplus |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
101 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
102 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
103 |
0 | 104 #endif |