summaryrefslogtreecommitdiff
path: root/libdecnumber/decContext.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2009-03-30 00:01:29 +0000
committerDJ Delorie <dj@redhat.com>2009-03-30 00:01:29 +0000
commitf2be950300e01d47ae4f41fb7481c26319d33d81 (patch)
treeb8e1601a34c5f16ac401608e1a85a3091254543a /libdecnumber/decContext.h
parent4104b747d5a0457c0dd5236796c6b8efafa70bd0 (diff)
merge from gcc
Diffstat (limited to 'libdecnumber/decContext.h')
-rw-r--r--libdecnumber/decContext.h82
1 files changed, 34 insertions, 48 deletions
diff --git a/libdecnumber/decContext.h b/libdecnumber/decContext.h
index 70effd8008..f80d03c50c 100644
--- a/libdecnumber/decContext.h
+++ b/libdecnumber/decContext.h
@@ -34,7 +34,7 @@
/* */
/* Context variables must always have valid values: */
/* */
-/* status -- [any bits may be cleared, but not set, by user] */
+/* status -- [any bits may be cleared, but not set, by user] */
/* round -- must be one of the enumerated rounding modes */
/* */
/* The following variables are implied for fixed size formats (i.e., */
@@ -54,42 +54,36 @@
#define DECCONTEXT
#define DECCNAME "decContext" /* Short name */
#define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */
- #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */
+ #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */
- #if !defined(int32_t)
- #include <stdint.h> /* C99 standard integers */
- #endif
+ #include "gstdint.h" /* C99 standard integers */
#include <stdio.h> /* for printf, etc. */
- #include <signal.h> /* for traps */
+ #include <signal.h> /* for traps */
/* Extended flags setting -- set this to 0 to use only IEEE flags */
- #if !defined(DECEXTFLAG)
#define DECEXTFLAG 1 /* 1=enable extended flags */
- #endif
/* Conditional code flag -- set this to 0 for best performance */
- #if !defined(DECSUBSET)
#define DECSUBSET 0 /* 1=enable subset arithmetic */
- #endif
/* Context for operations, with associated constants */
enum rounding {
DEC_ROUND_CEILING, /* round towards +infinity */
- DEC_ROUND_UP, /* round away from 0 */
+ DEC_ROUND_UP, /* round away from 0 */
DEC_ROUND_HALF_UP, /* 0.5 rounds up */
DEC_ROUND_HALF_EVEN, /* 0.5 rounds to nearest even */
DEC_ROUND_HALF_DOWN, /* 0.5 rounds down */
DEC_ROUND_DOWN, /* round towards 0 (truncate) */
DEC_ROUND_FLOOR, /* round towards -infinity */
- DEC_ROUND_05UP, /* round for reround */
+ DEC_ROUND_05UP, /* round for reround */
DEC_ROUND_MAX /* enum must be less than this */
};
#define DEC_ROUND_DEFAULT DEC_ROUND_HALF_EVEN;
typedef struct {
- int32_t digits; /* working precision */
- int32_t emax; /* maximum positive exponent */
- int32_t emin; /* minimum negative exponent */
+ int32_t digits; /* working precision */
+ int32_t emax; /* maximum positive exponent */
+ int32_t emin; /* minimum negative exponent */
enum rounding round; /* rounding mode */
uint32_t traps; /* trap-enabler flags */
uint32_t status; /* status flags */
@@ -108,9 +102,9 @@
#define DEC_MIN_EMIN -999999999
#define DEC_MAX_MATH 999999 /* max emax, etc., for math funcs. */
- /* Classifications for decimal numbers, aligned with 754 (note that */
- /* 'normal' and 'subnormal' are meaningful only with a decContext */
- /* or a fixed size format). */
+ /* Classifications for decimal numbers, aligned with 754r (note */
+ /* that 'normal' and 'subnormal' are meaningful only with a */
+ /* decContext or a fixed size format). */
enum decClass {
DEC_CLASS_SNAN,
DEC_CLASS_QNAN,
@@ -145,15 +139,15 @@
#define DEC_Division_impossible 0x00000004
#define DEC_Division_undefined 0x00000008
#define DEC_Insufficient_storage 0x00000010 /* [when malloc fails] */
- #define DEC_Inexact 0x00000020
- #define DEC_Invalid_context 0x00000040
+ #define DEC_Inexact 0x00000020
+ #define DEC_Invalid_context 0x00000040
#define DEC_Invalid_operation 0x00000080
#if DECSUBSET
#define DEC_Lost_digits 0x00000100
#endif
#define DEC_Overflow 0x00000200
- #define DEC_Clamped 0x00000400
- #define DEC_Rounded 0x00000800
+ #define DEC_Clamped 0x00000400
+ #define DEC_Rounded 0x00000800
#define DEC_Subnormal 0x00001000
#define DEC_Underflow 0x00002000
#else
@@ -163,43 +157,43 @@
#define DEC_Division_impossible 0x00000010
#define DEC_Division_undefined 0x00000010
#define DEC_Insufficient_storage 0x00000010 /* [when malloc fails] */
- #define DEC_Inexact 0x00000001
- #define DEC_Invalid_context 0x00000010
+ #define DEC_Inexact 0x00000001
+ #define DEC_Invalid_context 0x00000010
#define DEC_Invalid_operation 0x00000010
#if DECSUBSET
#define DEC_Lost_digits 0x00000000
#endif
#define DEC_Overflow 0x00000008
- #define DEC_Clamped 0x00000000
- #define DEC_Rounded 0x00000000
+ #define DEC_Clamped 0x00000000
+ #define DEC_Rounded 0x00000000
#define DEC_Subnormal 0x00000000
#define DEC_Underflow 0x00000004
#endif
- /* IEEE 754 groupings for the flags */
+ /* IEEE 854 groupings for the flags */
/* [DEC_Clamped, DEC_Lost_digits, DEC_Rounded, and DEC_Subnormal */
- /* are not in IEEE 754] */
- #define DEC_IEEE_754_Division_by_zero (DEC_Division_by_zero)
+ /* are not in IEEE 854] */
+ #define DEC_IEEE_854_Division_by_zero (DEC_Division_by_zero)
#if DECSUBSET
- #define DEC_IEEE_754_Inexact (DEC_Inexact | DEC_Lost_digits)
+ #define DEC_IEEE_854_Inexact (DEC_Inexact | DEC_Lost_digits)
#else
- #define DEC_IEEE_754_Inexact (DEC_Inexact)
+ #define DEC_IEEE_854_Inexact (DEC_Inexact)
#endif
- #define DEC_IEEE_754_Invalid_operation (DEC_Conversion_syntax | \
+ #define DEC_IEEE_854_Invalid_operation (DEC_Conversion_syntax | \
DEC_Division_impossible | \
DEC_Division_undefined | \
DEC_Insufficient_storage | \
- DEC_Invalid_context | \
+ DEC_Invalid_context | \
DEC_Invalid_operation)
- #define DEC_IEEE_754_Overflow (DEC_Overflow)
- #define DEC_IEEE_754_Underflow (DEC_Underflow)
+ #define DEC_IEEE_854_Overflow (DEC_Overflow)
+ #define DEC_IEEE_854_Underflow (DEC_Underflow)
/* flags which are normally errors (result is qNaN, infinite, or 0) */
- #define DEC_Errors (DEC_IEEE_754_Division_by_zero | \
- DEC_IEEE_754_Invalid_operation | \
- DEC_IEEE_754_Overflow | DEC_IEEE_754_Underflow)
+ #define DEC_Errors (DEC_IEEE_854_Division_by_zero | \
+ DEC_IEEE_854_Invalid_operation | \
+ DEC_IEEE_854_Overflow | DEC_IEEE_854_Underflow)
/* flags which cause a result to become qNaN */
- #define DEC_NaNs DEC_IEEE_754_Invalid_operation
+ #define DEC_NaNs DEC_IEEE_854_Invalid_operation
/* flags which are normally for information only (finite results) */
#if DECSUBSET
@@ -209,13 +203,6 @@
#define DEC_Information (DEC_Clamped | DEC_Rounded | DEC_Inexact)
#endif
- /* IEEE 854 names (for compatibility with older decNumber versions) */
- #define DEC_IEEE_854_Division_by_zero DEC_IEEE_754_Division_by_zero
- #define DEC_IEEE_854_Inexact DEC_IEEE_754_Inexact
- #define DEC_IEEE_854_Invalid_operation DEC_IEEE_754_Invalid_operation
- #define DEC_IEEE_854_Overflow DEC_IEEE_754_Overflow
- #define DEC_IEEE_854_Underflow DEC_IEEE_754_Underflow
-
/* Name strings for the exceptional conditions */
#define DEC_Condition_CS "Conversion syntax"
#define DEC_Condition_DZ "Division by zero"
@@ -239,7 +226,7 @@
/* including terminator */
/* Initialization descriptors, used by decContextDefault */
- #define DEC_INIT_BASE 0
+ #define DEC_INIT_BASE 0
#define DEC_INIT_DECIMAL32 32
#define DEC_INIT_DECIMAL64 64
#define DEC_INIT_DECIMAL128 128
@@ -264,7 +251,6 @@
extern decContext * decContextSetStatusFromStringQuiet(decContext *, const char *);
extern decContext * decContextSetStatusQuiet(decContext *, uint32_t);
extern const char * decContextStatusToString(const decContext *);
- extern int32_t decContextTestEndian(uint8_t);
extern uint32_t decContextTestSavedStatus(uint32_t, uint32_t);
extern uint32_t decContextTestStatus(decContext *, uint32_t);
extern decContext * decContextZeroStatus(decContext *);