OSDN Git Service

* decNumber.c, decNumber.h, decNumberLocal.h, decDouble.c,
[pf3gnuchains/gcc-fork.git] / libdecnumber / decQuad.c
1 /* 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 decFloatFromPackedChecked  decQuadFromPackedChecked
60 #define decFloatFromString         decQuadFromString
61 #define decFloatFromUInt32         decQuadFromUInt32
62 #define decFloatFromWider          decQuadFromWider
63 #define decFloatGetCoefficient     decQuadGetCoefficient
64 #define decFloatGetExponent        decQuadGetExponent
65 #define decFloatSetCoefficient     decQuadSetCoefficient
66 #define decFloatSetExponent        decQuadSetExponent
67 #define decFloatShow               decQuadShow
68 #define decFloatToBCD              decQuadToBCD
69 #define decFloatToEngString        decQuadToEngString
70 #define decFloatToInt32            decQuadToInt32
71 #define decFloatToInt32Exact       decQuadToInt32Exact
72 #define decFloatToPacked           decQuadToPacked
73 #define decFloatToString           decQuadToString
74 #define decFloatToUInt32           decQuadToUInt32
75 #define decFloatToUInt32Exact      decQuadToUInt32Exact
76 #define decFloatToWider            decQuadToWider
77 #define decFloatZero               decQuadZero
78
79 /* Computational (result is a decFloat) */
80 #define decFloatAbs                decQuadAbs
81 #define decFloatAdd                decQuadAdd
82 #define decFloatAnd                decQuadAnd
83 #define decFloatDivide             decQuadDivide
84 #define decFloatDivideInteger      decQuadDivideInteger
85 #define decFloatFMA                decQuadFMA
86 #define decFloatInvert             decQuadInvert
87 #define decFloatLogB               decQuadLogB
88 #define decFloatMax                decQuadMax
89 #define decFloatMaxMag             decQuadMaxMag
90 #define decFloatMin                decQuadMin
91 #define decFloatMinMag             decQuadMinMag
92 #define decFloatMinus              decQuadMinus
93 #define decFloatMultiply           decQuadMultiply
94 #define decFloatNextMinus          decQuadNextMinus
95 #define decFloatNextPlus           decQuadNextPlus
96 #define decFloatNextToward         decQuadNextToward
97 #define decFloatOr                 decQuadOr
98 #define decFloatPlus               decQuadPlus
99 #define decFloatQuantize           decQuadQuantize
100 #define decFloatReduce             decQuadReduce
101 #define decFloatRemainder          decQuadRemainder
102 #define decFloatRemainderNear      decQuadRemainderNear
103 #define decFloatRotate             decQuadRotate
104 #define decFloatScaleB             decQuadScaleB
105 #define decFloatShift              decQuadShift
106 #define decFloatSubtract           decQuadSubtract
107 #define decFloatToIntegralValue    decQuadToIntegralValue
108 #define decFloatToIntegralExact    decQuadToIntegralExact
109 #define decFloatXor                decQuadXor
110
111 /* Comparisons */
112 #define decFloatCompare            decQuadCompare
113 #define decFloatCompareSignal      decQuadCompareSignal
114 #define decFloatCompareTotal       decQuadCompareTotal
115 #define decFloatCompareTotalMag    decQuadCompareTotalMag
116
117 /* Copies */
118 #define decFloatCanonical          decQuadCanonical
119 #define decFloatCopy               decQuadCopy
120 #define decFloatCopyAbs            decQuadCopyAbs
121 #define decFloatCopyNegate         decQuadCopyNegate
122 #define decFloatCopySign           decQuadCopySign
123
124 /* Non-computational */
125 #define decFloatClass              decQuadClass
126 #define decFloatClassString        decQuadClassString
127 #define decFloatDigits             decQuadDigits
128 #define decFloatIsCanonical        decQuadIsCanonical
129 #define decFloatIsFinite           decQuadIsFinite
130 #define decFloatIsInfinite         decQuadIsInfinite
131 #define decFloatIsInteger          decQuadIsInteger
132 #define decFloatIsNaN              decQuadIsNaN
133 #define decFloatIsNormal           decQuadIsNormal
134 #define decFloatIsSignaling        decQuadIsSignaling
135 #define decFloatIsSignalling       decQuadIsSignalling
136 #define decFloatIsSigned           decQuadIsSigned
137 #define decFloatIsSubnormal        decQuadIsSubnormal
138 #define decFloatIsZero             decQuadIsZero
139 #define decFloatRadix              decQuadRadix
140 #define decFloatSameQuantum        decQuadSameQuantum
141 #define decFloatVersion            decQuadVersion
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