37 #ifdef HAVE_FINITE_IEEEFP_H
42 #define COB_LIB_EXPIMP
47 #define DECIMAL_CHECK(d1,d2) \
48 if (unlikely(d1->scale == COB_DECIMAL_NAN || \
49 d2->scale == COB_DECIMAL_NAN)) { \
50 d1->scale = COB_DECIMAL_NAN; \
59 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
60 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
61 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
62 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
63 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
64 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
65 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
66 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
67 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
68 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99
72 static const unsigned char bits8[] = {
73 8, 7, 6, 6, 5, 5, 5, 5,
74 4, 4, 4, 4, 4, 4, 4, 4,
75 3, 3, 3, 3, 3, 3, 3, 3,
76 3, 3, 3, 3, 3, 3, 3, 3,
77 2, 2, 2, 2, 2, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2,
81 1, 1, 1, 1, 1, 1, 1, 1,
82 1, 1, 1, 1, 1, 1, 1, 1,
83 1, 1, 1, 1, 1, 1, 1, 1,
84 1, 1, 1, 1, 1, 1, 1, 1,
85 1, 1, 1, 1, 1, 1, 1, 1,
86 1, 1, 1, 1, 1, 1, 1, 1,
87 1, 1, 1, 1, 1, 1, 1, 1,
88 1, 1, 1, 1, 1, 1, 1, 1,
89 0, 0, 0, 0, 0, 0, 0, 0,
90 0, 0, 0, 0, 0, 0, 0, 0,
91 0, 0, 0, 0, 0, 0, 0, 0,
92 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 0, 0, 0, 0, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0, 0, 0, 0,
100 0, 0, 0, 0, 0, 0, 0, 0,
101 0, 0, 0, 0, 0, 0, 0, 0,
102 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0
129 #ifdef COB_EXPERIMENTAL
131 #if GMP_NAIL_BITS != 0
132 #error NAILS not supported
135 #define COB_MAX_LL COB_S64_C(9223372036854775807)
138 mpz_set_ull (mpz_ptr dest,
const cob_u64_t val)
143 dest->_mp_d[0] = val & GMP_NUMB_MASK;
144 #if GMP_LIMB_BITS < 64
145 if (val > GMP_NUMB_MAX) {
146 dest->_mp_d[1] = val >> GMP_NUMB_BITS;
150 dest->_mp_size = size;
154 mpz_set_sll (mpz_ptr dest,
const cob_s64_t val)
161 dest->_mp_d[0] = vtmp & GMP_NUMB_MASK;
162 #if GMP_LIMB_BITS < 64
163 if (vtmp > GMP_NUMB_MAX) {
164 dest->_mp_d[1] = vtmp >> GMP_NUMB_BITS;
168 dest->_mp_size = (val >= 0) ? size : -size;
172 mpz_get_ull (
const mpz_ptr src)
176 size = mpz_size (src);
180 #if GMP_LIMB_BITS > 32
187 ((
cob_u64_t)src->_mp_d[1] << GMP_NUMB_BITS);
192 mpz_get_sll (
const mpz_ptr src)
197 size = src->_mp_size;
202 #
if GMP_LIMB_BITS < 64
203 if (mpz_size (src) > 1) {
204 vtmp |= (
cob_u64_t)src->_mp_d[1] << GMP_NUMB_BITS;
210 return ~(((
cob_s64_t) vtmp - 1LL) & COB_MAX_LL);
219 #ifdef HAVE_MP_GET_MEMORY_FUNCTIONS
220 void (*freefunc)(
void *, size_t);
221 mp_get_memory_functions (
NULL,
NULL, &freefunc);
222 freefunc (ptr, strlen((
char*) ptr) + 1);
240 size_t fsiz = 8U - f->
size;
242 #ifndef WORDS_BIGENDIAN
266 size_t fsiz = 8U - f->
size;
268 #ifndef WORDS_BIGENDIAN
285 #ifndef WORDS_BIGENDIAN
290 s = ((
unsigned char *)&n) + 8 - f->
size;
292 s = (
unsigned char *)&n;
303 #ifndef WORDS_BIGENDIAN
308 s = ((
unsigned char *)&n) + 8 - f->
size;
310 s = (
unsigned char *)&n;
369 fprintf (fp,
"(Nan)");
373 fprintf (fp,
"(Inf)");
376 if (!mpz_sgn (d->
value)) {
383 if (!mpz_divisible_ui_p (
cob_mpzt2, 10UL)) {
389 gmp_fprintf (fp,
"%ZdE%d",
cob_mpzt2, -scale);
424 cob_clamp_decimal (
cob_decimal *d,
const unsigned int expomin,
425 const unsigned int expomax,
const unsigned int sigfbits)
430 if (!mpz_sgn (d->
value)) {
437 if (!mpz_divisible_ui_p (d->
value, 10UL)) {
444 size = (int)mpz_sizeinbase (d->
value, 2);
445 for (; size > sigfbits && d->
scale; d->
scale--) {
447 size = (int)mpz_sizeinbase (d->
value, 2);
449 return expomin - (
unsigned int)d->
scale;
451 for (count = 0; count < expomax; ++count) {
452 if (!mpz_divisible_ui_p (d->
value, 10UL)) {
457 return expomin + count;
468 unsigned char bd[16];
471 expo = ((data[0] & 0x7FU) << 8U) | data[1];
472 if (expo == 0x7FFFU) {
473 mpz_set_ui (d->
value, 1UL);
487 sign = mpz_sgn (d->
value);
489 memset (f->
data, 0, (
size_t)8);
495 for ( ; ; d->
scale--) {
496 if (!mpz_divisible_ui_p (d->
value, 10UL)) {
508 for ( ; d->
scale; ) {
527 expo = 398 - d->
scale;
529 expo = cob_clamp_decimal (d, 398U, 369U, 53U);
534 (
size_t)0, d->
value);
536 if (mpz_sizeinbase (d->
value, 2) > 51U) {
541 data |= (expo << 53U);
546 memcpy (f->
data, &data, (
size_t)8);
563 memcpy (&data, f->
data,
sizeof(data));
567 mpz_set_ui (d->
value, 1UL);
575 if (data >
COB_U64_C(9999999999999999)) {
576 mpz_set_ui (d->
value, 0UL);
586 mpz_set_ui (d->
value, 0UL);
591 mpz_set_ui (d->
value, data);
598 d->
scale = (int)expo - 398;
603 }
else if (d->
scale < 0) {
618 sign = mpz_sgn (d->
value);
620 memset (f->
data, 0, (
size_t)16);
626 for ( ; ; d->
scale--) {
627 if (!mpz_divisible_ui_p (d->
value, 10UL)) {
639 for ( ; d->
scale; ) {
658 expo = 6176 - d->
scale;
660 expo = cob_clamp_decimal (d, 6176U, 6111U, 113U);
666 (
size_t)0, d->
value);
669 if (mpz_sizeinbase (d->
value, 2) > 113U) {
683 memcpy (f->
data, data, (
size_t)16);
700 memcpy (data, f->
data,
sizeof(data));
704 mpz_set_ui (d->
value, 1UL);
714 mpz_set_ui (d->
value, 0);
724 mpz_set_ui (d->
value, 0UL);
745 mpz_set_ui (d->
value, 0UL);
749 d->
scale = (int)expo - 6176;
754 }
else if (d->
scale < 0) {
769 unsigned char data[16];
776 memcpy (data, f->
data, 16);
777 sign = data[0] >> 7U;
778 comb = (data[0] & 0x78U) >> 3U;
780 mpz_set_ui (d->
value, 1UL);
786 expo = ((data[0] & 0x1FU) << 9U) | (data[1] << 1U) |
794 expo = ((data[0] & 0x7FU) << 7U) | (data[1] >> 1U);
798 mpz_import (d->
value, 15, 1, 1, 1, 0, &data[1]);
799 if (!mpz_sgn (d->
value)) {
807 d->
scale = (int)expo - 6176;
812 }
else if (d->
scale < 0) {
834 memset (&t1,
' ',
sizeof(t1));
836 if (ud.l1 == 0 || ud.l1 == t1 || !finite (v)) {
837 mpz_set_ui (d->
value, 0UL);
845 q = mpf_get_str (
NULL, &scale, 10, (
size_t)96,
cob_mpft);
847 mpz_set_ui (d->
value, 0UL);
858 mpz_set_str (d->
value, p, 10);
918 return ((*p & 0x0FU) == 0x0DU) ? -1 : 1;
938 p = f->
data + (ndigs / 2) - (1 - msn);
943 tval = (*p & 0xF0) >> 4;
953 *p = (*p & 0xF0) | tval;
956 *p = (*p & 0x0F) | (tval << 4);
964 cob_add_packed (
cob_field *f,
int val,
const int opt)
972 unsigned int subtr = 0;
973 unsigned int zeroes = 0;
974 unsigned int origdigs;
975 unsigned char savedata[256];
983 memcpy (savedata, f->
data, f->
size);
1002 p = f->
data + (ndigs / 2) - (1 - msn);
1006 carry += (val % 10);
1012 tval = (*p & 0xF0) >> 4;
1025 tval = (tval + 6) & 0x0F;
1035 *p = (*p & 0xF0) | tval;
1038 *p = (*p & 0x0F) | (tval << 4);
1045 if (origdigs == zeroes) {
1046 *p = (*p & 0xF0) | 0x0C;
1047 }
else if (subtr && carry) {
1048 cob_complement_packed (f);
1051 *p = (*p & 0xF0) | 0x0D;
1053 *p = (*p & 0xF0) | 0x0C;
1056 }
else if (subtr && carry) {
1057 cob_complement_packed (f);
1059 if (opt && (carry || val)) {
1063 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
1064 memcpy (f->
data, savedata, f->
size);
1090 unsigned char *endp;
1094 unsigned int byteval;
1095 unsigned int nonzero;
1100 if (digits > (f->
size * 2) - 1) {
1101 digits = (f->
size * 2) - 1;
1115 if (digits % 2 == nibtest) {
1116 byteval = *p & 0x0FU;
1120 nonzero = !!byteval;
1122 for (; p < endp; p++) {
1128 (
cob_uli_t)((*p >> 4U) * 10U) + (*p & 0x0FU));
1149 unsigned char *data;
1166 sign = mpz_sgn (d->
value);
1177 if (
unlikely(mpz_sizeinbase (d->
value, 10) >
sizeof(buff) - 1)) {
1183 (void)mpz_get_str (buff, 10, d->
value);
1186 size = strlen (mza);
1192 if (digits > (f->
size * 2) - 1) {
1193 digits = (f->
size * 2) - 1;
1196 q = (
unsigned char *)mza;
1197 diff = (int)(digits - size);
1204 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
1218 memset (data, 0, f->
size);
1220 p = data + ((digits - 1) / 2) - ((size - 1) / 2);
1221 diff = (int)(size % 2);
1223 p = data + (digits / 2) - (size / 2);
1224 diff = 1 - (int)(size % 2);
1226 for (i = diff, n = 0; i < size + diff; i++, n++) {
1250 *p = (*p & 0xF0U) | 0x0FU;
1251 }
else if (sign < 0) {
1252 *p = (*p & 0xF0U) | 0x0DU;
1254 *p = (*p & 0xF0U) | 0x0CU;
1291 for (; n && p >= f->
data; n /= 100, p--) {
1296 *(f->
data) &= 0x0FU;
1301 *(f->
data) &= 0x0FU;
1310 unsigned char *data;
1331 while (size > 1 && (*data & 0x0FU) == 0) {
1351 mpz_set_ui (d->
value, n);
1354 for (; n < size; ++n) {
1355 p[n] = (data[n] & 0x0FU) +
'0';
1358 mpz_set_str (d->
value, (
char *)p, 10);
1363 if (sign < 0 && mpz_sgn (d->
value)) {
1373 unsigned char *data;
1381 sign = mpz_sgn (d->
value);
1402 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
1411 memset (data,
'0', (
size_t)diff);
1412 memcpy (data + diff, p, size);
1426 #ifdef COB_EXPERIMENTAL
1435 #ifndef WORDS_BIGENDIAN
1448 for (idx = 0; idx < size; ++idx) {
1449 buff[idx] = ~f->
data[idx];
1451 mpz_import (d->
value, 1, order, size, order, 0, buff);
1454 mpz_import (d->
value, 1, order, size, order, 0, f->
data);
1465 #elif defined(COB_LI_IS_LL)
1514 #if !defined(COB_EXPERIMENTAL) && !defined(COB_LI_IS_LL)
1530 if (mpz_sgn (d->
value) < 0) {
1534 bitnum = (f->
size * 8) - sign;
1536 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
1552 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
1571 #elif defined(COB_EXPERIMENTAL)
1572 if (!sign || (overflow && !(opt & COB_STORE_TRUNC_ON_OVERFLOW))) {
1579 if (!sign || (overflow && !(opt & COB_STORE_TRUNC_ON_OVERFLOW))) {
1589 if (!sign || (overflow && !(opt & COB_STORE_TRUNC_ON_OVERFLOW))) {
1590 ullval = mpz_get_ui (d->
value);
1591 ullval = (ullval << 32) | lo;
1594 llval = mpz_get_si (d->
value);
1595 llval = (llval << 32) | lo;
1627 memcpy ((
void *)&uval.fval, f->
data,
sizeof(
float));
1631 memcpy ((
void *)&uval.dval, f->
data,
sizeof(
double));
1662 memcpy ((
void *)&uval.fval, f->
data,
sizeof(
float));
1666 memcpy ((
void *)&uval.dval, f->
data,
sizeof(
double));
1689 fprintf (fp,
CB_FMT_PLLU, size, size, llval.uval);
1699 sign = mpz_sgn (d->
value);
1705 if (scale >= d->
scale) {
1716 adj = d->
scale - scale;
1717 mpz_ui_pow_ui (
cob_mpzt, 10UL, adj);
1729 adj = d->
scale - scale - 1;
1730 mpz_ui_pow_ui (
cob_mpzt, 10UL, adj);
1744 adj = d->
scale - scale;
1745 mpz_ui_pow_ui (
cob_mpzt, 10UL, adj);
1755 adj = d->
scale - scale;
1756 mpz_ui_pow_ui (
cob_mpzt, 10UL, adj);
1766 adj = d->
scale - scale - 1;
1767 mpz_ui_pow_ui (
cob_mpzt, 10UL, adj);
1772 adj = mpz_tdiv_ui (d->
value, 100UL);
1845 memcpy (f->
data, &uval.fval, sizeof (
float));
1849 memcpy (f->
data, &uval.val, sizeof (
double));
2018 display_add_int (
unsigned char *data,
const size_t size,
int n,
const int opt)
2036 is = (*sp & 0x0F) + i + carry;
2039 *sp =
'0' + ((is + 6) & 0x0F);
2050 while (--sp >= data) {
2051 if ((*sp += 1) <= (
unsigned char)
'9') {
2060 display_sub_int (
unsigned char *data,
const size_t size,
int n,
const int opt)
2080 *sp = (
unsigned char)(
'0' + (*sp & 0x0F));
2083 if ((*sp -= i + carry) <
'0') {
2095 while (--sp >= data) {
2098 *sp = (
unsigned char)(
'0' + (*sp & 0x0F));
2100 if ((*sp -= 1) >= (
unsigned char)
'0') {
2109 cob_display_add_int (
cob_field *f,
int n,
const int opt)
2111 unsigned char *data;
2117 unsigned char tfield[256];
2122 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
2123 memcpy (tfield, data, size);
2151 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
2160 if (display_add_int (data, size, n, opt) != 0) {
2165 if (opt & COB_STORE_KEEP_ON_OVERFLOW) {
2166 memcpy (data, tfield, osize);
2172 if (display_sub_int (data, size, -n, opt) != 0) {
2173 for (i = 0; i < size; ++i) {
2177 for (i = size; i < size + scale; ++i) {
2183 (void)display_add_int (data, size, 1, 0);
2205 return cob_add_packed (f, n, opt);
2207 return cob_display_add_int (f, n, opt);
2295 mpz_mul_2exp (cob_d2.
value, cob_d2.
value, 32);
2307 #ifdef COB_FLOAT_DELTA
2308 #define TOLERANCE (double) COB_FLOAT_DELTA
2310 #define TOLERANCE (double) 0.0000001
2312 #define FLOAT_EQ(x,y,t) (fabs(((x-y)/x)) < t)
2320 memcpy(&flt,f1->
data,
sizeof(
float));
2323 memcpy(&d1,f1->
data,
sizeof(
double));
2329 memcpy(&flt,f2->
data,
sizeof(
float));
2332 memcpy(&d2,f2->
data,
sizeof(
double));
2369 unsigned char val1[20];
2373 if (sign >= 0 && val < 0) {
2377 if (sign < 0 && val >= 0) {
2388 for (size = 0; size < 20; size++) {
2389 if (size < 20 - f->size) {
2392 val1[size] = p[inc++];
2397 val1[20 - f->
size] &= 0x0F;
2402 val1[20 - f->
size] &= 0x0F;
2417 *p = (
unsigned char)((size % 10) | ((size / 10) << 4));
2423 for (size = 0; size < 20; size++) {
2437 #ifdef COB_EBCDIC_MACHINE
2439 cob_get_long_ascii_sign (
const unsigned char *p,
cob_s64_t *val)
2546 const unsigned char *p;
2555 for (inc = 0; inc < size; inc++, p++) {
2556 val = (val * 10) +
COB_D2I (*p);
2558 return (val < n) ? -1 : (val > n);
2560 for (inc = 0; inc < size - 1; inc++, p++) {
2561 val = (val * 10) +
COB_D2I (*p);
2564 if (*p >= (
unsigned char)
'0' && *p <= (
unsigned char)
'9') {
2572 #ifdef COB_EBCDIC_MACHINE
2573 if (cob_get_long_ascii_sign (p, &val)) {
2577 if (*p >= (
unsigned char)
'p' && *p <= (
unsigned char)
'y') {
2578 val += (*p - (
unsigned char)
'p');
2584 return (val < n) ? -1 : (val > n);
2594 va_start (args, params);
2595 for (i = 0; i <
params; ++i) {
2597 *dec = cob_decimal_base + i;
2609 va_start (args, params);
2610 for (i = 0; i <
params; ++i) {
2625 va_start (args, params);
2626 for (i = 0; i <
params; ++i) {
2628 mpz_clear (dec->
value);
2642 if (cob_decimal_base) {
2645 mpz_clear (d1->
value);
2650 mpz_clear (cob_d_remainder.
value);
2652 mpz_clear (cob_d3.
value);
2653 mpz_clear (cob_d2.
value);
2654 mpz_clear (cob_d1.
value);
static mpz_t cob_mpz_ten16m1
void cob_free(void *mptr)
#define COB_STORE_AWAY_FROM_ZERO
void cob_set_packed_int(cob_field *f, const int val)
void cob_sub(cob_field *f1, cob_field *f2, const int opt)
static unsigned char packed_value[20]
static mpz_t cob_mpz_ten34m1
#define COB_FIELD_SCALE(f)
int cob_sub_int(cob_field *f, const int n, const int opt)
int cob_add_int(cob_field *f, const int n, const int opt)
#define COB_FIELD_DATA(f)
#define COB_STORE_NEAR_TOWARD_ZERO
static void cob_decimal_set_double(cob_decimal *d, const double v)
static void shift_decimal(cob_decimal *d, const int n)
static int cob_decimal_get_ieee128dec(cob_decimal *d, cob_field *f, const int opt)
static COB_INLINE COB_A_INLINE void cob_decimal_set(cob_decimal *dst, const cob_decimal *src)
static cob_global * cobglobptr
#define COB_FIELD_BINARY_SWAP(f)
void cob_mul(cob_field *f1, cob_field *f2, const int opt)
#define COB_TYPE_NUMERIC_PACKED
#define COB_STORE_NEAR_AWAY_FROM_ZERO
static void cob_decimal_do_round(cob_decimal *d, cob_field *f, const int opt)
void cob_set_packed_zero(cob_field *f)
void cob_move(cob_field *, cob_field *)
int cob_cmp_float(cob_field *f1, cob_field *f2)
static mpf_t cob_mpft_get
void cob_decimal_mul(cob_decimal *d1, cob_decimal *d2)
#define COB_FIELD_TYPE(f)
static unsigned int cob_get_long_ebcdic_sign(const unsigned char *p, cob_s64_t *val)
void cob_div_quotient(cob_field *dividend, cob_field *divisor, cob_field *quotient, const int opt)
static int cob_packed_get_sign(const cob_field *f)
#define COB_STORE_NEAR_EVEN
static double cob_decimal_get_double(cob_decimal *d)
static COB_INLINE COB_A_INLINE void num_byte_memcpy(unsigned char *s1, const unsigned char *s2, size_t size)
#define COB_FIELD_IS_FP(f)
static cob_u64_t last_packed_val
void cob_decimal_setget_fld(cob_field *src, cob_field *dst, const int opt)
#define COB_128_OR_EXTEND
void cob_decimal_set_field(cob_decimal *d, cob_field *f)
static mpz_t cob_mpze10[COB_MAX_BINARY]
#define COB_MAX_DEC_STRUCT
#define COB_ATTR_INIT(u, v, x, y, z)
static cob_decimal cob_d_remainder
void cob_decimal_sub(cob_decimal *d1, cob_decimal *d2)
static cob_decimal cob_d3
void cob_decimal_pop(const cob_u32_t params,...)
static void cob_decimal_set_ieee64dec(cob_decimal *d, const cob_field *f)
#define COB_FLAG_HAVE_SIGN
void cob_gmp_free(void *ptr)
int cob_decimal_cmp(cob_decimal *d1, cob_decimal *d2)
static COB_INLINE COB_A_INLINE void cob_binary_set_uint64(cob_field *f, cob_u64_t n)
#define COB_TYPE_NUMERIC_FP_DEC64
#define COB_FIELD_NO_SIGN_NIBBLE(f)
int cob_cmp_packed(cob_field *f, const cob_s64_t val)
void cob_exit_numeric(void)
#define COB_TYPE_NUMERIC_FLOAT
static int cob_decimal_get_ieee64dec(cob_decimal *d, cob_field *f, const int opt)
#define FLOAT_EQ(x, y, t)
void cob_decimal_add(cob_decimal *d1, cob_decimal *d2)
int cob_cmp_int(cob_field *f1, const int n)
int cob_numeric_cmp(cob_field *f1, cob_field *f2)
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
int cob_cmp_numdisp(const unsigned char *data, const size_t size, const cob_s64_t n, const cob_u32_t has_sign)
static void cob_decimal_set_binary(cob_decimal *d, cob_field *f)
static int cob_decimal_get_packed(cob_decimal *d, cob_field *f, const int opt)
#define COB_STORE_TRUNCATION
#define COB_FIELD_BINARY_TRUNC(f)
#define COB_TYPE_NUMERIC_BINARY
void cob_set_exception(const int id)
void cob_decimal_alloc(const cob_u32_t params,...)
#define COB_STORE_KEEP_ON_OVERFLOW
#define COB_TYPE_NUMERIC_DISPLAY
#define COB_TYPE_NUMERIC_FP_BIN128
#define COB_PUT_SIGN(f, s)
static int cob_decimal_get_binary(cob_decimal *d, cob_field *f, const int opt)
void cob_div(cob_field *f1, cob_field *f2, const int opt)
static void cob_decimal_set_display(cob_decimal *d, cob_field *f)
void cob_init_numeric(cob_global *lptr)
static COB_INLINE COB_A_INLINE void cob_binary_set_int64(cob_field *f, cob_s64_t n)
int cob_cmp_llint(cob_field *f1, const cob_s64_t n)
#define COB_STORE_PROHIBITED
#define COB_64_IS_SPECIAL(x)
#define COB_TYPE_NUMERIC_DOUBLE
#define COB_64_IS_EXTEND(x)
#define COB_STORE_TOWARD_GREATER
strict implicit external call column overflow
void cob_add(cob_field *f1, cob_field *f2, const int opt)
void cob_decimal_div(cob_decimal *d1, cob_decimal *d2)
const cob_field_attr * attr
static void cob_decimal_set_packed(cob_decimal *d, cob_field *f)
void * cob_malloc(const size_t size)
#define DECIMAL_CHECK(d1, d2)
static cob_decimal cob_d2
#define COB_STORE_TOWARD_LESSER
#define COB_STORE_TRUNC_ON_OVERFLOW
#define COB_FIELD_HAVE_SIGN(f)
static void align_decimal(cob_decimal *d1, cob_decimal *d2)
static void cob_decimal_print(cob_decimal *d, FILE *fp)
void * cob_fast_malloc(const size_t size)
int cob_cmp_uint(cob_field *f1, const unsigned int n)
void cob_decimal_init(cob_decimal *d)
static const unsigned char packed_bytes[]
static cob_decimal * cob_decimal_base
#define COB_TYPE_NUMERIC_FP_DEC128
int cob_decimal_get_field(cob_decimal *d, cob_field *f, const int opt)
void cob_decimal_push(const cob_u32_t params,...)
void cob_print_realbin(const cob_field *f, FILE *fp, const int size)
void cob_decimal_set_llint(cob_decimal *d, const cob_s64_t n)
#define COB_FIELD_DIGITS(f)
#define COB_128_IS_SPECIAL(x)
strict implicit external call params
static cob_decimal cob_d1
static COB_INLINE COB_A_INLINE cob_u64_t cob_binary_get_uint64(const cob_field *const f)
#define COB_BSWAP_64(val)
void cob_print_ieeedec(const cob_field *f, FILE *fp)
static COB_INLINE COB_A_INLINE cob_s64_t cob_binary_get_sint64(const cob_field *const f)
#define COB_FIELD_SIZE(f)
#define COB_128_IS_EXTEND(x)
static int cob_decimal_get_display(cob_decimal *d, cob_field *f, const int opt)
static void cob_decimal_set_ieee128dec(cob_decimal *d, const cob_field *f)
void cob_div_remainder(cob_field *fld_remainder, const int opt)