1 |
24 |
jeremybenn |
/* decQuad 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 |
|
|
/* decQuad.c -- decQuad operations module */
|
33 |
|
|
/* ------------------------------------------------------------------ */
|
34 |
|
|
/* This module comprises decQuad operations (including conversions) */
|
35 |
|
|
/* ------------------------------------------------------------------ */
|
36 |
|
|
|
37 |
|
|
#include "decContext.h" /* public includes */
|
38 |
|
|
#include "decQuad.h" /* .. */
|
39 |
|
|
|
40 |
|
|
/* Constant mappings for shared code */
|
41 |
|
|
#define DECPMAX DECQUAD_Pmax
|
42 |
|
|
#define DECEMIN DECQUAD_Emin
|
43 |
|
|
#define DECEMAX DECQUAD_Emax
|
44 |
|
|
#define DECEMAXD DECQUAD_EmaxD
|
45 |
|
|
#define DECBYTES DECQUAD_Bytes
|
46 |
|
|
#define DECSTRING DECQUAD_String
|
47 |
|
|
#define DECECONL DECQUAD_EconL
|
48 |
|
|
#define DECBIAS DECQUAD_Bias
|
49 |
|
|
#define DECLETS DECQUAD_Declets
|
50 |
|
|
#define DECQTINY (-DECQUAD_Bias)
|
51 |
|
|
|
52 |
|
|
/* Type and function mappings for shared code */
|
53 |
|
|
#define decFloat decQuad /* Type name */
|
54 |
|
|
|
55 |
|
|
/* Utilities and conversions (binary results, extractors, etc.) */
|
56 |
|
|
#define decFloatFromBCD decQuadFromBCD
|
57 |
|
|
#define decFloatFromInt32 decQuadFromInt32
|
58 |
|
|
#define decFloatFromPacked decQuadFromPacked
|
59 |
|
|
#define decFloatFromString decQuadFromString
|
60 |
|
|
#define decFloatFromUInt32 decQuadFromUInt32
|
61 |
|
|
#define decFloatFromWider decQuadFromWider
|
62 |
|
|
#define decFloatGetCoefficient decQuadGetCoefficient
|
63 |
|
|
#define decFloatGetExponent decQuadGetExponent
|
64 |
|
|
#define decFloatSetCoefficient decQuadSetCoefficient
|
65 |
|
|
#define decFloatSetExponent decQuadSetExponent
|
66 |
|
|
#define decFloatShow decQuadShow
|
67 |
|
|
#define decFloatToBCD decQuadToBCD
|
68 |
|
|
#define decFloatToEngString decQuadToEngString
|
69 |
|
|
#define decFloatToInt32 decQuadToInt32
|
70 |
|
|
#define decFloatToInt32Exact decQuadToInt32Exact
|
71 |
|
|
#define decFloatToPacked decQuadToPacked
|
72 |
|
|
#define decFloatToString decQuadToString
|
73 |
|
|
#define decFloatToUInt32 decQuadToUInt32
|
74 |
|
|
#define decFloatToUInt32Exact decQuadToUInt32Exact
|
75 |
|
|
#define decFloatToWider decQuadToWider
|
76 |
|
|
#define decFloatZero decQuadZero
|
77 |
|
|
|
78 |
|
|
/* Computational (result is a decFloat) */
|
79 |
|
|
#define decFloatAbs decQuadAbs
|
80 |
|
|
#define decFloatAdd decQuadAdd
|
81 |
|
|
#define decFloatAnd decQuadAnd
|
82 |
|
|
#define decFloatDivide decQuadDivide
|
83 |
|
|
#define decFloatDivideInteger decQuadDivideInteger
|
84 |
|
|
#define decFloatFMA decQuadFMA
|
85 |
|
|
#define decFloatInvert decQuadInvert
|
86 |
|
|
#define decFloatLogB decQuadLogB
|
87 |
|
|
#define decFloatMax decQuadMax
|
88 |
|
|
#define decFloatMaxMag decQuadMaxMag
|
89 |
|
|
#define decFloatMin decQuadMin
|
90 |
|
|
#define decFloatMinMag decQuadMinMag
|
91 |
|
|
#define decFloatMinus decQuadMinus
|
92 |
|
|
#define decFloatMultiply decQuadMultiply
|
93 |
|
|
#define decFloatNextMinus decQuadNextMinus
|
94 |
|
|
#define decFloatNextPlus decQuadNextPlus
|
95 |
|
|
#define decFloatNextToward decQuadNextToward
|
96 |
|
|
#define decFloatOr decQuadOr
|
97 |
|
|
#define decFloatPlus decQuadPlus
|
98 |
|
|
#define decFloatQuantize decQuadQuantize
|
99 |
|
|
#define decFloatReduce decQuadReduce
|
100 |
|
|
#define decFloatRemainder decQuadRemainder
|
101 |
|
|
#define decFloatRemainderNear decQuadRemainderNear
|
102 |
|
|
#define decFloatRotate decQuadRotate
|
103 |
|
|
#define decFloatScaleB decQuadScaleB
|
104 |
|
|
#define decFloatShift decQuadShift
|
105 |
|
|
#define decFloatSubtract decQuadSubtract
|
106 |
|
|
#define decFloatToIntegralValue decQuadToIntegralValue
|
107 |
|
|
#define decFloatToIntegralExact decQuadToIntegralExact
|
108 |
|
|
#define decFloatXor decQuadXor
|
109 |
|
|
|
110 |
|
|
/* Comparisons */
|
111 |
|
|
#define decFloatCompare decQuadCompare
|
112 |
|
|
#define decFloatCompareSignal decQuadCompareSignal
|
113 |
|
|
#define decFloatCompareTotal decQuadCompareTotal
|
114 |
|
|
#define decFloatCompareTotalMag decQuadCompareTotalMag
|
115 |
|
|
|
116 |
|
|
/* Copies */
|
117 |
|
|
#define decFloatCanonical decQuadCanonical
|
118 |
|
|
#define decFloatCopy decQuadCopy
|
119 |
|
|
#define decFloatCopyAbs decQuadCopyAbs
|
120 |
|
|
#define decFloatCopyNegate decQuadCopyNegate
|
121 |
|
|
#define decFloatCopySign decQuadCopySign
|
122 |
|
|
|
123 |
|
|
/* Non-computational */
|
124 |
|
|
#define decFloatClass decQuadClass
|
125 |
|
|
#define decFloatClassString decQuadClassString
|
126 |
|
|
#define decFloatDigits decQuadDigits
|
127 |
|
|
#define decFloatIsCanonical decQuadIsCanonical
|
128 |
|
|
#define decFloatIsFinite decQuadIsFinite
|
129 |
|
|
#define decFloatIsInfinite decQuadIsInfinite
|
130 |
|
|
#define decFloatIsInteger decQuadIsInteger
|
131 |
|
|
#define decFloatIsNaN decQuadIsNaN
|
132 |
|
|
#define decFloatIsNormal decQuadIsNormal
|
133 |
|
|
#define decFloatIsSignaling decQuadIsSignaling
|
134 |
|
|
#define decFloatIsSignalling decQuadIsSignalling
|
135 |
|
|
#define decFloatIsSigned decQuadIsSigned
|
136 |
|
|
#define decFloatIsSubnormal decQuadIsSubnormal
|
137 |
|
|
#define decFloatIsZero decQuadIsZero
|
138 |
|
|
#define decFloatRadix decQuadRadix
|
139 |
|
|
#define decFloatSameQuantum decQuadSameQuantum
|
140 |
|
|
#define decFloatVersion decQuadVersion
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
#include "decNumberLocal.h" /* local includes (need DECPMAX) */
|
144 |
|
|
#include "decCommon.c" /* non-arithmetic decFloat routines */
|
145 |
|
|
#include "decBasic.c" /* basic formats routines */
|
146 |
|
|
|