1 /* Decimal 64-bit format module header for the decNumber C Library.
2 Copyright (C) 2005-2013 Free Software Foundation, Inc.
3 Contributed by IBM Corporation. Author Mike Cowlishaw.
5 This file is part of GCC.
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
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
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.
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/>. */
26 /* ------------------------------------------------------------------ */
27 /* Decimal 64-bit format module header */
28 /* ------------------------------------------------------------------ */
30 #if !defined(DECIMAL64)
32 #define DEC64NAME "decimal64" /* Short name */
33 #define DEC64FULLNAME "Decimal 64-bit Number" /* Verbose name */
34 #define DEC64AUTHOR "Mike Cowlishaw" /* Who to blame */
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 */
45 /* highest biased exponent (Elimit-1) */
46 #define DECIMAL64_Ehigh (DECIMAL64_Emax+DECIMAL64_Bias-DECIMAL64_Pmax+1)
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
57 #define DECNUMDIGITS DECIMAL64_Pmax /* size if not already defined*/
60 #include "decNumber.h" /* context and number library */
63 /* Decimal 64-bit type, accessible by bytes */
65 uint8_t bytes
[DECIMAL64_Bytes
]; /* decimal64: 1, 5, 8, 50 bits*/
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)
71 #define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */
72 #define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */
73 #define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */
76 /* ---------------------------------------------------------------- */
78 /* ---------------------------------------------------------------- */
80 #include "decimal64Symbols.h"
86 /* String conversions */
87 decimal64
* decimal64FromString(decimal64
*, const char *, decContext
*);
88 char * decimal64ToString(const decimal64
*, char *);
89 char * decimal64ToEngString(const decimal64
*, char *);
91 /* decNumber conversions */
92 decimal64
* decimal64FromNumber(decimal64
*, const decNumber
*,
94 decNumber
* decimal64ToNumber(const decimal64
*, decNumber
*);
96 /* Format-dependent utilities */
97 uint32_t decimal64IsCanonical(const decimal64
*);
98 decimal64
* decimal64Canonical(decimal64
*, const decimal64
*);
This page took 0.030749 seconds and 4 git commands to generate.