OSDN Git Service

PR other/37897
[pf3gnuchains/gcc-fork.git] / libdecnumber / decDouble.c
1 /* decDouble module for the decNumber C Library.
2    Copyright (C) 2007 Free Software Foundation, Inc.
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 2, or (at your option) any later
10    version.
11
12    In addition to the permissions in the GNU General Public License,
13    the Free Software Foundation gives you unlimited permission to link
14    the compiled version of this file into combinations with other
15    programs, and to distribute those combinations without any
16    restriction coming from the use of this file.  (The General Public
17    License restrictions do apply in other respects; for example, they
18    cover modification of the file, and distribution when not linked
19    into a combine executable.)
20
21    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
22    WARRANTY; without even the implied warranty of MERCHANTABILITY or
23    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24    for more details.
25
26    You should have received a copy of the GNU General Public License
27    along with GCC; see the file COPYING.  If not, write to the Free
28    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
29    02110-1301, USA.  */
30
31 /* ------------------------------------------------------------------ */
32 /* decDouble.c -- decDouble operations module                         */
33 /* ------------------------------------------------------------------ */
34 /* This module comprises decDouble operations (including conversions) */
35 /* ------------------------------------------------------------------ */
36
37 #include "decContext.h"       /* public includes */
38 #include "decDouble.h"        /* .. */
39
40 /* Constant mappings for shared code */
41 #define DECPMAX     DECDOUBLE_Pmax
42 #define DECEMIN     DECDOUBLE_Emin
43 #define DECEMAX     DECDOUBLE_Emax
44 #define DECEMAXD    DECDOUBLE_EmaxD
45 #define DECBYTES    DECDOUBLE_Bytes
46 #define DECSTRING   DECDOUBLE_String
47 #define DECECONL    DECDOUBLE_EconL
48 #define DECBIAS     DECDOUBLE_Bias
49 #define DECLETS     DECDOUBLE_Declets
50 #define DECQTINY    (-DECDOUBLE_Bias)
51 /* parameters of next-wider format */
52 #define DECWBYTES   DECQUAD_Bytes
53 #define DECWPMAX    DECQUAD_Pmax
54 #define DECWECONL   DECQUAD_EconL
55 #define DECWBIAS    DECQUAD_Bias
56
57 /* Type and function mappings for shared code */
58 #define decFloat               decDouble          /* Type name */
59 #define decFloatWider          decQuad            /* Type name */
60
61 /* Utilities and conversions (binary results, extractors, etc.) */
62 #define decFloatFromBCD         decDoubleFromBCD
63 #define decFloatFromInt32       decDoubleFromInt32
64 #define decFloatFromPacked      decDoubleFromPacked
65 #define decFloatFromString      decDoubleFromString
66 #define decFloatFromUInt32      decDoubleFromUInt32
67 #define decFloatFromWider       decDoubleFromWider
68 #define decFloatGetCoefficient  decDoubleGetCoefficient
69 #define decFloatGetExponent     decDoubleGetExponent
70 #define decFloatSetCoefficient  decDoubleSetCoefficient
71 #define decFloatSetExponent     decDoubleSetExponent
72 #define decFloatShow            decDoubleShow
73 #define decFloatToBCD           decDoubleToBCD
74 #define decFloatToEngString     decDoubleToEngString
75 #define decFloatToInt32         decDoubleToInt32
76 #define decFloatToInt32Exact    decDoubleToInt32Exact
77 #define decFloatToPacked        decDoubleToPacked
78 #define decFloatToString        decDoubleToString
79 #define decFloatToUInt32        decDoubleToUInt32
80 #define decFloatToUInt32Exact   decDoubleToUInt32Exact
81 #define decFloatToWider         decDoubleToWider
82 #define decFloatZero            decDoubleZero
83
84 /* Computational (result is a decFloat) */
85 #define decFloatAbs             decDoubleAbs
86 #define decFloatAdd             decDoubleAdd
87 #define decFloatAnd             decDoubleAnd
88 #define decFloatDivide          decDoubleDivide
89 #define decFloatDivideInteger   decDoubleDivideInteger
90 #define decFloatFMA             decDoubleFMA
91 #define decFloatInvert          decDoubleInvert
92 #define decFloatLogB            decDoubleLogB
93 #define decFloatMax             decDoubleMax
94 #define decFloatMaxMag          decDoubleMaxMag
95 #define decFloatMin             decDoubleMin
96 #define decFloatMinMag          decDoubleMinMag
97 #define decFloatMinus           decDoubleMinus
98 #define decFloatMultiply        decDoubleMultiply
99 #define decFloatNextMinus       decDoubleNextMinus
100 #define decFloatNextPlus        decDoubleNextPlus
101 #define decFloatNextToward      decDoubleNextToward
102 #define decFloatOr              decDoubleOr
103 #define decFloatPlus            decDoublePlus
104 #define decFloatQuantize        decDoubleQuantize
105 #define decFloatReduce          decDoubleReduce
106 #define decFloatRemainder       decDoubleRemainder
107 #define decFloatRemainderNear   decDoubleRemainderNear
108 #define decFloatRotate          decDoubleRotate
109 #define decFloatScaleB          decDoubleScaleB
110 #define decFloatShift           decDoubleShift
111 #define decFloatSubtract        decDoubleSubtract
112 #define decFloatToIntegralValue decDoubleToIntegralValue
113 #define decFloatToIntegralExact decDoubleToIntegralExact
114 #define decFloatXor             decDoubleXor
115
116 /* Comparisons */
117 #define decFloatCompare         decDoubleCompare
118 #define decFloatCompareSignal   decDoubleCompareSignal
119 #define decFloatCompareTotal    decDoubleCompareTotal
120 #define decFloatCompareTotalMag decDoubleCompareTotalMag
121
122 /* Copies */
123 #define decFloatCanonical       decDoubleCanonical
124 #define decFloatCopy            decDoubleCopy
125 #define decFloatCopyAbs         decDoubleCopyAbs
126 #define decFloatCopyNegate      decDoubleCopyNegate
127 #define decFloatCopySign        decDoubleCopySign
128
129 /* Non-computational */
130 #define decFloatClass           decDoubleClass
131 #define decFloatClassString     decDoubleClassString
132 #define decFloatDigits          decDoubleDigits
133 #define decFloatIsCanonical     decDoubleIsCanonical
134 #define decFloatIsFinite        decDoubleIsFinite
135 #define decFloatIsInfinite      decDoubleIsInfinite
136 #define decFloatIsInteger       decDoubleIsInteger
137 #define decFloatIsNaN           decDoubleIsNaN
138 #define decFloatIsNormal        decDoubleIsNormal
139 #define decFloatIsSignaling     decDoubleIsSignaling
140 #define decFloatIsSignalling    decDoubleIsSignalling
141 #define decFloatIsSigned        decDoubleIsSigned
142 #define decFloatIsSubnormal     decDoubleIsSubnormal
143 #define decFloatIsZero          decDoubleIsZero
144 #define decFloatRadix           decDoubleRadix
145 #define decFloatSameQuantum     decDoubleSameQuantum
146 #define decFloatVersion         decDoubleVersion
147
148
149 #include "decNumberLocal.h"   /* local includes (need DECPMAX) */
150 #include "decCommon.c"        /* non-arithmetic decFloat routines */
151 #include "decBasic.c"         /* basic formats routines */
152
153 /* Below here will move to shared file as completed */
154