1 |
271 |
jeremybenn |
/* decDouble module for the decNumber C Library.
|
2 |
|
|
Copyright (C) 2007, 2009 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 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 |
|
|
/* decDouble.c -- decDouble operations module */
|
28 |
|
|
/* ------------------------------------------------------------------ */
|
29 |
|
|
/* This module comprises decDouble operations (including conversions) */
|
30 |
|
|
/* ------------------------------------------------------------------ */
|
31 |
|
|
|
32 |
|
|
#include "decContext.h" /* public includes */
|
33 |
|
|
#include "decDouble.h" /* .. */
|
34 |
|
|
|
35 |
|
|
/* Constant mappings for shared code */
|
36 |
|
|
#define DECPMAX DECDOUBLE_Pmax
|
37 |
|
|
#define DECEMIN DECDOUBLE_Emin
|
38 |
|
|
#define DECEMAX DECDOUBLE_Emax
|
39 |
|
|
#define DECEMAXD DECDOUBLE_EmaxD
|
40 |
|
|
#define DECBYTES DECDOUBLE_Bytes
|
41 |
|
|
#define DECSTRING DECDOUBLE_String
|
42 |
|
|
#define DECECONL DECDOUBLE_EconL
|
43 |
|
|
#define DECBIAS DECDOUBLE_Bias
|
44 |
|
|
#define DECLETS DECDOUBLE_Declets
|
45 |
|
|
#define DECQTINY (-DECDOUBLE_Bias)
|
46 |
|
|
/* parameters of next-wider format */
|
47 |
|
|
#define DECWBYTES DECQUAD_Bytes
|
48 |
|
|
#define DECWPMAX DECQUAD_Pmax
|
49 |
|
|
#define DECWECONL DECQUAD_EconL
|
50 |
|
|
#define DECWBIAS DECQUAD_Bias
|
51 |
|
|
|
52 |
|
|
/* Type and function mappings for shared code */
|
53 |
|
|
#define decFloat decDouble /* Type name */
|
54 |
|
|
#define decFloatWider decQuad /* Type name */
|
55 |
|
|
|
56 |
|
|
/* Utilities and conversions (binary results, extractors, etc.) */
|
57 |
|
|
#define decFloatFromBCD decDoubleFromBCD
|
58 |
|
|
#define decFloatFromInt32 decDoubleFromInt32
|
59 |
|
|
#define decFloatFromPacked decDoubleFromPacked
|
60 |
|
|
#define decFloatFromPackedChecked decDoubleFromPackedChecked
|
61 |
|
|
#define decFloatFromString decDoubleFromString
|
62 |
|
|
#define decFloatFromUInt32 decDoubleFromUInt32
|
63 |
|
|
#define decFloatFromWider decDoubleFromWider
|
64 |
|
|
#define decFloatGetCoefficient decDoubleGetCoefficient
|
65 |
|
|
#define decFloatGetExponent decDoubleGetExponent
|
66 |
|
|
#define decFloatSetCoefficient decDoubleSetCoefficient
|
67 |
|
|
#define decFloatSetExponent decDoubleSetExponent
|
68 |
|
|
#define decFloatShow decDoubleShow
|
69 |
|
|
#define decFloatToBCD decDoubleToBCD
|
70 |
|
|
#define decFloatToEngString decDoubleToEngString
|
71 |
|
|
#define decFloatToInt32 decDoubleToInt32
|
72 |
|
|
#define decFloatToInt32Exact decDoubleToInt32Exact
|
73 |
|
|
#define decFloatToPacked decDoubleToPacked
|
74 |
|
|
#define decFloatToString decDoubleToString
|
75 |
|
|
#define decFloatToUInt32 decDoubleToUInt32
|
76 |
|
|
#define decFloatToUInt32Exact decDoubleToUInt32Exact
|
77 |
|
|
#define decFloatToWider decDoubleToWider
|
78 |
|
|
#define decFloatZero decDoubleZero
|
79 |
|
|
|
80 |
|
|
/* Computational (result is a decFloat) */
|
81 |
|
|
#define decFloatAbs decDoubleAbs
|
82 |
|
|
#define decFloatAdd decDoubleAdd
|
83 |
|
|
#define decFloatAnd decDoubleAnd
|
84 |
|
|
#define decFloatDivide decDoubleDivide
|
85 |
|
|
#define decFloatDivideInteger decDoubleDivideInteger
|
86 |
|
|
#define decFloatFMA decDoubleFMA
|
87 |
|
|
#define decFloatInvert decDoubleInvert
|
88 |
|
|
#define decFloatLogB decDoubleLogB
|
89 |
|
|
#define decFloatMax decDoubleMax
|
90 |
|
|
#define decFloatMaxMag decDoubleMaxMag
|
91 |
|
|
#define decFloatMin decDoubleMin
|
92 |
|
|
#define decFloatMinMag decDoubleMinMag
|
93 |
|
|
#define decFloatMinus decDoubleMinus
|
94 |
|
|
#define decFloatMultiply decDoubleMultiply
|
95 |
|
|
#define decFloatNextMinus decDoubleNextMinus
|
96 |
|
|
#define decFloatNextPlus decDoubleNextPlus
|
97 |
|
|
#define decFloatNextToward decDoubleNextToward
|
98 |
|
|
#define decFloatOr decDoubleOr
|
99 |
|
|
#define decFloatPlus decDoublePlus
|
100 |
|
|
#define decFloatQuantize decDoubleQuantize
|
101 |
|
|
#define decFloatReduce decDoubleReduce
|
102 |
|
|
#define decFloatRemainder decDoubleRemainder
|
103 |
|
|
#define decFloatRemainderNear decDoubleRemainderNear
|
104 |
|
|
#define decFloatRotate decDoubleRotate
|
105 |
|
|
#define decFloatScaleB decDoubleScaleB
|
106 |
|
|
#define decFloatShift decDoubleShift
|
107 |
|
|
#define decFloatSubtract decDoubleSubtract
|
108 |
|
|
#define decFloatToIntegralValue decDoubleToIntegralValue
|
109 |
|
|
#define decFloatToIntegralExact decDoubleToIntegralExact
|
110 |
|
|
#define decFloatXor decDoubleXor
|
111 |
|
|
|
112 |
|
|
/* Comparisons */
|
113 |
|
|
#define decFloatCompare decDoubleCompare
|
114 |
|
|
#define decFloatCompareSignal decDoubleCompareSignal
|
115 |
|
|
#define decFloatCompareTotal decDoubleCompareTotal
|
116 |
|
|
#define decFloatCompareTotalMag decDoubleCompareTotalMag
|
117 |
|
|
|
118 |
|
|
/* Copies */
|
119 |
|
|
#define decFloatCanonical decDoubleCanonical
|
120 |
|
|
#define decFloatCopy decDoubleCopy
|
121 |
|
|
#define decFloatCopyAbs decDoubleCopyAbs
|
122 |
|
|
#define decFloatCopyNegate decDoubleCopyNegate
|
123 |
|
|
#define decFloatCopySign decDoubleCopySign
|
124 |
|
|
|
125 |
|
|
/* Non-computational */
|
126 |
|
|
#define decFloatClass decDoubleClass
|
127 |
|
|
#define decFloatClassString decDoubleClassString
|
128 |
|
|
#define decFloatDigits decDoubleDigits
|
129 |
|
|
#define decFloatIsCanonical decDoubleIsCanonical
|
130 |
|
|
#define decFloatIsFinite decDoubleIsFinite
|
131 |
|
|
#define decFloatIsInfinite decDoubleIsInfinite
|
132 |
|
|
#define decFloatIsInteger decDoubleIsInteger
|
133 |
|
|
#define decFloatIsNaN decDoubleIsNaN
|
134 |
|
|
#define decFloatIsNormal decDoubleIsNormal
|
135 |
|
|
#define decFloatIsSignaling decDoubleIsSignaling
|
136 |
|
|
#define decFloatIsSignalling decDoubleIsSignalling
|
137 |
|
|
#define decFloatIsSigned decDoubleIsSigned
|
138 |
|
|
#define decFloatIsSubnormal decDoubleIsSubnormal
|
139 |
|
|
#define decFloatIsZero decDoubleIsZero
|
140 |
|
|
#define decFloatRadix decDoubleRadix
|
141 |
|
|
#define decFloatSameQuantum decDoubleSameQuantum
|
142 |
|
|
#define decFloatVersion decDoubleVersion
|
143 |
|
|
|
144 |
|
|
#include "decNumberLocal.h" /* local includes (need DECPMAX) */
|
145 |
|
|
#include "decCommon.c" /* non-arithmetic decFloat routines */
|
146 |
|
|
#include "decBasic.c" /* basic formats routines */
|
147 |
|
|
|