OSDN Git Service

030cc2b86cd00a87a652b92b2c8f23c1a2629f0b
[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 decFloatFromPackedChecked  decDoubleFromPackedChecked
66 #define decFloatFromString         decDoubleFromString
67 #define decFloatFromUInt32         decDoubleFromUInt32
68 #define decFloatFromWider          decDoubleFromWider
69 #define decFloatGetCoefficient     decDoubleGetCoefficient
70 #define decFloatGetExponent        decDoubleGetExponent
71 #define decFloatSetCoefficient     decDoubleSetCoefficient
72 #define decFloatSetExponent        decDoubleSetExponent
73 #define decFloatShow               decDoubleShow
74 #define decFloatToBCD              decDoubleToBCD
75 #define decFloatToEngString        decDoubleToEngString
76 #define decFloatToInt32            decDoubleToInt32
77 #define decFloatToInt32Exact       decDoubleToInt32Exact
78 #define decFloatToPacked           decDoubleToPacked
79 #define decFloatToString           decDoubleToString
80 #define decFloatToUInt32           decDoubleToUInt32
81 #define decFloatToUInt32Exact      decDoubleToUInt32Exact
82 #define decFloatToWider            decDoubleToWider
83 #define decFloatZero               decDoubleZero
84
85 /* Computational (result is a decFloat) */
86 #define decFloatAbs                decDoubleAbs
87 #define decFloatAdd                decDoubleAdd
88 #define decFloatAnd                decDoubleAnd
89 #define decFloatDivide             decDoubleDivide
90 #define decFloatDivideInteger      decDoubleDivideInteger
91 #define decFloatFMA                decDoubleFMA
92 #define decFloatInvert             decDoubleInvert
93 #define decFloatLogB               decDoubleLogB
94 #define decFloatMax                decDoubleMax
95 #define decFloatMaxMag             decDoubleMaxMag
96 #define decFloatMin                decDoubleMin
97 #define decFloatMinMag             decDoubleMinMag
98 #define decFloatMinus              decDoubleMinus
99 #define decFloatMultiply           decDoubleMultiply
100 #define decFloatNextMinus          decDoubleNextMinus
101 #define decFloatNextPlus           decDoubleNextPlus
102 #define decFloatNextToward         decDoubleNextToward
103 #define decFloatOr                 decDoubleOr
104 #define decFloatPlus               decDoublePlus
105 #define decFloatQuantize           decDoubleQuantize
106 #define decFloatReduce             decDoubleReduce
107 #define decFloatRemainder          decDoubleRemainder
108 #define decFloatRemainderNear      decDoubleRemainderNear
109 #define decFloatRotate             decDoubleRotate
110 #define decFloatScaleB             decDoubleScaleB
111 #define decFloatShift              decDoubleShift
112 #define decFloatSubtract           decDoubleSubtract
113 #define decFloatToIntegralValue    decDoubleToIntegralValue
114 #define decFloatToIntegralExact    decDoubleToIntegralExact
115 #define decFloatXor                decDoubleXor
116
117 /* Comparisons */
118 #define decFloatCompare            decDoubleCompare
119 #define decFloatCompareSignal      decDoubleCompareSignal
120 #define decFloatCompareTotal       decDoubleCompareTotal
121 #define decFloatCompareTotalMag    decDoubleCompareTotalMag
122
123 /* Copies */
124 #define decFloatCanonical          decDoubleCanonical
125 #define decFloatCopy               decDoubleCopy
126 #define decFloatCopyAbs            decDoubleCopyAbs
127 #define decFloatCopyNegate         decDoubleCopyNegate
128 #define decFloatCopySign           decDoubleCopySign
129
130 /* Non-computational */
131 #define decFloatClass              decDoubleClass
132 #define decFloatClassString        decDoubleClassString
133 #define decFloatDigits             decDoubleDigits
134 #define decFloatIsCanonical        decDoubleIsCanonical
135 #define decFloatIsFinite           decDoubleIsFinite
136 #define decFloatIsInfinite         decDoubleIsInfinite
137 #define decFloatIsInteger          decDoubleIsInteger
138 #define decFloatIsNaN              decDoubleIsNaN
139 #define decFloatIsNormal           decDoubleIsNormal
140 #define decFloatIsSignaling        decDoubleIsSignaling
141 #define decFloatIsSignalling       decDoubleIsSignalling
142 #define decFloatIsSigned           decDoubleIsSigned
143 #define decFloatIsSubnormal        decDoubleIsSubnormal
144 #define decFloatIsZero             decDoubleIsZero
145 #define decFloatRadix              decDoubleRadix
146 #define decFloatSameQuantum        decDoubleSameQuantum
147 #define decFloatVersion            decDoubleVersion
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