summaryrefslogtreecommitdiff
path: root/libdecnumber/decDouble.h
diff options
context:
space:
mode:
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-10 20:44:08 +0000
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-10 20:44:08 +0000
commitc8ac5d9a0464767d7091606c4d55aaaf8edc511a (patch)
treedc346951fedce72b616d1e6c4be76685c2e68c3a /libdecnumber/decDouble.h
parenta7835ede2329ad200c076f75edf493a4cb35e239 (diff)
downloadgcc-c8ac5d9a0464767d7091606c4d55aaaf8edc511a.tar.gz
2007-09-10 Janis Johnson <janis187@us.ibm.com>
Ben Elliston <bje@au.ibm.com> libdecnumber/ * Makefile.in (libdecnumber_a_OBJS): Remove decUtility.o (dependencies): Add Symbols headers. * decContext.c: Upgrade to decNumber 3.53. * decContext.h: Ditto. * decDPD.h: Ditto. * decNumber.c: Ditto. * decNumber.h: Ditto. * decNumberLocal.h: Ditto. * decBasic.c: New file from decNumber 3.53. * decCommon.c: Ditto. * decDouble.c: Ditto. * decDouble.h: Ditto. * decQuad.c: Ditto. * decQuad.h: Ditto. * decSingle.c: Ditto. * decSingle.h: Ditto. * decPacked.c: Ditto. * decPacked.h: Ditto. * dpd/decimal128.c: Upgrade to decNumber 3.53. * dpd/decimal128.h: Ditto. * dpd/decimal32.c: Ditto. * dpd/decimal32.h: Ditto. * dpd/decimal64.c: Ditto. * dpd/decimal64.h: Ditto. * decLibrary.c (__dec_byte_swap): Remove. * decContextSymbols.h: New file. * decDoubleSymbols.h: New file. * decNumberSymbols.h: New file. * decPackedSymbols.h: New file. * decQuadSymbols.h: New file. * decSingleSymbols.h: New file. * decUtility.c: Delete file. * decUtility.h: Delete file. * bid/decimal128Symbols.h: New file. * bid/decimal128Local.h: New file. * bid/decimal32Symbols.h: New file. * bid/decimal64Symbols.h: New file. * bid/host-ieee128.c (__swap128): Remove. (__host_to_ieee_128, __ieee_to_host_128): Don't handle endianness. * bid/host-ieee32.c (__dec_type_swap): Remove. (__host_to_ieee_32, __ieee_to_host_32): Don't handle endianness. * bid/host-ieee64.c (__swap64): Remove. (__host_to_ieee_64, __ieee_to_host_64): Don't handle endianness. * dpd/decimal32Symbols.h: New file. * dpd/decimal64Symbols.h: New file. * dpd/decimal128Symbols.h: New file. * dpd/decimal128Local.h: New file. libgcc/ * Makefile.in (dfp-filenames): Remove decUtility, add decDouble, decPacked, decQuad, decSingle. gcc/ * dfp.c: Include decimal128Local.h; (dfp_byte_swap): Remove. (encode_decimal32, decode_decimal32): Don't handle endianness. (encode_decimal64, decode_decimal64): Ditto. (encode_decimal128, decode_decimal128): Ditto. * config/dfp-bit.c (host_to_ieee32, ieee_to_host_32): Ditto. (__swap64): Remove. (host_to_ieee_64, ieee_to_host_64): Don't handle endianness. (__swap128): Remove (host_to_ieee_128, ieee_to_host_128): Don't handle endianness. * Makefile.in (DECNUM_H): Add decimal128Local.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128350 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libdecnumber/decDouble.h')
-rw-r--r--libdecnumber/decDouble.h164
1 files changed, 164 insertions, 0 deletions
diff --git a/libdecnumber/decDouble.h b/libdecnumber/decDouble.h
new file mode 100644
index 00000000000..32eba395d85
--- /dev/null
+++ b/libdecnumber/decDouble.h
@@ -0,0 +1,164 @@
+/* decDouble module header for the decNumber C Library.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Contributed by IBM Corporation. Author Mike Cowlishaw.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ In addition to the permissions in the GNU General Public License,
+ the Free Software Foundation gives you unlimited permission to link
+ the compiled version of this file into combinations with other
+ programs, and to distribute those combinations without any
+ restriction coming from the use of this file. (The General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into a combine executable.)
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* ------------------------------------------------------------------ */
+/* decDouble.h -- Decimal 64-bit format module header */
+/* ------------------------------------------------------------------ */
+/* Please see decFloats.h for an overview and documentation details. */
+/* ------------------------------------------------------------------ */
+
+#if !defined(DECDOUBLE)
+ #define DECDOUBLE
+
+ #define DECDOUBLENAME "decimalDouble" /* Short name */
+ #define DECDOUBLETITLE "Decimal 64-bit datum" /* Verbose name */
+ #define DECDOUBLEAUTHOR "Mike Cowlishaw" /* Who to blame */
+
+ /* parameters for decDoubles */
+ #define DECDOUBLE_Bytes 8 /* length */
+ #define DECDOUBLE_Pmax 16 /* maximum precision (digits) */
+ #define DECDOUBLE_Emin -383 /* minimum adjusted exponent */
+ #define DECDOUBLE_Emax 384 /* maximum adjusted exponent */
+ #define DECDOUBLE_EmaxD 3 /* maximum exponent digits */
+ #define DECDOUBLE_Bias 398 /* bias for the exponent */
+ #define DECDOUBLE_String 25 /* maximum string length, +1 */
+ #define DECDOUBLE_EconL 8 /* exponent continuation length */
+ #define DECDOUBLE_Declets 5 /* count of declets */
+ /* highest biased exponent (Elimit-1) */
+ #define DECDOUBLE_Ehigh (DECDOUBLE_Emax + DECDOUBLE_Bias - (DECDOUBLE_Pmax-1))
+
+ /* Required includes */
+ #include "decContext.h"
+ #include "decQuad.h"
+
+ /* The decDouble decimal 64-bit type, accessible by bytes */
+ typedef struct {
+ uint8_t bytes[DECDOUBLE_Bytes]; /* fields: 1, 5, 8, 50 bits */
+ } decDouble;
+
+ /* ---------------------------------------------------------------- */
+ /* Routines -- implemented as decFloat routines in common files */
+ /* ---------------------------------------------------------------- */
+
+ #include "decDoubleSymbols.h"
+
+ /* Utilities and conversions, extractors, etc.) */
+ extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t);
+ extern decDouble * decDoubleFromInt32(decDouble *, int32_t);
+ extern decDouble * decDoubleFromPacked(decDouble *, int32_t, const uint8_t *);
+ extern decDouble * decDoubleFromString(decDouble *, const char *, decContext *);
+ extern decDouble * decDoubleFromUInt32(decDouble *, uint32_t);
+ extern decDouble * decDoubleFromWider(decDouble *, const decQuad *, decContext *);
+ extern int32_t decDoubleGetCoefficient(const decDouble *, uint8_t *);
+ extern int32_t decDoubleGetExponent(const decDouble *);
+ extern decDouble * decDoubleSetCoefficient(decDouble *, const uint8_t *, int32_t);
+ extern decDouble * decDoubleSetExponent(decDouble *, decContext *, int32_t);
+ extern void decDoubleShow(const decDouble *, const char *);
+ extern int32_t decDoubleToBCD(const decDouble *, int32_t *, uint8_t *);
+ extern char * decDoubleToEngString(const decDouble *, char *);
+ extern int32_t decDoubleToInt32(const decDouble *, decContext *, enum rounding);
+ extern int32_t decDoubleToInt32Exact(const decDouble *, decContext *, enum rounding);
+ extern int32_t decDoubleToPacked(const decDouble *, int32_t *, uint8_t *);
+ extern char * decDoubleToString(const decDouble *, char *);
+ extern uint32_t decDoubleToUInt32(const decDouble *, decContext *, enum rounding);
+ extern uint32_t decDoubleToUInt32Exact(const decDouble *, decContext *, enum rounding);
+ extern decQuad * decDoubleToWider(const decDouble *, decQuad *);
+ extern decDouble * decDoubleZero(decDouble *);
+
+ /* Computational (result is a decDouble) */
+ extern decDouble * decDoubleAbs(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleAdd(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleAnd(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleDivide(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleDivideInteger(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleFMA(decDouble *, const decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleInvert(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleLogB(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMax(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMaxMag(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMin(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMinMag(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMinus(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleMultiply(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleNextMinus(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleNextPlus(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleNextToward(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleOr(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoublePlus(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleQuantize(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleReduce(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleRemainder(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleRemainderNear(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleRotate(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleScaleB(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleShift(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleSubtract(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleToIntegralValue(decDouble *, const decDouble *, decContext *, enum rounding);
+ extern decDouble * decDoubleToIntegralExact(decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleXor(decDouble *, const decDouble *, const decDouble *, decContext *);
+
+ /* Comparisons */
+ extern decDouble * decDoubleCompare(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleCompareSignal(decDouble *, const decDouble *, const decDouble *, decContext *);
+ extern decDouble * decDoubleCompareTotal(decDouble *, const decDouble *, const decDouble *);
+ extern decDouble * decDoubleCompareTotalMag(decDouble *, const decDouble *, const decDouble *);
+
+ /* Copies */
+ extern decDouble * decDoubleCanonical(decDouble *, const decDouble *);
+ extern decDouble * decDoubleCopy(decDouble *, const decDouble *);
+ extern decDouble * decDoubleCopyAbs(decDouble *, const decDouble *);
+ extern decDouble * decDoubleCopyNegate(decDouble *, const decDouble *);
+ extern decDouble * decDoubleCopySign(decDouble *, const decDouble *, const decDouble *);
+
+ /* Non-computational */
+ extern enum decClass decDoubleClass(const decDouble *);
+ extern const char * decDoubleClassString(const decDouble *);
+ extern uint32_t decDoubleDigits(const decDouble *);
+ extern uint32_t decDoubleIsCanonical(const decDouble *);
+ extern uint32_t decDoubleIsFinite(const decDouble *);
+ extern uint32_t decDoubleIsInfinite(const decDouble *);
+ extern uint32_t decDoubleIsInteger(const decDouble *);
+ extern uint32_t decDoubleIsNaN(const decDouble *);
+ extern uint32_t decDoubleIsNormal(const decDouble *);
+ extern uint32_t decDoubleIsSignaling(const decDouble *);
+ extern uint32_t decDoubleIsSignalling(const decDouble *);
+ extern uint32_t decDoubleIsSigned(const decDouble *);
+ extern uint32_t decDoubleIsSubnormal(const decDouble *);
+ extern uint32_t decDoubleIsZero(const decDouble *);
+ extern uint32_t decDoubleRadix(const decDouble *);
+ extern uint32_t decDoubleSameQuantum(const decDouble *, const decDouble *);
+ extern const char * decDoubleVersion(void);
+
+ /* decNumber conversions; these are implemented as macros so as not */
+ /* to force a dependency on decimal64 and decNumber in decDouble. */
+ #define decDoubleToNumber(dq, dn) decimal64ToNumber((decimal64 *)(dq), dn)
+ #define decDoubleFromNumber(dq, dn, set) (decDouble *)decimal64FromNumber((decimal64 *)(dq), dn, set)
+
+#endif