]> granicus.if.org Git - postgresql/commitdiff
Added lots of SoC stuff made by Joachim.
authorMichael Meskes <meskes@postgresql.org>
Tue, 15 Aug 2006 06:40:20 +0000 (06:40 +0000)
committerMichael Meskes <meskes@postgresql.org>
Tue, 15 Aug 2006 06:40:20 +0000 (06:40 +0000)
Fixed broken newline on Windows.
Fixed a nasty buffer underrun that only occured when using Informix
no_indicator NULL setting on timestamps and intervals.

15 files changed:
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/ecpg/include/pgtypes_error.h
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/numeric.c
src/interfaces/ecpg/pgtypeslib/timestamp.c
src/interfaces/ecpg/preproc/output.c
src/interfaces/ecpg/test/compat_informix/Makefile
src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr
src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout
src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc

index a5e1d56a5f6540319b162749773b271ab1e3246d..bf1e305a8abf24e6e6e74f57108b18a239de7890 100644 (file)
@@ -2082,5 +2082,18 @@ We Aug  9 09:28:56 CEST 2006
        - Fixed error handling in numeric conversion (Joachim).
        - Fixed some memory bugs that somehow reappeared.
        - Also fixed a new Coverity report.
+
+Su Aug 13 11:01:13 CEST 2006
+
+       - Applied patch for VPATH builds by Alvaro Herrera
+         <alvherre@commandprompt.com>
+       - Merged dyntest.pgc and dyntest2.pgc.
+
+Mo Aug 14 10:39:59 CEST 2006
+
+       - Added lots of SoC stuff made by Joachim.
+       - Fixed broken newline on Windows.
+       - Fixed a nasty buffer underrun that only occured when using Informix
+         no_indicator NULL setting on timestamps and intervals.
        - Set ecpg library version to 5.2.
        - Set ecpg version to 4.2.1.
index 65da37dcdee3ee1cf5958fa0710b1f1d282a0d10..a8a95f4e437f33507091e57dc515a28c30b649f4 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.46 2006/06/26 09:20:09 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.47 2006/08/15 06:40:19 meskes Exp $ */
 
 #include <stdlib.h>
 #include <string.h>
@@ -122,12 +122,15 @@ deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, n
 int
 decadd(decimal *arg1, decimal *arg2, decimal *sum)
 {
+       errno = 0;
        deccall3(arg1, arg2, sum, PGTYPESnumeric_add);
 
        if (errno == PGTYPES_NUM_OVERFLOW)
                return ECPG_INFORMIX_NUM_OVERFLOW;
-       else if (errno != 0)
+       else if (errno == PGTYPES_NUM_UNDERFLOW)
                return ECPG_INFORMIX_NUM_UNDERFLOW;
+       else if (errno != 0)
+               return -1;
        else
                return 0;
 }
@@ -179,6 +182,7 @@ deccvasc(char *cp, int len, decimal *np)
                ret = ECPG_INFORMIX_NUM_UNDERFLOW;
        else
        {
+               errno = 0;
                result = PGTYPESnumeric_from_asc(str, NULL);
                if (!result)
                {
@@ -280,6 +284,7 @@ decdiv(decimal *n1, decimal *n2, decimal *result)
 
        int                     i;
 
+       errno = 0;
        i = deccall3(n1, n2, result, PGTYPESnumeric_div);
 
        if (i != 0)
@@ -304,6 +309,7 @@ decmul(decimal *n1, decimal *n2, decimal *result)
 {
        int                     i;
 
+       errno = 0;
        i = deccall3(n1, n2, result, PGTYPESnumeric_mul);
 
        if (i != 0)
@@ -325,6 +331,7 @@ decsub(decimal *n1, decimal *n2, decimal *result)
 {
        int                     i;
 
+       errno = 0;
        i = deccall3(n1, n2, result, PGTYPESnumeric_sub);
 
        if (i != 0)
@@ -371,13 +378,25 @@ dectoasc(decimal *np, char *cp, int len, int right)
                return -1;
 
        /*
-        * TODO: have to take care of len here and create exponatial notion if
-        * necessary
+        * TODO: have to take care of len here and create exponential notation
+        * if necessary
         */
-       strncpy(cp, str, len);
-       free(str);
-
-       return 0;
+       if ((int) (strlen(str) + 1) > len)
+       {
+               if (len > 1)
+               {
+                       cp[0] = '*';
+                       cp[1] = '\0';
+               }
+               free(str);
+               return -1;
+       }
+       else
+       {
+               strcpy(cp, str);
+               free(str);
+               return 0;
+       }
 }
 
 int
@@ -474,59 +493,7 @@ rdatestr(date d, char *str)
 int
 rstrdate(char *str, date * d)
 {
-       date            dat;
-       char            strbuf[10];
-       int                     i,
-                               j;
-
-       rsetnull(CDATETYPE, (char *) &dat);
-
-       /*
-        * we have to flip the year month date around for postgres expects
-        * yyyymmdd
-        *
-        */
-
-       for (i = 0, j = 0; i < 10; i++)
-       {
-               /* ignore non-digits */
-               if (isdigit((unsigned char) str[i]))
-               {
-
-                       /* j only increments if it is a digit */
-                       switch (j)
-                       {
-                                       /* stick the month into the 4th, 5th position */
-                               case 0:
-                               case 1:
-                                       strbuf[j + 4] = str[i];
-                                       break;
-                                       /* stick the day into the 6th, and 7th position */
-                               case 2:
-                               case 3:
-                                       strbuf[j + 4] = str[i];
-                                       break;
-
-                                       /* stick the year into the first 4 positions */
-                               case 4:
-                               case 5:
-                               case 6:
-                               case 7:
-                                       strbuf[j - 4] = str[i];
-                                       break;
-
-                       }
-                       j++;
-               }
-       }
-       strbuf[8] = '\0';
-       dat = PGTYPESdate_from_asc(strbuf, NULL);
-
-       if (errno && errno != PGTYPES_DATE_BAD_DATE)
-               return ECPG_INFORMIX_BAD_DATE;
-
-       *d = dat;
-       return 0;
+       return rdefmtdate(d, "mm/dd/yyyy", str);
 }
 
 void
@@ -554,6 +521,7 @@ rdefmtdate(date * d, char *fmt, char *str)
        /* TODO: take care of DBCENTURY environment variable */
        /* PGSQL functions allow all centuries */
 
+       errno = 0;
        if (PGTYPESdate_defmt_asc(d, fmt, str) == 0)
                return 0;
 
@@ -576,6 +544,7 @@ rdefmtdate(date * d, char *fmt, char *str)
 int
 rfmtdate(date d, char *fmt, char *str)
 {
+       errno = 0;
        if (PGTYPESdate_fmt_asc(d, fmt, str) == 0)
                return 0;
 
@@ -618,15 +587,18 @@ dtcvasc(char *str, timestamp * ts)
        int                     i;
        char      **endptr = &str;
 
+       errno = 0;
        ts_tmp = PGTYPEStimestamp_from_asc(str, endptr);
        i = errno;
        if (i)
+               /* TODO: rewrite to Informix error codes */
                return i;
        if (**endptr)
        {
                /* extra characters exist at the end */
                return ECPG_INFORMIX_EXTRA_CHARS;
        }
+       /* TODO: other Informix error codes missing */
 
        /* everything went fine */
        *ts = ts_tmp;
@@ -634,6 +606,12 @@ dtcvasc(char *str, timestamp * ts)
        return 0;
 }
 
+int
+dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue)
+{
+       return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue);
+}
+
 int
 dtsub(timestamp * ts1, timestamp * ts2, interval * iv)
 {
@@ -659,6 +637,7 @@ dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr)
 int
 intoasc(interval * i, char *str)
 {
+       errno = 0;
        str = PGTYPESinterval_to_asc(i);
 
        if (!str)
@@ -797,17 +776,21 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
                /* qualify, where we are in the value_string */
                if (k < 0)
                {
-                       if (leftalign)
-                       {
-                               /* can't use strncat(,,0) here, Solaris would freek out */
-                               temp[j] = '\0';
-                               break;
-                       }
                        blank = 1;
                        if (k == -2)
                                entity = 1;
                        else if (k == -1)
                                sign = 1;
+                       if (leftalign)
+                       {
+                               /* can't use strncat(,,0) here, Solaris would freek out */
+                               if (sign)
+                                       if (signdone)
+                                       {
+                                               temp[j] = '\0';
+                                               break;
+                                       }
+                       }
                }
                /* if we're right side of the right-most dot, print '0' */
                if (dotpos >= 0 && dotpos <= i)
@@ -829,6 +812,9 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
                        fmtchar = lastfmt;
                else
                        fmtchar = fmt[i];
+               /* waiting for the sign */
+               if (k < 0 && leftalign && sign && !signdone && fmtchar != '+' && fmtchar != '-')
+                       continue;
                /* analyse this format-char */
                switch (fmtchar)
                {
@@ -854,9 +840,6 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
                                else
                                        tmp[0] = value.val_string[k];
                                break;
-                       case '<':
-                               tmp[0] = value.val_string[k];
-                               break;
                        case '-':
                                if (sign && value.sign == '-' && !signdone)
                                {
@@ -904,6 +887,9 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
                                else
                                        tmp[0] = value.val_string[k];
                                break;
+                       case '<':
+                               tmp[0] = value.val_string[k];
+                               break;
                        default:
                                tmp[0] = fmt[i];
                }
@@ -950,8 +936,9 @@ byleng(char *str, int len)
 void
 ldchar(char *src, int len, char *dest)
 {
-       memmove(dest, src, len);
-       dest[len] = 0;
+       int dlen = byleng(src, len);
+       memmove(dest, src, dlen);
+       dest[dlen] = '\0';
 }
 
 int
@@ -978,12 +965,6 @@ rtypwidth(int sqltype, int sqllen)
        return 0;
 }
 
-int
-dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue)
-{
-       return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue);
-}
-
 static struct var_list
 {
        int                     number;
index 6ef383a9d402d138d91f08bae2346029d11ce966..3c84cfd4f75ebcdf5f789381d0eb5eb4154e52ad 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.30 2006/08/08 11:51:24 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.31 2006/08/15 06:40:19 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -346,8 +346,8 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
 static bool
 _check(unsigned char *ptr, int length)
 {
-       for (; ptr[--length] == 0xff && length >= 0; length--);
-       if (length < 0)
+       for (; length > 0 && ptr[--length] == 0xff;);
+       if (length <= 0)
                return true;
        return false;
 }
index ad0824f0fd14ec63d9cb0ae743f34c6c005412de..f82a59f22b5ba04b07fb6094af3d46af7165159a 100644 (file)
@@ -1,8 +1,9 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_error.h,v 1.7 2006/03/11 04:38:39 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_error.h,v 1.8 2006/08/15 06:40:19 meskes Exp $ */
 
 #define PGTYPES_NUM_OVERFLOW           301
 #define PGTYPES_NUM_BAD_NUMERIC                302
 #define PGTYPES_NUM_DIVIDE_ZERO                303
+#define PGTYPES_NUM_UNDERFLOW          304
 
 #define PGTYPES_DATE_BAD_DATE          310
 #define PGTYPES_DATE_ERR_EARGS         311
index 5f1ea802954154aa0f23b20251320c9bb6a79981..095209a4fcb89d73826f723755b99bc403d8a999 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.29 2006/06/21 10:24:41 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.30 2006/08/15 06:40:19 meskes Exp $ */
 
 #include "postgres_fe.h"
 
@@ -230,7 +230,7 @@ PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf)
                                        replace_type = PGTYPES_TYPE_UINT_4_LZ;
                                        break;
                                case PGTYPES_FMTDATE_YEAR_DIGITS_SHORT:
-                                       replace_val.uint_val = tm.tm_year % 1000;
+                                       replace_val.uint_val = tm.tm_year % 100;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
                                default:
@@ -537,7 +537,7 @@ PGTYPESdate_defmt_asc(date * d, char *fmt, char *str)
                 * matches
                 */
                free(str_copy);
-               errno = PGTYPES_DATE_ERR_ENOTDMY;
+               errno = PGTYPES_DATE_ERR_ENOSHORTDATE;
                return -1;
        }
 
index 3c52db39d9e48eb8cda40f5c11cb35e80e387502..c462d21673bfab109f1d52404521627af0382a72 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.31 2006/08/13 10:18:30 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.32 2006/08/15 06:40:19 meskes Exp $ */
 
 #include "postgres_fe.h"
 #include <ctype.h>
@@ -1512,7 +1512,10 @@ numericvar_to_double(numeric *var, double *dp)
        if (errno == ERANGE)
        {
                free(tmp);
-               errno = PGTYPES_NUM_OVERFLOW;
+               if (val == 0)
+                       errno = PGTYPES_NUM_UNDERFLOW;
+               else
+                       errno = PGTYPES_NUM_OVERFLOW;
                return -1;
        }
 
@@ -1576,7 +1579,10 @@ PGTYPESnumeric_to_long(numeric *nv, long *lp)
                return -1;
        if (errno == ERANGE)
        {
-               errno = PGTYPES_NUM_OVERFLOW;
+               if (*lp == LONG_MIN)
+                       errno = PGTYPES_NUM_UNDERFLOW;
+               else
+                       errno = PGTYPES_NUM_OVERFLOW;
                return -1;
        }
        free(s);
index f1af271e3ad514587ac11da76f83ff1e7e1e6cb3..d7011243857c1364339f4cd14271d67e92e82460 100644 (file)
@@ -423,34 +423,47 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                        replace_type = PGTYPES_TYPE_NOTHING;
                        switch (*p)
                        {
+                               /* the abbreviated name of the day in the week */
+                               /* XXX should be locale aware */
                                case 'a':
                                        replace_val.str_val = pgtypes_date_weekdays_short[dow];
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* the full name of the day in the week */
+                               /* XXX should be locale aware */
                                case 'A':
                                        replace_val.str_val = days[dow];
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* the abbreviated name of the month */
+                               /* XXX should be locale aware */
                                case 'b':
                                case 'h':
                                        replace_val.str_val = months[tm->tm_mon];
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* the full name name of the month */
+                               /* XXX should be locale aware */
                                case 'B':
                                        replace_val.str_val = pgtypes_date_months[tm->tm_mon];
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* The  preferred  date  and  time  representation  for the
+                                * current locale. */
                                case 'c':
                                        /* XXX */
                                        break;
+                               /* the century number with leading zeroes */
                                case 'C':
                                        replace_val.uint_val = tm->tm_year / 100;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* day with leading zeroes (01 - 31) */
                                case 'd':
                                        replace_val.uint_val = tm->tm_mday;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* the date in the format mm/dd/yy */
                                case 'D':
 
                                        /*
@@ -467,10 +480,14 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        if (i)
                                                return i;
                                        break;
+                               /* day with leading spaces (01 - 31) */
                                case 'e':
                                        replace_val.uint_val = tm->tm_mday;
                                        replace_type = PGTYPES_TYPE_UINT_2_LS;
                                        break;
+                               /*
+                                * alternative format modifier
+                                */
                                case 'E':
                                        {
                                                char            tmp[4] = "%Ex";
@@ -496,6 +513,10 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                                replace_type = PGTYPES_TYPE_NOTHING;
                                                break;
                                        }
+                               /*
+                                * The ISO 8601 year with century as a decimal number. The
+                                * 4-digit year corresponding to the ISO week number.
+                                */
                                case 'G':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%G", tm);
@@ -509,6 +530,10 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /*
+                                * Like %G, but without century, i.e., with a 2-digit year
+                                * (00-99).
+                                */
                                case 'g':
                                        {
                                                char       *fmt = "%g"; /* Keep compiler quiet about
@@ -527,38 +552,57 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                                replace_type = PGTYPES_TYPE_NOTHING;
                                        }
                                        break;
+                               /* hour (24 hour clock) with leading zeroes */
                                case 'H':
                                        replace_val.uint_val = tm->tm_hour;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* hour (12 hour clock) with leading zeroes */
                                case 'I':
                                        replace_val.uint_val = tm->tm_hour % 12;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /*
+                                * The day of the year as a decimal number with leading zeroes.
+                                * It ranges from 001 to 366.
+                                */
                                case 'j':
                                        replace_val.uint_val = tm->tm_yday;
                                        replace_type = PGTYPES_TYPE_UINT_3_LZ;
                                        break;
+                               /*
+                                * The hour (24 hour clock). Leading zeroes will be turned into
+                                * spaces.
+                                */
                                case 'k':
                                        replace_val.uint_val = tm->tm_hour;
                                        replace_type = PGTYPES_TYPE_UINT_2_LS;
                                        break;
+                               /*
+                                * The hour (12 hour clock). Leading zeroes will be turned into
+                                * spaces.
+                                */
                                case 'l':
                                        replace_val.uint_val = tm->tm_hour % 12;
                                        replace_type = PGTYPES_TYPE_UINT_2_LS;
                                        break;
+                               /* The month as a decimal number with a leading zero */
                                case 'm':
                                        replace_val.uint_val = tm->tm_mon;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* The minute as a decimal number with a leading zero */
                                case 'M':
                                        replace_val.uint_val = tm->tm_min;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* A newline character */
                                case 'n':
                                        replace_val.char_val = '\n';
                                        replace_type = PGTYPES_TYPE_CHAR;
                                        break;
+                               /* the AM/PM specifier (uppercase) */
+                               /* XXX should be locale aware */
                                case 'p':
                                        if (tm->tm_hour < 12)
                                                replace_val.str_val = "AM";
@@ -566,6 +610,8 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                                replace_val.str_val = "PM";
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* the AM/PM specifier (lowercase) */
+                               /* XXX should be locale aware */
                                case 'P':
                                        if (tm->tm_hour < 12)
                                                replace_val.str_val = "am";
@@ -573,6 +619,8 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                                replace_val.str_val = "pm";
                                        replace_type = PGTYPES_TYPE_STRING_CONSTANT;
                                        break;
+                               /* the time in the format %I:%M:%S %p */
+                               /* XXX should be locale aware */
                                case 'r':
                                        i = dttofmtasc_replace(ts, dDate, dow, tm,
                                                                                   q, pstr_len,
@@ -580,6 +628,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        if (i)
                                                return i;
                                        break;
+                               /* The time in 24 hour notation (%H:%M) */
                                case 'R':
                                        i = dttofmtasc_replace(ts, dDate, dow, tm,
                                                                                   q, pstr_len,
@@ -587,6 +636,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        if (i)
                                                return i;
                                        break;
+                               /* The number of seconds since the Epoch (1970-01-01) */
                                case 's':
 #ifdef HAVE_INT64_TIMESTAMP
                                        replace_val.int64_val = (*ts - SetEpochTimestamp()) / 1000000.0;
@@ -596,14 +646,17 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        replace_type = PGTYPES_TYPE_DOUBLE_NF;
 #endif
                                        break;
+                               /* seconds as a decimal number with leading zeroes */
                                case 'S':
                                        replace_val.uint_val = tm->tm_sec;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* A tabulator */
                                case 't':
                                        replace_val.char_val = '\t';
                                        replace_type = PGTYPES_TYPE_CHAR;
                                        break;
+                               /* The time in 24 hour notation (%H:%M:%S) */
                                case 'T':
                                        i = dttofmtasc_replace(ts, dDate, dow, tm,
                                                                                   q, pstr_len,
@@ -611,12 +664,14 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        if (i)
                                                return i;
                                        break;
+                               /* The day of the week as a decimal, Monday = 1, Sunday = 7 */
                                case 'u':
-                                       if (dow == 0)
-                                               dow = 7;
                                        replace_val.uint_val = dow;
+                                       if (replace_val.uint_val == 0)
+                                               replace_val.uint_val = 7;
                                        replace_type = PGTYPES_TYPE_UINT;
                                        break;
+                               /* The week number of the year as a decimal number */
                                case 'U':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%U", tm);
@@ -630,6 +685,10 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /*
+                                * The ISO 8601:1988 week number of the current year as a
+                                * decimal number.
+                                */
                                case 'V':
                                        i = strftime(q, *pstr_len, "%V", tm);
                                        if (i == 0)
@@ -641,10 +700,15 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        }
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /*
+                                * The day of the week as a decimal, Sunday being 0 and
+                                * Monday 1.
+                                */
                                case 'w':
                                        replace_val.uint_val = dow;
                                        replace_type = PGTYPES_TYPE_UINT;
                                        break;
+                               /* The week number of the year (another definition) */
                                case 'W':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%U", tm);
@@ -658,6 +722,10 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /*
+                                * The preferred date representation for the current locale
+                                * without the time.
+                                */
                                case 'x':
                                        {
                                                char       *fmt = "%x"; /* Keep compiler quiet about
@@ -676,6 +744,10 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                                replace_type = PGTYPES_TYPE_NOTHING;
                                        }
                                        break;
+                               /*
+                                * The preferred time representation for the current locale
+                                * without the date.
+                                */
                                case 'X':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%X", tm);
@@ -689,14 +761,17 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /* The year without the century (2 digits, leading zeroes) */
                                case 'y':
                                        replace_val.uint_val = tm->tm_year % 100;
                                        replace_type = PGTYPES_TYPE_UINT_2_LZ;
                                        break;
+                               /* The year with the century (4 digits) */
                                case 'Y':
                                        replace_val.uint_val = tm->tm_year;
                                        replace_type = PGTYPES_TYPE_UINT;
                                        break;
+                               /* The time zone offset from GMT */
                                case 'z':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%z", tm);
@@ -710,6 +785,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /* The name or abbreviation of the time zone */
                                case 'Z':
                                        tm->tm_mon -= 1;
                                        i = strftime(q, *pstr_len, "%Z", tm);
@@ -723,19 +799,18 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
                                        tm->tm_mon += 1;
                                        replace_type = PGTYPES_TYPE_NOTHING;
                                        break;
+                               /* A % sign */
                                case '%':
                                        replace_val.char_val = '%';
                                        replace_type = PGTYPES_TYPE_CHAR;
                                        break;
                                case '\0':
-                                       /* fmtstr: blabla%' */
-
+                                       /* fmtstr: foo%' - The string ends with a % sign */
                                        /*
                                         * this is not compliant to the specification
                                         */
                                        return -1;
                                default:
-
                                        /*
                                         * if we don't know the pattern, we just copy it
                                         */
index e251d7e1459a6951b8caa70f6bf23a27312e4f99..910d1750a4c6d527d2cf0615ac2ad618f7788491 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.17 2006/03/11 04:38:40 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.18 2006/08/15 06:40:19 meskes Exp $ */
 
 #include "postgres_fe.h"
 
@@ -139,6 +139,11 @@ output_escaped_str(char *str)
                        fputs("\\\"", yyout);
                else if (str[i] == '\n')
                        fputs("\\\n", yyout);
+               else if (str[i] == '\r' && str[i+1] == '\n')
+               {
+                       fputs("\\\r\n", yyout);
+                       i++;
+               }
                else
                        fputc(str[i], yyout);
        }
index 0c8a1612f388b8e025710a8ab816c3a717dda20f..970bd65ef14aeb8bb16927f2c9c77c56bd2c5872 100644 (file)
@@ -10,7 +10,11 @@ override LDFLAGS += -L../../compatlib
 override LIBS += $(LIBS) -lecpg_compat
 
 TESTS = test_informix test_informix.c \
-        test_informix2 test_informix2.c
+        test_informix2 test_informix2.c \
+        dec_test dec_test.c \
+        rfmtdate rfmtdate.c \
+        rfmtlong rfmtlong.c \
+        charfuncs charfuncs.c
 
 all: $(TESTS)
 
@@ -18,5 +22,19 @@ test_informix.c: test_informix.pgc ../regression.h
        $(ECPG) -o $@ -I$(srcdir) $<
 
 test_informix2.c: test_informix2.pgc ../regression.h
+       $(ECPG) -o $@ -I$(srcdir) $<
+
+dec_test.c: dec_test.pgc ../regression.h
+       $(ECPG) -o $@ -I$(srcdir) $<
+
+rfmtdate.c: rfmtdate.pgc ../regression.h
+       $(ECPG) -o $@ -I$(srcdir) $<
+
+rfmtlong.c: rfmtlong.pgc ../regression.h
+       $(ECPG) -o $@ -I$(srcdir) $<
+
+rnull.c: rnull.pgc ../regression.h
        $(ECPG_NOIND) -o $@ -I$(srcdir) $<
 
+charfuncs.c: charfuncs.pgc ../regression.h
+       $(ECPG) -o $@ -I$(srcdir) $<
index 4c72c42017888c2a2b30fc643645b7eaa2b6ceb3..386dbb47775fb16322f909f34e6f1d4b49214770 100644 (file)
@@ -59,10 +59,6 @@ int main(void)
 
        ECPGdebug(1, stderr);
 
-/*     if (strlen(REGRESSDB1) > MAXDBLEN) {
-               exit(1);
-       }
-*/
        strcpy(dbname, "regress1");
        EXEC SQL connect to :dbname;
        sql_check("main", "connect", 0);
@@ -80,12 +76,6 @@ int main(void)
                   from history;
        sql_check("main", "select max", 100);
 
-       if (risnull(CDTIMETYPE, (char *) &maxd))
-       {
-               printf("Nothing on the history table\n\n");
-               exit(0);
-       }
-
        EXEC SQL select customerid, timestamp
                   into :c, :d
                   from history
index 54b9b67db025a7335684efc3f8efeaaa15e8583e..d795bcfd54c7dfcd1b98913cbbdd35bf7b17a4fe 100644 (file)
@@ -170,62 +170,52 @@ int main(void)
 
        ECPGdebug(1, stderr);
 
-/*     if (strlen(REGRESSDB1) > MAXDBLEN) {
-               exit(1);
-       }
-*/
        strcpy(dbname, "regress1");
        { ECPGconnect(__LINE__, 1, dbname , NULL,NULL , NULL, 0); 
-#line 67 "test_informix2.pgc"
+#line 63 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 67 "test_informix2.pgc"
+#line 63 "test_informix2.pgc"
 
        sql_check("main", "connect", 0);
 
-       { ECPGdo(__LINE__, 1, 0, NULL, "create  table history ( customerid integer   , timestamp timestamp without time zone   , action_taken char  ( 5 )    , narrative varchar ( 100 )    )    ", ECPGt_EOIT, ECPGt_EORT);
-#line 70 "test_informix2.pgc"
+       { ECPGdo(__LINE__, 1, 1, NULL, "create  table history ( customerid integer   , timestamp timestamp without time zone   , action_taken char  ( 5 )    , narrative varchar ( 100 )    )    ", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 70 "test_informix2.pgc"
+#line 66 "test_informix2.pgc"
 
        sql_check("main", "create", 0);
        
-       { ECPGdo(__LINE__, 1, 0, NULL, "insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' )", ECPGt_EOIT, ECPGt_EORT);
-#line 75 "test_informix2.pgc"
+       { ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' )", ECPGt_EOIT, ECPGt_EORT);
+#line 71 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 75 "test_informix2.pgc"
+#line 71 "test_informix2.pgc"
 
        sql_check("main", "insert", 0);
 
-       { ECPGdo(__LINE__, 1, 0, NULL, "select  max ( timestamp )  from history   ", ECPGt_EOIT, 
+       { ECPGdo(__LINE__, 1, 1, NULL, "select  max ( timestamp )  from history   ", ECPGt_EOIT, 
        ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 80 "test_informix2.pgc"
+#line 76 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 80 "test_informix2.pgc"
+#line 76 "test_informix2.pgc"
 
        sql_check("main", "select max", 100);
 
-       if (risnull(CDTIMETYPE, (char *) &maxd))
-       {
-               printf("Nothing on the history table\n\n");
-               exit(0);
-       }
-
-       { ECPGdo(__LINE__, 1, 0, NULL, "select  customerid , timestamp  from history where timestamp =  ?    limit 1 ", 
+       { ECPGdo(__LINE__, 1, 1, NULL, "select  customerid , timestamp  from history where timestamp =  ?    limit 1 ", 
        ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, 
        ECPGt_int,&(c),(long)1,(long)1,sizeof(int), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
        ECPGt_timestamp,&(d),(long)1,(long)1,sizeof(timestamp), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 93 "test_informix2.pgc"
+#line 83 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 93 "test_informix2.pgc"
+#line 83 "test_informix2.pgc"
 
        sql_check("main", "select", 0);
 
@@ -236,45 +226,45 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
        c++;
 
-       { ECPGdo(__LINE__, 1, 0, NULL, "insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values(  ? ,  ? , 'test' , 'test' )", 
+       { ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values(  ? ,  ? , 'test' , 'test' )", 
        ECPGt_int,&(c),(long)1,(long)1,sizeof(int), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
        ECPGt_timestamp,&(e),(long)1,(long)1,sizeof(timestamp), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 105 "test_informix2.pgc"
+#line 95 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 105 "test_informix2.pgc"
+#line 95 "test_informix2.pgc"
 
        sql_check("main", "update", 0);
   
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 108 "test_informix2.pgc"
+#line 98 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 108 "test_informix2.pgc"
+#line 98 "test_informix2.pgc"
 
 
-       { ECPGdo(__LINE__, 1, 0, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
-#line 110 "test_informix2.pgc"
+       { ECPGdo(__LINE__, 1, 1, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
+#line 100 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 110 "test_informix2.pgc"
+#line 100 "test_informix2.pgc"
 
        sql_check("main", "drop", 0);
 
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 113 "test_informix2.pgc"
+#line 103 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 113 "test_informix2.pgc"
+#line 103 "test_informix2.pgc"
 
 
        { ECPGdisconnect(__LINE__, "CURRENT");
-#line 115 "test_informix2.pgc"
+#line 105 "test_informix2.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
-#line 115 "test_informix2.pgc"
+#line 105 "test_informix2.pgc"
 
        sql_check("main", "disconnect", 0);
 
index ff06b18629a8cb1e005f9b1a43e37babb1d90e43..a0b6299ac54276b569a3bc5ced677ce98c03ca2a 100644 (file)
@@ -2,39 +2,39 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 70: QUERY: create  table history ( customerid integer   , timestamp timestamp without time zone   , action_taken char  ( 5 )    , narrative varchar ( 100 )    )     on connection regress1
+[NO_PID]: ECPGexecute line 66: QUERY: create  table history ( customerid integer   , timestamp timestamp without time zone   , action_taken char  ( 5 )    , narrative varchar ( 100 )    )     on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 70 Ok: CREATE TABLE
+[NO_PID]: ECPGexecute line 66 Ok: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 73: QUERY: insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) on connection regress1
+[NO_PID]: ECPGexecute line 69: QUERY: insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 73 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 69 Ok: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 78: QUERY: select  max ( timestamp )  from history    on connection regress1
+[NO_PID]: ECPGexecute line 74: QUERY: select  max ( timestamp )  from history    on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 78: Correctly got 1 tuples with 1 fields
+[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 78: RESULT: Wed May 07 13:28:34 2003 offset: -1 array: Yes
+[NO_PID]: ECPGget_data line 74: RESULT: Wed May 07 13:28:34 2003 offset: -1 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 89: QUERY: select  customerid , timestamp  from history where timestamp =  timestamp '2003-05-07 13:28:34'    limit 1  on connection regress1
+[NO_PID]: ECPGexecute line 79: QUERY: select  customerid , timestamp  from history where timestamp =  timestamp '2003-05-07 13:28:34'    limit 1  on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 89: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 79: Correctly got 1 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 89: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: ECPGget_data line 79: RESULT: 1 offset: -1 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 89: RESULT: Wed May 07 13:28:34 2003 offset: -1 array: Yes
+[NO_PID]: ECPGget_data line 79: RESULT: Wed May 07 13:28:34 2003 offset: -1 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 103: QUERY: insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values(  2 ,  timestamp '2003-05-08 15:53:39' , 'test' , 'test' ) on connection regress1
+[NO_PID]: ECPGexecute line 93: QUERY: insert into history ( customerid  , timestamp  , action_taken  , narrative  ) values(  2 ,  timestamp '2003-05-08 15:53:39' , 'test' , 'test' ) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 103 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 93 Ok: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 108 action = commit connection = regress1
+[NO_PID]: ECPGtrans line 98 action = commit connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 110: QUERY: drop table history  on connection regress1
+[NO_PID]: ECPGexecute line 100: QUERY: drop table history  on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 110 Ok: DROP TABLE
+[NO_PID]: ECPGexecute line 100 Ok: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 113 action = commit connection = regress1
+[NO_PID]: ECPGtrans line 103 action = commit connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: Connection regress1 closed.
 [NO_PID]: sqlca: code: 0, state: 00000
index 935d2a48326ee0e24caafacea52365ad3cee9c72..6fa54a4c2502476a2be2cb693f0910e79bc953c8 100644 (file)
@@ -31,6 +31,7 @@ char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
                                                                       into decimal */
                                 "1234567890123456789012345678.921", /* 31 digits should NOT
                                                                        fit into decimal */
+                                "not a number",
                                 NULL};
 
 
@@ -45,46 +46,52 @@ main(void)
        numeric *num, *nin;
        decimal *dec;
        long l;
-       int i, q, r, k;
+       int i, j, k, q, r, count = 0;
        double d;
+       numeric **numarr = (numeric **) malloc(1);
 
        ECPGdebug(1, stderr);
 
        for (i = 0; nums[i]; i++)
        {
                num = PGTYPESnumeric_from_asc(nums[i], &endptr);
-               check_errno();
+               if (!num) check_errno();
                if (endptr != NULL)
                {
                        printf("endptr of %d is not NULL\n", i);
                        if (*endptr != '\0')
                                printf("*endptr of %d is not \\0\n", i);
                }
+               if (!num) continue;
+
+               numarr = realloc(numarr, sizeof(numeric *) * (count + 1));
+               numarr[count++] = num;
+
                text = PGTYPESnumeric_to_asc(num, -1);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,1]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 0);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,2]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 1);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,3]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 2);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,4]: %s\n", i, text); free(text);
 
                nin = PGTYPESnumeric_new();
                text = PGTYPESnumeric_to_asc(nin, 2);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,5]: %s\n", i, text); free(text);
 
                r = PGTYPESnumeric_to_long(num, &l);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_long(l, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,7]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -92,12 +99,12 @@ main(void)
                }
 
                r = PGTYPESnumeric_to_int(num, &k);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_int(k, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,9]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -105,12 +112,12 @@ main(void)
                }
 
                r = PGTYPESnumeric_to_double(num, &d);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,10]: %2.7f (r: %d)\n", i, r?0.0:d, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_double(d, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,11]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -119,14 +126,14 @@ main(void)
 
                dec = PGTYPESdecimal_new();
                r = PGTYPESnumeric_to_decimal(num, dec);
-               check_errno();
+               if (r) check_errno();
                /* we have no special routine for outputting decimal, it would
                 * convert to a numeric anyway */
                printf("num[%d,12]: - (r: %d)\n", i, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_decimal(dec, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,13]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -138,6 +145,72 @@ main(void)
                printf("\n");
        }
 
+       for (i = 0; i < count; i++)
+       {
+               for (j = 0; j < count; j++)
+               {
+                       numeric* a = PGTYPESnumeric_new();
+                       numeric* s = PGTYPESnumeric_new();
+                       numeric* m = PGTYPESnumeric_new();
+                       numeric* d = PGTYPESnumeric_new();
+                       r = PGTYPESnumeric_add(numarr[i], numarr[j], a);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(a, 10);
+                               printf("num[a,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_sub(numarr[i], numarr[j], s);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(s, 10);
+                               printf("num[s,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_mul(numarr[i], numarr[j], m);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(m, 10);
+                               printf("num[m,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_div(numarr[i], numarr[j], d);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(d, 10);
+                               printf("num[d,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+               }
+       }
+
+       for (i = 0; i < count; i++)
+       {
+               text = PGTYPESnumeric_to_asc(numarr[i], -1);
+               printf("%d: %s\n", i, text);
+               free(text);
+       }
+
        return (0);
 }
 
@@ -152,9 +225,15 @@ check_errno(void)
                case PGTYPES_NUM_OVERFLOW:
                        printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
                        break;
+               case PGTYPES_NUM_UNDERFLOW:
+                       printf("(errno == PGTYPES_NUM_UNDERFLOW) - ");
+                       break;
                case PGTYPES_NUM_BAD_NUMERIC:
                        printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
                        break;
+               case PGTYPES_NUM_DIVIDE_ZERO:
+                       printf("(errno == PGTYPES_NUM_DIVIDE_ZERO) - ");
+                       break;
                default:
                        printf("(unknown errno (%d))\n", errno);
                        printf("(libc: (%s)) ", strerror(errno));
index 92bb5ef2f79d0ec376bee8d0ef26812aba27c307..84a054808c87fbcb8eac11a678f413e1816607dd 100644 (file)
-(no errno set) - endptr of 0 is not NULL
-(no errno set) - num[0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-(no errno set) - num[0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-(no errno set) - num[0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0
-(no errno set) - num[0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
-(no errno set) - num[0,5]: 0.00
+endptr of 0 is not NULL
+num[0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+num[0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+num[0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0
+num[0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
+num[0,5]: 0.00
 (errno == PGTYPES_NUM_OVERFLOW) - num[0,6]: 0 (r: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[0,8]: 0 (r: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[0,10]: 0.0000000 (r: -1)
-(errno == PGTYPES_NUM_OVERFLOW) - num[0,12]: - (r: 0)
-(errno == PGTYPES_NUM_OVERFLOW) - num[0,13]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 (r: 0 - cmp: 0)
+num[0,12]: - (r: 0)
+num[0,13]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 1 is not NULL
-(no errno set) - num[1,1]: -2
-(no errno set) - num[1,2]: -2
-(no errno set) - num[1,3]: -2.0
-(no errno set) - num[1,4]: -2.00
-(no errno set) - num[1,5]: 0.00
-(no errno set) - num[1,6]: -2 (r: 0)
-(no errno set) - num[1,7]: -2.00 (r: 0 - cmp: 0)
-(no errno set) - num[1,8]: -2 (r: 0)
-(no errno set) - num[1,9]: -2.00 (r: 0 - cmp: 0)
-(no errno set) - num[1,10]: -2.0000000 (r: 0)
-(no errno set) - num[1,11]: -2.00 (r: 0 - cmp: 0)
-(no errno set) - num[1,12]: - (r: 0)
-(no errno set) - num[1,13]: -2.00 (r: 0 - cmp: 0)
+endptr of 1 is not NULL
+num[1,1]: -2
+num[1,2]: -2
+num[1,3]: -2.0
+num[1,4]: -2.00
+num[1,5]: 0.00
+num[1,6]: -2 (r: 0)
+num[1,7]: -2.00 (r: 0 - cmp: 0)
+num[1,8]: -2 (r: 0)
+num[1,9]: -2.00 (r: 0 - cmp: 0)
+num[1,10]: -2.0000000 (r: 0)
+num[1,11]: -2.00 (r: 0 - cmp: 0)
+num[1,12]: - (r: 0)
+num[1,13]: -2.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 2 is not NULL
-(no errno set) - num[2,1]: 0.794
-(no errno set) - num[2,2]: 1
-(no errno set) - num[2,3]: 0.8
-(no errno set) - num[2,4]: 0.79
-(no errno set) - num[2,5]: 0.00
-(no errno set) - num[2,6]: 1 (r: 0)
-(no errno set) - num[2,7]: 1.00 (r: 0 - cmp: -1)
-(no errno set) - num[2,8]: 1 (r: 0)
-(no errno set) - num[2,9]: 1.00 (r: 0 - cmp: -1)
-(no errno set) - num[2,10]: 0.7940000 (r: 0)
-(no errno set) - num[2,11]: 0.79 (r: 0 - cmp: 0)
-(no errno set) - num[2,12]: - (r: 0)
-(no errno set) - num[2,13]: 0.79 (r: 0 - cmp: 0)
+endptr of 2 is not NULL
+num[2,1]: 0.794
+num[2,2]: 1
+num[2,3]: 0.8
+num[2,4]: 0.79
+num[2,5]: 0.00
+num[2,6]: 1 (r: 0)
+num[2,7]: 1.00 (r: 0 - cmp: -1)
+num[2,8]: 1 (r: 0)
+num[2,9]: 1.00 (r: 0 - cmp: -1)
+num[2,10]: 0.7940000 (r: 0)
+num[2,11]: 0.79 (r: 0 - cmp: 0)
+num[2,12]: - (r: 0)
+num[2,13]: 0.79 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 3 is not NULL
-(no errno set) - num[3,1]: 3.44
-(no errno set) - num[3,2]: 3
-(no errno set) - num[3,3]: 3.4
-(no errno set) - num[3,4]: 3.44
-(no errno set) - num[3,5]: 0.00
-(no errno set) - num[3,6]: 3 (r: 0)
-(no errno set) - num[3,7]: 3.00 (r: 0 - cmp: 1)
-(no errno set) - num[3,8]: 3 (r: 0)
-(no errno set) - num[3,9]: 3.00 (r: 0 - cmp: 1)
-(no errno set) - num[3,10]: 3.4400000 (r: 0)
-(no errno set) - num[3,11]: 3.44 (r: 0 - cmp: 0)
-(no errno set) - num[3,12]: - (r: 0)
-(no errno set) - num[3,13]: 3.44 (r: 0 - cmp: 0)
+endptr of 3 is not NULL
+num[3,1]: 3.44
+num[3,2]: 3
+num[3,3]: 3.4
+num[3,4]: 3.44
+num[3,5]: 0.00
+num[3,6]: 3 (r: 0)
+num[3,7]: 3.00 (r: 0 - cmp: 1)
+num[3,8]: 3 (r: 0)
+num[3,9]: 3.00 (r: 0 - cmp: 1)
+num[3,10]: 3.4400000 (r: 0)
+num[3,11]: 3.44 (r: 0 - cmp: 0)
+num[3,12]: - (r: 0)
+num[3,13]: 3.44 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 4 is not NULL
-(no errno set) - num[4,1]: 592490000000000000000000
-(no errno set) - num[4,2]: 592490000000000000000000
-(no errno set) - num[4,3]: 592490000000000000000000.0
-(no errno set) - num[4,4]: 592490000000000000000000.00
-(no errno set) - num[4,5]: 0.00
+endptr of 4 is not NULL
+num[4,1]: 592490000000000000000000
+num[4,2]: 592490000000000000000000
+num[4,3]: 592490000000000000000000.0
+num[4,4]: 592490000000000000000000.00
+num[4,5]: 0.00
 (errno == PGTYPES_NUM_OVERFLOW) - num[4,6]: 0 (r: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[4,8]: 0 (r: -1)
-(no errno set) - num[4,10]: 592490000000000009961472.0000000 (r: 0)
-(no errno set) - num[4,11]: 592490000000000009961472.00 (r: 0 - cmp: -1)
-(no errno set) - num[4,12]: - (r: 0)
-(no errno set) - num[4,13]: 592490000000000000000000.00 (r: 0 - cmp: 0)
+num[4,10]: 592490000000000009961472.0000000 (r: 0)
+num[4,11]: 592490000000000009961472.00 (r: 0 - cmp: -1)
+num[4,12]: - (r: 0)
+num[4,13]: 592490000000000000000000.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 5 is not NULL
-(no errno set) - num[5,1]: -328400
-(no errno set) - num[5,2]: -328400
-(no errno set) - num[5,3]: -328400.0
-(no errno set) - num[5,4]: -328400.00
-(no errno set) - num[5,5]: 0.00
-(no errno set) - num[5,6]: -328400 (r: 0)
-(no errno set) - num[5,7]: -328400.00 (r: 0 - cmp: 0)
-(no errno set) - num[5,8]: -328400 (r: 0)
-(no errno set) - num[5,9]: -328400.00 (r: 0 - cmp: 0)
-(no errno set) - num[5,10]: -328400.0000000 (r: 0)
-(no errno set) - num[5,11]: -328400.00 (r: 0 - cmp: 0)
-(no errno set) - num[5,12]: - (r: 0)
-(no errno set) - num[5,13]: -328400.00 (r: 0 - cmp: 0)
+endptr of 5 is not NULL
+num[5,1]: -328400
+num[5,2]: -328400
+num[5,3]: -328400.0
+num[5,4]: -328400.00
+num[5,5]: 0.00
+num[5,6]: -328400 (r: 0)
+num[5,7]: -328400.00 (r: 0 - cmp: 0)
+num[5,8]: -328400 (r: 0)
+num[5,9]: -328400.00 (r: 0 - cmp: 0)
+num[5,10]: -328400.0000000 (r: 0)
+num[5,11]: -328400.00 (r: 0 - cmp: 0)
+num[5,12]: - (r: 0)
+num[5,13]: -328400.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 6 is not NULL
-(no errno set) - num[6,1]: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
-(no errno set) - num[6,2]: 0
-(no errno set) - num[6,3]: 0.0
-(no errno set) - num[6,4]: 0.00
-(no errno set) - num[6,5]: 0.00
-(no errno set) - num[6,6]: 0 (r: 0)
-(no errno set) - num[6,7]: 0.00 (r: 0 - cmp: 1)
-(no errno set) - num[6,8]: 0 (r: 0)
-(no errno set) - num[6,9]: 0.00 (r: 0 - cmp: 1)
-(errno == PGTYPES_NUM_OVERFLOW) - num[6,10]: 0.0000000 (r: -1)
-(errno == PGTYPES_NUM_OVERFLOW) - num[6,12]: - (r: 0)
-(errno == PGTYPES_NUM_OVERFLOW) - num[6,13]: 0.00 (r: 0 - cmp: 0)
+endptr of 6 is not NULL
+num[6,1]: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
+num[6,2]: 0
+num[6,3]: 0.0
+num[6,4]: 0.00
+num[6,5]: 0.00
+num[6,6]: 0 (r: 0)
+num[6,7]: 0.00 (r: 0 - cmp: 1)
+num[6,8]: 0 (r: 0)
+num[6,9]: 0.00 (r: 0 - cmp: 1)
+(errno == PGTYPES_NUM_UNDERFLOW) - num[6,10]: 0.0000000 (r: -1)
+num[6,12]: - (r: 0)
+num[6,13]: 0.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 7 is not NULL
-(no errno set) - num[7,1]: 0.001
-(no errno set) - num[7,2]: 0
-(no errno set) - num[7,3]: 0.0
-(no errno set) - num[7,4]: 0.00
-(no errno set) - num[7,5]: 0.00
-(no errno set) - num[7,6]: 0 (r: 0)
-(no errno set) - num[7,7]: 0.00 (r: 0 - cmp: 1)
-(no errno set) - num[7,8]: 0 (r: 0)
-(no errno set) - num[7,9]: 0.00 (r: 0 - cmp: 1)
-(no errno set) - num[7,10]: 0.0010000 (r: 0)
-(no errno set) - num[7,11]: 0.00 (r: 0 - cmp: 0)
-(no errno set) - num[7,12]: - (r: 0)
-(no errno set) - num[7,13]: 0.00 (r: 0 - cmp: 0)
+endptr of 7 is not NULL
+num[7,1]: 0.001
+num[7,2]: 0
+num[7,3]: 0.0
+num[7,4]: 0.00
+num[7,5]: 0.00
+num[7,6]: 0 (r: 0)
+num[7,7]: 0.00 (r: 0 - cmp: 1)
+num[7,8]: 0 (r: 0)
+num[7,9]: 0.00 (r: 0 - cmp: 1)
+num[7,10]: 0.0010000 (r: 0)
+num[7,11]: 0.00 (r: 0 - cmp: 0)
+num[7,12]: - (r: 0)
+num[7,13]: 0.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 8 is not NULL
-(no errno set) - num[8,1]: 0.0
-(no errno set) - num[8,2]: 0
-(no errno set) - num[8,3]: 0.0
-(no errno set) - num[8,4]: 0.00
-(no errno set) - num[8,5]: 0.00
-(no errno set) - num[8,6]: 0 (r: 0)
-(no errno set) - num[8,7]: 0.00 (r: 0 - cmp: 0)
-(no errno set) - num[8,8]: 0 (r: 0)
-(no errno set) - num[8,9]: 0.00 (r: 0 - cmp: 0)
-(no errno set) - num[8,10]: 0.0000000 (r: 0)
-(no errno set) - num[8,11]: 0.00 (r: 0 - cmp: 0)
-(no errno set) - num[8,12]: - (r: 0)
-(no errno set) - num[8,13]: 0.00 (r: 0 - cmp: 0)
+endptr of 8 is not NULL
+num[8,1]: 0.0
+num[8,2]: 0
+num[8,3]: 0.0
+num[8,4]: 0.00
+num[8,5]: 0.00
+num[8,6]: 0 (r: 0)
+num[8,7]: 0.00 (r: 0 - cmp: 0)
+num[8,8]: 0 (r: 0)
+num[8,9]: 0.00 (r: 0 - cmp: 0)
+num[8,10]: 0.0000000 (r: 0)
+num[8,11]: 0.00 (r: 0 - cmp: 0)
+num[8,12]: - (r: 0)
+num[8,13]: 0.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 9 is not NULL
-(no errno set) - num[9,1]: -0.000059249
-(no errno set) - num[9,2]: -0
-(no errno set) - num[9,3]: -0.0
-(no errno set) - num[9,4]: -0.00
-(no errno set) - num[9,5]: 0.00
-(no errno set) - num[9,6]: 0 (r: 0)
-(no errno set) - num[9,7]: 0.00 (r: 0 - cmp: -1)
-(no errno set) - num[9,8]: 0 (r: 0)
-(no errno set) - num[9,9]: 0.00 (r: 0 - cmp: -1)
-(no errno set) - num[9,10]: -0.0000592 (r: 0)
-(no errno set) - num[9,11]: -0.00 (r: 0 - cmp: -1)
-(no errno set) - num[9,12]: - (r: 0)
-(no errno set) - num[9,13]: -0.00 (r: 0 - cmp: 0)
+endptr of 9 is not NULL
+num[9,1]: -0.000059249
+num[9,2]: -0
+num[9,3]: -0.0
+num[9,4]: -0.00
+num[9,5]: 0.00
+num[9,6]: 0 (r: 0)
+num[9,7]: 0.00 (r: 0 - cmp: -1)
+num[9,8]: 0 (r: 0)
+num[9,9]: 0.00 (r: 0 - cmp: -1)
+num[9,10]: -0.0000592 (r: 0)
+num[9,11]: -0.00 (r: 0 - cmp: -1)
+num[9,12]: - (r: 0)
+num[9,13]: -0.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 10 is not NULL
-(no errno set) - num[10,1]: 0.003284
-(no errno set) - num[10,2]: 0
-(no errno set) - num[10,3]: 0.0
-(no errno set) - num[10,4]: 0.00
-(no errno set) - num[10,5]: 0.00
-(no errno set) - num[10,6]: 0 (r: 0)
-(no errno set) - num[10,7]: 0.00 (r: 0 - cmp: 1)
-(no errno set) - num[10,8]: 0 (r: 0)
-(no errno set) - num[10,9]: 0.00 (r: 0 - cmp: 1)
-(no errno set) - num[10,10]: 0.0032840 (r: 0)
-(no errno set) - num[10,11]: 0.00 (r: 0 - cmp: 0)
-(no errno set) - num[10,12]: - (r: 0)
-(no errno set) - num[10,13]: 0.00 (r: 0 - cmp: 0)
+endptr of 10 is not NULL
+num[10,1]: 0.003284
+num[10,2]: 0
+num[10,3]: 0.0
+num[10,4]: 0.00
+num[10,5]: 0.00
+num[10,6]: 0 (r: 0)
+num[10,7]: 0.00 (r: 0 - cmp: 1)
+num[10,8]: 0 (r: 0)
+num[10,9]: 0.00 (r: 0 - cmp: 1)
+num[10,10]: 0.0032840 (r: 0)
+num[10,11]: 0.00 (r: 0 - cmp: 0)
+num[10,12]: - (r: 0)
+num[10,13]: 0.00 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 11 is not NULL
-(no errno set) - num[11,1]: 0.500001
-(no errno set) - num[11,2]: 1
-(no errno set) - num[11,3]: 0.5
-(no errno set) - num[11,4]: 0.50
-(no errno set) - num[11,5]: 0.00
-(no errno set) - num[11,6]: 1 (r: 0)
-(no errno set) - num[11,7]: 1.00 (r: 0 - cmp: -1)
-(no errno set) - num[11,8]: 1 (r: 0)
-(no errno set) - num[11,9]: 1.00 (r: 0 - cmp: -1)
-(no errno set) - num[11,10]: 0.5000010 (r: 0)
-(no errno set) - num[11,11]: 0.50 (r: 0 - cmp: 0)
-(no errno set) - num[11,12]: - (r: 0)
-(no errno set) - num[11,13]: 0.50 (r: 0 - cmp: 0)
+endptr of 11 is not NULL
+num[11,1]: 0.500001
+num[11,2]: 1
+num[11,3]: 0.5
+num[11,4]: 0.50
+num[11,5]: 0.00
+num[11,6]: 1 (r: 0)
+num[11,7]: 1.00 (r: 0 - cmp: -1)
+num[11,8]: 1 (r: 0)
+num[11,9]: 1.00 (r: 0 - cmp: -1)
+num[11,10]: 0.5000010 (r: 0)
+num[11,11]: 0.50 (r: 0 - cmp: 0)
+num[11,12]: - (r: 0)
+num[11,13]: 0.50 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 12 is not NULL
-(no errno set) - num[12,1]: -0.5000001
-(no errno set) - num[12,2]: -1
-(no errno set) - num[12,3]: -0.5
-(no errno set) - num[12,4]: -0.50
-(no errno set) - num[12,5]: 0.00
-(no errno set) - num[12,6]: -1 (r: 0)
-(no errno set) - num[12,7]: -1.00 (r: 0 - cmp: 1)
-(no errno set) - num[12,8]: -1 (r: 0)
-(no errno set) - num[12,9]: -1.00 (r: 0 - cmp: 1)
-(no errno set) - num[12,10]: -0.5000001 (r: 0)
-(no errno set) - num[12,11]: -0.50 (r: 0 - cmp: -1)
-(no errno set) - num[12,12]: - (r: 0)
-(no errno set) - num[12,13]: -0.50 (r: 0 - cmp: 0)
+endptr of 12 is not NULL
+num[12,1]: -0.5000001
+num[12,2]: -1
+num[12,3]: -0.5
+num[12,4]: -0.50
+num[12,5]: 0.00
+num[12,6]: -1 (r: 0)
+num[12,7]: -1.00 (r: 0 - cmp: 1)
+num[12,8]: -1 (r: 0)
+num[12,9]: -1.00 (r: 0 - cmp: 1)
+num[12,10]: -0.5000001 (r: 0)
+num[12,11]: -0.50 (r: 0 - cmp: -1)
+num[12,12]: - (r: 0)
+num[12,13]: -0.50 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 13 is not NULL
-(no errno set) - num[13,1]: 1234567890123456789012345678.91
-(no errno set) - num[13,2]: 1234567890123456789012345679
-(no errno set) - num[13,3]: 1234567890123456789012345678.9
-(no errno set) - num[13,4]: 1234567890123456789012345678.91
-(no errno set) - num[13,5]: 0.00
+endptr of 13 is not NULL
+num[13,1]: 1234567890123456789012345678.91
+num[13,2]: 1234567890123456789012345679
+num[13,3]: 1234567890123456789012345678.9
+num[13,4]: 1234567890123456789012345678.91
+num[13,5]: 0.00
 (errno == PGTYPES_NUM_OVERFLOW) - num[13,6]: 0 (r: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[13,8]: 0 (r: -1)
-(no errno set) - num[13,10]: 1234567890123456850245451776.0000000 (r: 0)
-(no errno set) - num[13,11]: 1234567890123456850245451776.00 (r: 0 - cmp: -1)
-(no errno set) - num[13,12]: - (r: 0)
-(no errno set) - num[13,13]: 1234567890123456789012345678.91 (r: 0 - cmp: 0)
+num[13,10]: 1234567890123456850245451776.0000000 (r: 0)
+num[13,11]: 1234567890123456850245451776.00 (r: 0 - cmp: -1)
+num[13,12]: - (r: 0)
+num[13,13]: 1234567890123456789012345678.91 (r: 0 - cmp: 0)
 
-(no errno set) - endptr of 14 is not NULL
-(no errno set) - num[14,1]: 1234567890123456789012345678.921
-(no errno set) - num[14,2]: 1234567890123456789012345679
-(no errno set) - num[14,3]: 1234567890123456789012345678.9
-(no errno set) - num[14,4]: 1234567890123456789012345678.92
-(no errno set) - num[14,5]: 0.00
+endptr of 14 is not NULL
+num[14,1]: 1234567890123456789012345678.921
+num[14,2]: 1234567890123456789012345679
+num[14,3]: 1234567890123456789012345678.9
+num[14,4]: 1234567890123456789012345678.92
+num[14,5]: 0.00
 (errno == PGTYPES_NUM_OVERFLOW) - num[14,6]: 0 (r: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[14,8]: 0 (r: -1)
-(no errno set) - num[14,10]: 1234567890123456850245451776.0000000 (r: 0)
-(no errno set) - num[14,11]: 1234567890123456850245451776.00 (r: 0 - cmp: -1)
+num[14,10]: 1234567890123456850245451776.0000000 (r: 0)
+num[14,11]: 1234567890123456850245451776.00 (r: 0 - cmp: -1)
 (errno == PGTYPES_NUM_OVERFLOW) - num[14,12]: - (r: -1)
 
+(errno == PGTYPES_NUM_BAD_NUMERIC) - endptr of 15 is not NULL
+*endptr of 15 is not \0
+num[a,0,0]: 40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,0]: 0.0000000000
+num[m,0,0]: 400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,0]: 1.0000000000
+num[a,0,1]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.0000000000
+num[s,0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002.0000000000
+num[m,0,1]: -40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,1]: -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.7940000000
+num[s,0,2]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.2060000000
+num[m,0,2]: 15880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,2]: 25188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670.0251889000
+num[a,0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003.4400000000
+num[s,0,3]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996.5600000000
+num[m,0,3]: 68800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,3]: 5813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093.0232560000
+num[a,0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000592490000000000000000000.0000000000
+num[s,0,4]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999407510000000000000000000.0000000000
+num[m,0,4]: 11849800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,4]: 33755843980489122179277287380377727894141673277186112845786426775135445323971712602744350115613765633175243464024709277793718037435230974362436496818511704838900234603115664399399145977147293625208864284629276443484278215666087191345001603402589073233303515671150567942074971729480666340360174855271818933652888656348630356630491653867575824064541173690695201606778173471.2822000000
+num[a,0,5]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999671600.0000000000
+num[s,0,5]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000328400.0000000000
+num[m,0,5]: -6568000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,5]: -60901339829476248477466504263093788063337393422655298416565164433617539585870889159561510353227771010962241169305724725943970767356881851400730816077953714981729598051157125456760048721071863580998781973203410475030450669914738124238733252131546894031668696711327649208282582216808769792935444579780755176613885505481120584652862362971985383678440925700365408038976857490864799025578562728.3800000000
+num[a,0,6]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,6]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,0,6]: 4.0000000000
+num[d,0,6]: 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0010000000
+num[s,0,7]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9990000000
+num[m,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,8]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,8]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,0,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,0,9]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9999407510
+num[s,0,9]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000592490
+num[m,0,9]: -1184980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,9]: -337558439804891221792772873803777278941416732771861128457864267751354453239717126027443501156137656331752434640247092777937180374352309743624364968185117048389002346031156643993991459771472936252088642846292764434842782156660871913450016034025890732333035156711505679420749717294806663403601748552718189336528886563486303566304916538675758240645411736906952016067781734712822157335988793059798477611.4364799406
+num[a,0,10]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0032840000
+num[s,0,10]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9967160000
+num[m,0,10]: 65680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,10]: 6090133982947624847746650426309378806333739342265529841656516443361753958587088915956151035322777101096224116930572472594397076735688185140073081607795371498172959805115712545676004872107186358099878197320341047503045066991473812423873325213154689403166869671132764920828258221680876979293544457978075517661388550548112058465286236297198538367844092570036540803897685749086479902557856272838002436.0535931790
+num[a,0,11]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000010000
+num[s,0,11]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999990000
+num[m,0,11]: 10000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,11]: 39999920000159999680000639998720002559994880010239979520040959918080163839672320655358689282621434757130485739028521942956114087771824456351087297825404349191301617396765206469587060825878348243303513392973214053571892856214287571424857150285699428601142797714404571190857618284763430473139053721892556214887570224859550280899438201123597752804494391011217977564044871910256179487641024717950564.0988718023
+num[a,0,12]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999999000
+num[s,0,12]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000001000
+num[m,0,12]: -10000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,12]: -39999992000001599999680000063999987200002559999488000102399979520004095999180800163839967232006553598689280262143947571210485757902848419430316113936777212644557471088505782298843540231291953741609251678149664370067125986574802685039462992107401578519684296063140787371842525631494873701025259794948041010391797921640415671916865616626876674624665075066984986603002679399464120107175978564804287.0391425922
+num[a,0,13]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9100000000
+num[s,0,13]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0900000000
+num[m,0,13]: 24691357802469135780246913578200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,13]: 16200000145800001326780012073583089868436639792144602011794432069173427871944627216535488452104037734402488812766825268543092076559937753306592463425498481952238394402210698594884666469792189859469175471551488967831431174229215285702844063565115973562205366453218447154498968406694142978268167639546201917272112583939026078314516169317627127550253962230423465305471042.6305370000
+num[a,0,14]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9210000000
+num[s,0,14]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0790000000
+num[m,0,14]: 24691357802469135780246913578420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,14]: 16200000145800001326780012073438747865838483756809679983855488190421495112429743605252505619668606245113387993074870449075163411519793685453399903975484793505772589916586682299621591493014451434717743879521702761509433606809200816287108380036339147553262638409152127519194255768451119299228069799803818551847328103399274511743550433402484767562070619244777160576307850.4589877000
+num[a,1,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.0000000000
+num[s,1,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002.0000000000
+num[m,1,0]: -40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,1,0]: -0.0000000000
+num[a,1,1]: -4.0000000000
+num[s,1,1]: 0.0000000000
+num[m,1,1]: 4.0000000000
+num[d,1,1]: 1.0000000000
+num[a,1,2]: -1.2060000000
+num[s,1,2]: -2.7940000000
+num[m,1,2]: -1.5880000000
+num[d,1,2]: -2.5188916877
+num[a,1,3]: 1.4400000000
+num[s,1,3]: -5.4400000000
+num[m,1,3]: -6.8800000000
+num[d,1,3]: -0.5813953488
+num[a,1,4]: 592489999999999999999998.0000000000
+num[s,1,4]: -592490000000000000000002.0000000000
+num[m,1,4]: -1184980000000000000000000.0000000000
+num[d,1,4]: -0.0000000000
+num[a,1,5]: -328402.0000000000
+num[s,1,5]: 328398.0000000000
+num[m,1,5]: 656800.0000000000
+num[d,1,5]: 0.0000060901
+num[a,1,6]: -2.0000000000
+num[s,1,6]: -2.0000000000
+num[m,1,6]: -0.0000000000
+num[d,1,6]: -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,1,7]: -1.9990000000
+num[s,1,7]: -2.0010000000
+num[m,1,7]: -0.0020000000
+num[d,1,7]: -2000.0000000000
+num[a,1,8]: -2.0000000000
+num[s,1,8]: -2.0000000000
+num[m,1,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,1,9]: -2.0000592490
+num[s,1,9]: -1.9999407510
+num[m,1,9]: 0.0001184980
+num[d,1,9]: 33755.8439804891
+num[a,1,10]: -1.9967160000
+num[s,1,10]: -2.0032840000
+num[m,1,10]: -0.0065680000
+num[d,1,10]: -609.0133982948
+num[a,1,11]: -1.4999990000
+num[s,1,11]: -2.5000010000
+num[m,1,11]: -1.0000020000
+num[d,1,11]: -3.9999920000
+num[a,1,12]: -2.5000001000
+num[s,1,12]: -1.4999999000
+num[m,1,12]: 1.0000002000
+num[d,1,12]: 3.9999992000
+num[a,1,13]: 1234567890123456789012345676.9100000000
+num[s,1,13]: -1234567890123456789012345680.9100000000
+num[m,1,13]: -2469135780246913578024691357.8200000000
+num[d,1,13]: -0.0000000000
+num[a,1,14]: 1234567890123456789012345676.9210000000
+num[s,1,14]: -1234567890123456789012345680.9210000000
+num[m,1,14]: -2469135780246913578024691357.8420000000
+num[d,1,14]: -0.0000000000
+num[a,2,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.7940000000
+num[s,2,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.2060000000
+num[m,2,0]: 15880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,2,0]: 0.0000000000
+num[a,2,1]: -1.2060000000
+num[s,2,1]: 2.7940000000
+num[m,2,1]: -1.5880000000
+num[d,2,1]: -0.3970000000
+num[a,2,2]: 1.5880000000
+num[s,2,2]: 0.0000000000
+num[m,2,2]: 0.6304360000
+num[d,2,2]: 1.0000000000
+num[a,2,3]: 4.2340000000
+num[s,2,3]: -2.6460000000
+num[m,2,3]: 2.7313600000
+num[d,2,3]: 0.2308139535
+num[a,2,4]: 592490000000000000000000.7940000000
+num[s,2,4]: -592489999999999999999999.2060000000
+num[m,2,4]: 470437060000000000000000.0000000000
+num[d,2,4]: 0.0000000000
+num[a,2,5]: -328399.2060000000
+num[s,2,5]: 328400.7940000000
+num[m,2,5]: -260749.6000000000
+num[d,2,5]: -0.0000024178
+num[a,2,6]: 0.7940000000
+num[s,2,6]: 0.7940000000
+num[m,2,6]: 0.0000000000
+num[d,2,6]: 3970000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,2,7]: 0.7950000000
+num[s,2,7]: 0.7930000000
+num[m,2,7]: 0.0007940000
+num[d,2,7]: 794.0000000000
+num[a,2,8]: 0.7940000000
+num[s,2,8]: 0.7940000000
+num[m,2,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,2,9]: 0.7939407510
+num[s,2,9]: 0.7940592490
+num[m,2,9]: -0.0000470437
+num[d,2,9]: -13401.0700602542
+num[a,2,10]: 0.7972840000
+num[s,2,10]: 0.7907160000
+num[m,2,10]: 0.0026074960
+num[d,2,10]: 241.7783191230
+num[a,2,11]: 1.2940010000
+num[s,2,11]: 0.2939990000
+num[m,2,11]: 0.3970007940
+num[d,2,11]: 1.5879968240
+num[a,2,12]: 0.2939999000
+num[s,2,12]: 1.2940001000
+num[m,2,12]: -0.3970000794
+num[d,2,12]: -1.5879996824
+num[a,2,13]: 1234567890123456789012345679.7040000000
+num[s,2,13]: -1234567890123456789012345678.1160000000
+num[m,2,13]: 980246904758024690475802469.0545400000
+num[d,2,13]: 0.0000000000
+num[a,2,14]: 1234567890123456789012345679.7150000000
+num[s,2,14]: -1234567890123456789012345678.1270000000
+num[m,2,14]: 980246904758024690475802469.0632740000
+num[d,2,14]: 0.0000000000
+num[a,3,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003.4400000000
+num[s,3,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996.5600000000
+num[m,3,0]: 68800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,3,0]: 0.0000000000
+num[a,3,1]: 1.4400000000
+num[s,3,1]: 5.4400000000
+num[m,3,1]: -6.8800000000
+num[d,3,1]: -1.7200000000
+num[a,3,2]: 4.2340000000
+num[s,3,2]: 2.6460000000
+num[m,3,2]: 2.7313600000
+num[d,3,2]: 4.3324937028
+num[a,3,3]: 6.8800000000
+num[s,3,3]: 0.0000000000
+num[m,3,3]: 11.8336000000
+num[d,3,3]: 1.0000000000
+num[a,3,4]: 592490000000000000000003.4400000000
+num[s,3,4]: -592489999999999999999996.5600000000
+num[m,3,4]: 2038165600000000000000000.0000000000
+num[d,3,4]: 0.0000000000
+num[a,3,5]: -328396.5600000000
+num[s,3,5]: 328403.4400000000
+num[m,3,5]: -1129696.0000000000
+num[d,3,5]: -0.0000104750
+num[a,3,6]: 3.4400000000
+num[s,3,6]: 3.4400000000
+num[m,3,6]: 0.0000000000
+num[d,3,6]: 17200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,3,7]: 3.4410000000
+num[s,3,7]: 3.4390000000
+num[m,3,7]: 0.0034400000
+num[d,3,7]: 3440.0000000000
+num[a,3,8]: 3.4400000000
+num[s,3,8]: 3.4400000000
+num[m,3,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,3,9]: 3.4399407510
+num[s,3,9]: 3.4400592490
+num[m,3,9]: -0.0002038166
+num[d,3,9]: -58060.0516464413
+num[a,3,10]: 3.4432840000
+num[s,3,10]: 3.4367160000
+num[m,3,10]: 0.0112969600
+num[d,3,10]: 1047.5030450670
+num[a,3,11]: 3.9400010000
+num[s,3,11]: 2.9399990000
+num[m,3,11]: 1.7200034400
+num[d,3,11]: 6.8799862400
+num[a,3,12]: 2.9399999000
+num[s,3,12]: 3.9400001000
+num[m,3,12]: -1.7200003440
+num[d,3,12]: -6.8799986240
+num[a,3,13]: 1234567890123456789012345682.3500000000
+num[s,3,13]: -1234567890123456789012345675.4700000000
+num[m,3,13]: 4246913542024691354202469135.4504000000
+num[d,3,13]: 0.0000000000
+num[a,3,14]: 1234567890123456789012345682.3610000000
+num[s,3,14]: -1234567890123456789012345675.4810000000
+num[m,3,14]: 4246913542024691354202469135.4882400000
+num[d,3,14]: 0.0000000000
+num[a,4,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000592490000000000000000000.0000000000
+num[s,4,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999407510000000000000000000.0000000000
+num[m,4,0]: 11849800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,4,0]: 0.0000000000
+num[a,4,1]: 592489999999999999999998.0000000000
+num[s,4,1]: 592490000000000000000002.0000000000
+num[m,4,1]: -1184980000000000000000000.0000000000
+num[d,4,1]: -296245000000000000000000.0000000000
+num[a,4,2]: 592490000000000000000000.7940000000
+num[s,4,2]: 592489999999999999999999.2060000000
+num[m,4,2]: 470437060000000000000000.0000000000
+num[d,4,2]: 746209068010075566750629.7229219000
+num[a,4,3]: 592490000000000000000003.4400000000
+num[s,4,3]: 592489999999999999999996.5600000000
+num[m,4,3]: 2038165600000000000000000.0000000000
+num[d,4,3]: 172235465116279069767441.8604650000
+num[a,4,4]: 1184980000000000000000000.0000000000
+num[s,4,4]: 0.0000000000
+num[m,4,4]: 351044400100000000000000000000000000000000000000.0000000000
+num[d,4,4]: 1.0000000000
+num[a,4,5]: 592489999999999999671600.0000000000
+num[s,4,5]: 592490000000000000328400.0000000000
+num[m,4,5]: -194573716000000000000000000000.0000000000
+num[d,4,5]: -1804171741778319123.0207000000
+num[a,4,6]: 592490000000000000000000.0000000000
+num[s,4,6]: 592490000000000000000000.0000000000
+num[m,4,6]: 0.0000000000
+num[d,4,6]: 2962450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,4,7]: 592490000000000000000000.0010000000
+num[s,4,7]: 592489999999999999999999.9990000000
+num[m,4,7]: 592490000000000000000.0000000000
+num[d,4,7]: 592490000000000000000000000.0000000000
+num[a,4,8]: 592490000000000000000000.0000000000
+num[s,4,8]: 592490000000000000000000.0000000000
+num[m,4,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,4,9]: 592489999999999999999999.9999407510
+num[s,4,9]: 592490000000000000000000.0000592490
+num[m,4,9]: -35104440010000000000.0000000000
+num[d,4,9]: -10000000000000000000000000000.0000000000
+num[a,4,10]: 592490000000000000000000.0032840000
+num[s,4,10]: 592489999999999999999999.9967160000
+num[m,4,10]: 1945737160000000000000.0000000000
+num[d,4,10]: 180417174177831912302070645.5542021924
+num[a,4,11]: 592490000000000000000000.5000010000
+num[s,4,11]: 592489999999999999999999.4999990000
+num[m,4,11]: 296245592490000000000000.0000000000
+num[d,4,11]: 1184977630044739910520178.9596420807
+num[a,4,12]: 592489999999999999999999.4999999000
+num[s,4,12]: 592490000000000000000000.5000001000
+num[m,4,12]: -296245059249000000000000.0000000000
+num[d,4,12]: -1184979763004047399190520.1618959676
+num[a,4,13]: 1235160380123456789012345678.9100000000
+num[s,4,13]: -1233975400123456789012345678.9100000000
+num[m,4,13]: 731469129219246912921924691297385900000000000000000.0000000000
+num[d,4,13]: 0.0004799169
+num[a,4,14]: 1235160380123456789012345678.9210000000
+num[s,4,14]: -1233975400123456789012345678.9210000000
+num[m,4,14]: 731469129219246912921924691303903290000000000000000.0000000000
+num[d,4,14]: 0.0004799169
+num[a,5,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999671600.0000000000
+num[s,5,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000328400.0000000000
+num[m,5,0]: -6568000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,5,0]: -0.0000000000
+num[a,5,1]: -328402.0000000000
+num[s,5,1]: -328398.0000000000
+num[m,5,1]: 656800.0000000000
+num[d,5,1]: 164200.0000000000
+num[a,5,2]: -328399.2060000000
+num[s,5,2]: -328400.7940000000
+num[m,5,2]: -260749.6000000000
+num[d,5,2]: -413602.0151133501
+num[a,5,3]: -328396.5600000000
+num[s,5,3]: -328403.4400000000
+num[m,5,3]: -1129696.0000000000
+num[d,5,3]: -95465.1162790698
+num[a,5,4]: 592489999999999999671600.0000000000
+num[s,5,4]: -592490000000000000328400.0000000000
+num[m,5,4]: -194573716000000000000000000000.0000000000
+num[d,5,4]: -0.0000000000
+num[a,5,5]: -656800.0000000000
+num[s,5,5]: 0.0000000000
+num[m,5,5]: 107846560000.0000000000
+num[d,5,5]: 1.0000000000
+num[a,5,6]: -328400.0000000000
+num[s,5,6]: -328400.0000000000
+num[m,5,6]: -0.0000000000
+num[d,5,6]: -1642000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,5,7]: -328399.9990000000
+num[s,5,7]: -328400.0010000000
+num[m,5,7]: -328.4000000000
+num[d,5,7]: -328400000.0000000000
+num[a,5,8]: -328400.0000000000
+num[s,5,8]: -328400.0000000000
+num[m,5,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,5,9]: -328400.0000592490
+num[s,5,9]: -328399.9999407510
+num[m,5,9]: 19.4573716000
+num[d,5,9]: 5542709581.5963138618
+num[a,5,10]: -328399.9967160000
+num[s,5,10]: -328400.0032840000
+num[m,5,10]: -1078.4656000000
+num[d,5,10]: -100000000.0000000000
+num[a,5,11]: -328399.4999990000
+num[s,5,11]: -328400.5000010000
+num[m,5,11]: -164200.3284000000
+num[d,5,11]: -656798.6864026272
+num[a,5,12]: -328400.5000001000
+num[s,5,12]: -328399.4999999000
+num[m,5,12]: 164200.0328400000
+num[d,5,12]: 656799.8686400263
+num[a,5,13]: 1234567890123456789012017278.9100000000
+num[s,5,13]: -1234567890123456789012674078.9100000000
+num[m,5,13]: -405432095116543209511654320954044.0000000000
+num[d,5,13]: -0.0000000000
+num[a,5,14]: 1234567890123456789012017278.9210000000
+num[s,5,14]: -1234567890123456789012674078.9210000000
+num[m,5,14]: -405432095116543209511654320957656.4000000000
+num[d,5,14]: -0.0000000000
+num[a,6,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,6,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,6,0]: 4.0000000000
+num[d,6,0]: 0.0000000000
+num[a,6,1]: -2.0000000000
+num[s,6,1]: 2.0000000000
+num[m,6,1]: -0.0000000000
+num[d,6,1]: -0.0000000000
+num[a,6,2]: 0.7940000000
+num[s,6,2]: -0.7940000000
+num[m,6,2]: 0.0000000000
+num[d,6,2]: 0.0000000000
+num[a,6,3]: 3.4400000000
+num[s,6,3]: -3.4400000000
+num[m,6,3]: 0.0000000000
+num[d,6,3]: 0.0000000000
+num[a,6,4]: 592490000000000000000000.0000000000
+num[s,6,4]: -592490000000000000000000.0000000000
+num[m,6,4]: 0.0000000000
+num[d,6,4]: 0.0000000000
+num[a,6,5]: -328400.0000000000
+num[s,6,5]: 328400.0000000000
+num[m,6,5]: -0.0000000000
+num[d,6,5]: -0.0000000000
+num[a,6,6]: 0.0000000000
+num[s,6,6]: 0.0000000000
+num[m,6,6]: 0.0000000000
+num[d,6,6]: 1.0000000000
+num[a,6,7]: 0.0010000000
+num[s,6,7]: -0.0010000000
+num[m,6,7]: 0.0000000000
+num[d,6,7]: 0.0000000000
+num[a,6,8]: 0.0000000000
+num[s,6,8]: 0.0000000000
+num[m,6,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,6,9]: -0.0000592490
+num[s,6,9]: 0.0000592490
+num[m,6,9]: -0.0000000000
+num[d,6,9]: -0.0000000000
+num[a,6,10]: 0.0032840000
+num[s,6,10]: -0.0032840000
+num[m,6,10]: 0.0000000000
+num[d,6,10]: 0.0000000000
+num[a,6,11]: 0.5000010000
+num[s,6,11]: -0.5000010000
+num[m,6,11]: 0.0000000000
+num[d,6,11]: 0.0000000000
+num[a,6,12]: -0.5000001000
+num[s,6,12]: 0.5000001000
+num[m,6,12]: -0.0000000000
+num[d,6,12]: -0.0000000000
+num[a,6,13]: 1234567890123456789012345678.9100000000
+num[s,6,13]: -1234567890123456789012345678.9100000000
+num[m,6,13]: 0.0000000000
+num[d,6,13]: 0.0000000000
+num[a,6,14]: 1234567890123456789012345678.9210000000
+num[s,6,14]: -1234567890123456789012345678.9210000000
+num[m,6,14]: 0.0000000000
+num[d,6,14]: 0.0000000000
+num[a,7,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0010000000
+num[s,7,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9990000000
+num[m,7,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,7,0]: 0.0000000000
+num[a,7,1]: -1.9990000000
+num[s,7,1]: 2.0010000000
+num[m,7,1]: -0.0020000000
+num[d,7,1]: -0.0005000000
+num[a,7,2]: 0.7950000000
+num[s,7,2]: -0.7930000000
+num[m,7,2]: 0.0007940000
+num[d,7,2]: 0.0012594458
+num[a,7,3]: 3.4410000000
+num[s,7,3]: -3.4390000000
+num[m,7,3]: 0.0034400000
+num[d,7,3]: 0.0002906977
+num[a,7,4]: 592490000000000000000000.0010000000
+num[s,7,4]: -592489999999999999999999.9990000000
+num[m,7,4]: 592490000000000000000.0000000000
+num[d,7,4]: 0.0000000000
+num[a,7,5]: -328399.9990000000
+num[s,7,5]: 328400.0010000000
+num[m,7,5]: -328.4000000000
+num[d,7,5]: -0.0000000030
+num[a,7,6]: 0.0010000000
+num[s,7,6]: 0.0010000000
+num[m,7,6]: 0.0000000000
+num[d,7,6]: 5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,7,7]: 0.0020000000
+num[s,7,7]: 0.0000000000
+num[m,7,7]: 0.0000010000
+num[d,7,7]: 1.0000000000
+num[a,7,8]: 0.0010000000
+num[s,7,8]: 0.0010000000
+num[m,7,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,7,9]: 0.0009407510
+num[s,7,9]: 0.0010592490
+num[m,7,9]: -0.0000000592
+num[d,7,9]: -16.8779219902
+num[a,7,10]: 0.0042840000
+num[s,7,10]: -0.0022840000
+num[m,7,10]: 0.0000032840
+num[d,7,10]: 0.3045066991
+num[a,7,11]: 0.5010010000
+num[s,7,11]: -0.4990010000
+num[m,7,11]: 0.0005000010
+num[d,7,11]: 0.0019999960
+num[a,7,12]: -0.4990001000
+num[s,7,12]: 0.5010001000
+num[m,7,12]: -0.0005000001
+num[d,7,12]: -0.0019999996
+num[a,7,13]: 1234567890123456789012345678.9110000000
+num[s,7,13]: -1234567890123456789012345678.9090000000
+num[m,7,13]: 1234567890123456789012345.6789100000
+num[d,7,13]: 0.0000000000
+num[a,7,14]: 1234567890123456789012345678.9220000000
+num[s,7,14]: -1234567890123456789012345678.9200000000
+num[m,7,14]: 1234567890123456789012345.6789210000
+num[d,7,14]: 0.0000000000
+num[a,8,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,8,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,8,0]: 0.0000000000
+num[d,8,0]: 0.0000000000
+num[a,8,1]: -2.0000000000
+num[s,8,1]: 2.0000000000
+num[m,8,1]: 0.0000000000
+num[d,8,1]: 0.0000000000
+num[a,8,2]: 0.7940000000
+num[s,8,2]: -0.7940000000
+num[m,8,2]: 0.0000000000
+num[d,8,2]: 0.0000000000
+num[a,8,3]: 3.4400000000
+num[s,8,3]: -3.4400000000
+num[m,8,3]: 0.0000000000
+num[d,8,3]: 0.0000000000
+num[a,8,4]: 592490000000000000000000.0000000000
+num[s,8,4]: -592490000000000000000000.0000000000
+num[m,8,4]: 0.0000000000
+num[d,8,4]: 0.0000000000
+num[a,8,5]: -328400.0000000000
+num[s,8,5]: 328400.0000000000
+num[m,8,5]: 0.0000000000
+num[d,8,5]: 0.0000000000
+num[a,8,6]: 0.0000000000
+num[s,8,6]: -0.0000000000
+num[m,8,6]: 0.0000000000
+num[d,8,6]: 0.0000000000
+num[a,8,7]: 0.0010000000
+num[s,8,7]: -0.0010000000
+num[m,8,7]: 0.0000000000
+num[d,8,7]: 0.0000000000
+num[a,8,8]: 0.0000000000
+num[s,8,8]: 0.0000000000
+num[m,8,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,8,9]: -0.0000592490
+num[s,8,9]: 0.0000592490
+num[m,8,9]: 0.0000000000
+num[d,8,9]: 0.0000000000
+num[a,8,10]: 0.0032840000
+num[s,8,10]: -0.0032840000
+num[m,8,10]: 0.0000000000
+num[d,8,10]: 0.0000000000
+num[a,8,11]: 0.5000010000
+num[s,8,11]: -0.5000010000
+num[m,8,11]: 0.0000000000
+num[d,8,11]: 0.0000000000
+num[a,8,12]: -0.5000001000
+num[s,8,12]: 0.5000001000
+num[m,8,12]: 0.0000000000
+num[d,8,12]: 0.0000000000
+num[a,8,13]: 1234567890123456789012345678.9100000000
+num[s,8,13]: -1234567890123456789012345678.9100000000
+num[m,8,13]: 0.0000000000
+num[d,8,13]: 0.0000000000
+num[a,8,14]: 1234567890123456789012345678.9210000000
+num[s,8,14]: -1234567890123456789012345678.9210000000
+num[m,8,14]: 0.0000000000
+num[d,8,14]: 0.0000000000
+num[a,9,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9999407510
+num[s,9,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000592490
+num[m,9,0]: -1184980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,9,0]: -0.0000000000
+num[a,9,1]: -2.0000592490
+num[s,9,1]: 1.9999407510
+num[m,9,1]: 0.0001184980
+num[d,9,1]: 0.0000296245
+num[a,9,2]: 0.7939407510
+num[s,9,2]: -0.7940592490
+num[m,9,2]: -0.0000470437
+num[d,9,2]: -0.0000746209
+num[a,9,3]: 3.4399407510
+num[s,9,3]: -3.4400592490
+num[m,9,3]: -0.0002038166
+num[d,9,3]: -0.0000172235
+num[a,9,4]: 592489999999999999999999.9999407510
+num[s,9,4]: -592490000000000000000000.0000592490
+num[m,9,4]: -35104440010000000000.0000000000
+num[d,9,4]: -0.0000000000
+num[a,9,5]: -328400.0000592490
+num[s,9,5]: 328399.9999407510
+num[m,9,5]: 19.4573716000
+num[d,9,5]: 0.0000000002
+num[a,9,6]: -0.0000592490
+num[s,9,6]: -0.0000592490
+num[m,9,6]: -0.0000000000
+num[d,9,6]: -296245000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,9,7]: 0.0009407510
+num[s,9,7]: -0.0010592490
+num[m,9,7]: -0.0000000592
+num[d,9,7]: -0.0592490000
+num[a,9,8]: -0.0000592490
+num[s,9,8]: -0.0000592490
+num[m,9,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,9,9]: -0.0001184980
+num[s,9,9]: 0.0000000000
+num[m,9,9]: 0.0000000035
+num[d,9,9]: 1.0000000000
+num[a,9,10]: 0.0032247510
+num[s,9,10]: -0.0033432490
+num[m,9,10]: -0.0000001946
+num[d,9,10]: -0.0180417174
+num[a,9,11]: 0.4999417510
+num[s,9,11]: -0.5000602490
+num[m,9,11]: -0.0000296246
+num[d,9,11]: -0.0001184978
+num[a,9,12]: -0.5000593490
+num[s,9,12]: 0.4999408510
+num[m,9,12]: 0.0000296245
+num[d,9,12]: 0.0001184980
+num[a,9,13]: 1234567890123456789012345678.9099407510
+num[s,9,13]: -1234567890123456789012345678.9100592490
+num[m,9,13]: -73146912921924691292192.4691297386
+num[d,9,13]: -0.0000000000
+num[a,9,14]: 1234567890123456789012345678.9209407510
+num[s,9,14]: -1234567890123456789012345678.9210592490
+num[m,9,14]: -73146912921924691292192.4691303903
+num[d,9,14]: -0.0000000000
+num[a,10,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0032840000
+num[s,10,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9967160000
+num[m,10,0]: 65680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,10,0]: 0.0000000000
+num[a,10,1]: -1.9967160000
+num[s,10,1]: 2.0032840000
+num[m,10,1]: -0.0065680000
+num[d,10,1]: -0.0016420000
+num[a,10,2]: 0.7972840000
+num[s,10,2]: -0.7907160000
+num[m,10,2]: 0.0026074960
+num[d,10,2]: 0.0041360202
+num[a,10,3]: 3.4432840000
+num[s,10,3]: -3.4367160000
+num[m,10,3]: 0.0112969600
+num[d,10,3]: 0.0009546512
+num[a,10,4]: 592490000000000000000000.0032840000
+num[s,10,4]: -592489999999999999999999.9967160000
+num[m,10,4]: 1945737160000000000000.0000000000
+num[d,10,4]: 0.0000000000
+num[a,10,5]: -328399.9967160000
+num[s,10,5]: 328400.0032840000
+num[m,10,5]: -1078.4656000000
+num[d,10,5]: -0.0000000100
+num[a,10,6]: 0.0032840000
+num[s,10,6]: 0.0032840000
+num[m,10,6]: 0.0000000000
+num[d,10,6]: 16420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,10,7]: 0.0042840000
+num[s,10,7]: 0.0022840000
+num[m,10,7]: 0.0000032840
+num[d,10,7]: 3.2840000000
+num[a,10,8]: 0.0032840000
+num[s,10,8]: 0.0032840000
+num[m,10,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,10,9]: 0.0032247510
+num[s,10,9]: 0.0033432490
+num[m,10,9]: -0.0000001946
+num[d,10,9]: -55.4270958160
+num[a,10,10]: 0.0065680000
+num[s,10,10]: 0.0000000000
+num[m,10,10]: 0.0000107847
+num[d,10,10]: 1.0000000000
+num[a,10,11]: 0.5032850000
+num[s,10,11]: -0.4967170000
+num[m,10,11]: 0.0016420033
+num[d,10,11]: 0.0065679869
+num[a,10,12]: -0.4967161000
+num[s,10,12]: 0.5032841000
+num[m,10,12]: -0.0016420003
+num[d,10,12]: -0.0065679987
+num[a,10,13]: 1234567890123456789012345678.9132840000
+num[s,10,13]: -1234567890123456789012345678.9067160000
+num[m,10,13]: 4054320951165432095116543.2095404400
+num[d,10,13]: 0.0000000000
+num[a,10,14]: 1234567890123456789012345678.9242840000
+num[s,10,14]: -1234567890123456789012345678.9177160000
+num[m,10,14]: 4054320951165432095116543.2095765640
+num[d,10,14]: 0.0000000000
+num[a,11,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000010000
+num[s,11,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999990000
+num[m,11,0]: 10000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,11,0]: 0.0000000000
+num[a,11,1]: -1.4999990000
+num[s,11,1]: 2.5000010000
+num[m,11,1]: -1.0000020000
+num[d,11,1]: -0.2500005000
+num[a,11,2]: 1.2940010000
+num[s,11,2]: -0.2939990000
+num[m,11,2]: 0.3970007940
+num[d,11,2]: 0.6297241814
+num[a,11,3]: 3.9400010000
+num[s,11,3]: -2.9399990000
+num[m,11,3]: 1.7200034400
+num[d,11,3]: 0.1453491279
+num[a,11,4]: 592490000000000000000000.5000010000
+num[s,11,4]: -592489999999999999999999.4999990000
+num[m,11,4]: 296245592490000000000000.0000000000
+num[d,11,4]: 0.0000000000
+num[a,11,5]: -328399.4999990000
+num[s,11,5]: 328400.5000010000
+num[m,11,5]: -164200.3284000000
+num[d,11,5]: -0.0000015225
+num[a,11,6]: 0.5000010000
+num[s,11,6]: 0.5000010000
+num[m,11,6]: 0.0000000000
+num[d,11,6]: 2500005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,11,7]: 0.5010010000
+num[s,11,7]: 0.4990010000
+num[m,11,7]: 0.0005000010
+num[d,11,7]: 500.0010000000
+num[a,11,8]: 0.5000010000
+num[s,11,8]: 0.5000010000
+num[m,11,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,11,9]: 0.4999417510
+num[s,11,9]: 0.5000602490
+num[m,11,9]: -0.0000296246
+num[d,11,9]: -8438.9778730443
+num[a,11,10]: 0.5032850000
+num[s,11,10]: 0.4967170000
+num[m,11,10]: 0.0016420033
+num[d,11,10]: 152.2536540804
+num[a,11,11]: 1.0000020000
+num[s,11,11]: 0.0000000000
+num[m,11,11]: 0.2500010000
+num[d,11,11]: 1.0000000000
+num[a,11,12]: 0.0000009000
+num[s,11,12]: 1.0000011000
+num[m,11,12]: -0.2500005500
+num[d,11,12]: -1.0000018000
+num[a,11,13]: 1234567890123456789012345679.4100010000
+num[s,11,13]: -1234567890123456789012345678.4099990000
+num[m,11,13]: 617285179629618517962961851.8006789100
+num[d,11,13]: 0.0000000000
+num[a,11,14]: 1234567890123456789012345679.4210010000
+num[s,11,14]: -1234567890123456789012345678.4209990000
+num[m,11,14]: 617285179629618517962961851.8061789210
+num[d,11,14]: 0.0000000000
+num[a,12,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999999000
+num[s,12,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000001000
+num[m,12,0]: -10000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,12,0]: -0.0000000000
+num[a,12,1]: -2.5000001000
+num[s,12,1]: 1.4999999000
+num[m,12,1]: 1.0000002000
+num[d,12,1]: 0.2500000500
+num[a,12,2]: 0.2939999000
+num[s,12,2]: -1.2940001000
+num[m,12,2]: -0.3970000794
+num[d,12,2]: -0.6297230479
+num[a,12,3]: 2.9399999000
+num[s,12,3]: -3.9400001000
+num[m,12,3]: -1.7200003440
+num[d,12,3]: -0.1453488663
+num[a,12,4]: 592489999999999999999999.4999999000
+num[s,12,4]: -592490000000000000000000.5000001000
+num[m,12,4]: -296245059249000000000000.0000000000
+num[d,12,4]: -0.0000000000
+num[a,12,5]: -328400.5000001000
+num[s,12,5]: 328399.4999999000
+num[m,12,5]: 164200.0328400000
+num[d,12,5]: 0.0000015225
+num[a,12,6]: -0.5000001000
+num[s,12,6]: -0.5000001000
+num[m,12,6]: -0.0000000000
+num[d,12,6]: -2500000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,12,7]: -0.4990001000
+num[s,12,7]: -0.5010001000
+num[m,12,7]: -0.0005000001
+num[d,12,7]: -500.0001000000
+num[a,12,8]: -0.5000001000
+num[s,12,8]: -0.5000001000
+num[m,12,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,12,9]: -0.5000593490
+num[s,12,9]: -0.4999408510
+num[m,12,9]: 0.0000296245
+num[d,12,9]: 8438.9626829145
+num[a,12,10]: -0.4967161000
+num[s,12,10]: -0.5032841000
+num[m,12,10]: -0.0016420003
+num[d,12,10]: -152.2533800244
+num[a,12,11]: 0.0000009000
+num[s,12,11]: -1.0000011000
+num[m,12,11]: -0.2500005500
+num[d,12,11]: -0.9999982000
+num[a,12,12]: -1.0000002000
+num[s,12,12]: 0.0000000000
+num[m,12,12]: 0.2500001000
+num[d,12,12]: 1.0000000000
+num[a,12,13]: 1234567890123456789012345678.4099999000
+num[s,12,13]: -1234567890123456789012345679.4100001000
+num[m,12,13]: -617284068518517406851851740.6895678910
+num[d,12,13]: -0.0000000000
+num[a,12,14]: 1234567890123456789012345678.4209999000
+num[s,12,14]: -1234567890123456789012345679.4210001000
+num[m,12,14]: -617284068518517406851851740.6950678921
+num[d,12,14]: -0.0000000000
+num[a,13,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9100000000
+num[s,13,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0900000000
+num[m,13,0]: 24691357802469135780246913578200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,13,0]: 0.0000000000
+num[a,13,1]: 1234567890123456789012345676.9100000000
+num[s,13,1]: 1234567890123456789012345680.9100000000
+num[m,13,1]: -2469135780246913578024691357.8200000000
+num[d,13,1]: -617283945061728394506172839.4550000000
+num[a,13,2]: 1234567890123456789012345679.7040000000
+num[s,13,2]: 1234567890123456789012345678.1160000000
+num[m,13,2]: 980246904758024690475802469.0545400000
+num[d,13,2]: 1554871398140373789688092794.5969773000
+num[a,13,3]: 1234567890123456789012345682.3500000000
+num[s,13,3]: 1234567890123456789012345675.4700000000
+num[m,13,3]: 4246913542024691354202469135.4504000000
+num[d,13,3]: 358886014570772322387309790.3808140000
+num[a,13,4]: 1235160380123456789012345678.9100000000
+num[s,13,4]: 1233975400123456789012345678.9100000000
+num[m,13,4]: 731469129219246912921924691297385900000000000000000.0000000000
+num[d,13,4]: 2083.6940541165
+num[a,13,5]: 1234567890123456789012017278.9100000000
+num[s,13,5]: 1234567890123456789012674078.9100000000
+num[m,13,5]: -405432095116543209511654320954044.0000000000
+num[d,13,5]: -3759341930948406787491.9174140000
+num[a,13,6]: 1234567890123456789012345678.9100000000
+num[s,13,6]: 1234567890123456789012345678.9100000000
+num[m,13,6]: 0.0000000000
+num[d,13,6]: 6172839450617283945061728394550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,13,7]: 1234567890123456789012345678.9110000000
+num[s,13,7]: 1234567890123456789012345678.9090000000
+num[m,13,7]: 1234567890123456789012345.6789100000
+num[d,13,7]: 1234567890123456789012345678910.0000000000
+num[a,13,8]: 1234567890123456789012345678.9100000000
+num[s,13,8]: 1234567890123456789012345678.9100000000
+num[m,13,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,13,9]: 1234567890123456789012345678.9099407510
+num[s,13,9]: 1234567890123456789012345678.9100592490
+num[m,13,9]: -73146912921924691292192.4691297386
+num[d,13,9]: -20836940541164522422527733445458.9950885247
+num[a,13,10]: 1234567890123456789012345678.9132840000
+num[s,13,10]: 1234567890123456789012345678.9067160000
+num[m,13,10]: 4054320951165432095116543.2095404400
+num[d,13,10]: 375934193094840678749191741446.4068209501
+num[a,13,11]: 1234567890123456789012345679.4100010000
+num[s,13,11]: 1234567890123456789012345678.4099990000
+num[m,13,11]: 617285179629618517962961851.8006789100
+num[d,13,11]: 2469130841985229607565476226.8675462649
+num[a,13,12]: 1234567890123456789012345678.4099999000
+num[s,13,12]: 1234567890123456789012345679.4100001000
+num[m,13,12]: -617284068518517406851851740.6895678910
+num[d,13,12]: -2469135286419856294053432547.1334905733
+num[a,13,13]: 2469135780246913578024691357.8200000000
+num[s,13,13]: 0.0000000000
+num[m,13,13]: 1524157875323883675049535156278311236552659655767748818.7881000000
+num[d,13,13]: 1.0000000000
+num[a,13,14]: 2469135780246913578024691357.8310000000
+num[s,13,14]: -0.0110000000
+num[m,13,14]: 1524157875323883675049535156291891483344017680446884621.2561100000
+num[d,13,14]: 1.0000000000
+num[a,14,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9210000000
+num[s,14,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0790000000
+num[m,14,0]: 24691357802469135780246913578420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,14,0]: 0.0000000000
+num[a,14,1]: 1234567890123456789012345676.9210000000
+num[s,14,1]: 1234567890123456789012345680.9210000000
+num[m,14,1]: -2469135780246913578024691357.8420000000
+num[d,14,1]: -617283945061728394506172839.4605000000
+num[a,14,2]: 1234567890123456789012345679.7150000000
+num[s,14,2]: 1234567890123456789012345678.1270000000
+num[m,14,2]: 980246904758024690475802469.0632740000
+num[d,14,2]: 1554871398140373789688092794.6108312000
+num[a,14,3]: 1234567890123456789012345682.3610000000
+num[s,14,3]: 1234567890123456789012345675.4810000000
+num[m,14,3]: 4246913542024691354202469135.4882400000
+num[d,14,3]: 358886014570772322387309790.3840116000
+num[a,14,4]: 1235160380123456789012345678.9210000000
+num[s,14,4]: 1233975400123456789012345678.9210000000
+num[m,14,4]: 731469129219246912921924691303903290000000000000000.0000000000
+num[d,14,4]: 2083.6940541165
+num[a,14,5]: 1234567890123456789012017278.9210000000
+num[s,14,5]: 1234567890123456789012674078.9210000000
+num[m,14,5]: -405432095116543209511654320957656.4000000000
+num[d,14,5]: -3759341930948406787491.9174145000
+num[a,14,6]: 1234567890123456789012345678.9210000000
+num[s,14,6]: 1234567890123456789012345678.9210000000
+num[m,14,6]: 0.0000000000
+num[d,14,6]: 6172839450617283945061728394605000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,14,7]: 1234567890123456789012345678.9220000000
+num[s,14,7]: 1234567890123456789012345678.9200000000
+num[m,14,7]: 1234567890123456789012345.6789210000
+num[d,14,7]: 1234567890123456789012345678921.0000000000
+num[a,14,8]: 1234567890123456789012345678.9210000000
+num[s,14,8]: 1234567890123456789012345678.9210000000
+num[m,14,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,14,9]: 1234567890123456789012345678.9209407510
+num[s,14,9]: 1234567890123456789012345678.9210592490
+num[m,14,9]: -73146912921924691292192.4691303903
+num[d,14,9]: -20836940541164522422527733445644.6522304174
+num[a,14,10]: 1234567890123456789012345678.9242840000
+num[s,14,10]: 1234567890123456789012345678.9177160000
+num[m,14,10]: 4054320951165432095116543.2095765640
+num[d,14,10]: 375934193094840678749191741449.7563946407
+num[a,14,11]: 1234567890123456789012345679.4210010000
+num[s,14,11]: 1234567890123456789012345678.4209990000
+num[m,14,11]: 617285179629618517962961851.8061789210
+num[d,14,11]: 2469130841985229607565476226.8895462209
+num[a,14,12]: 1234567890123456789012345678.4209999000
+num[s,14,12]: 1234567890123456789012345679.4210001000
+num[m,14,12]: -617284068518517406851851740.6950678921
+num[d,14,12]: -2469135286419856294053432547.1554905689
+num[a,14,13]: 2469135780246913578024691357.8310000000
+num[s,14,13]: 0.0110000000
+num[m,14,13]: 1524157875323883675049535156291891483344017680446884621.2561100000
+num[d,14,13]: 1.0000000000
+num[a,14,14]: 2469135780246913578024691357.8420000000
+num[s,14,14]: 0.0000000000
+num[m,14,14]: 1524157875323883675049535156305471730135375705126020423.7242410000
+num[d,14,14]: 1.0000000000
+0: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+1: -2
+2: 0.794
+3: 3.44
+4: 592490000000000000000000
+5: -328400
+6: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
+7: 0.001
+8: 0.0
+9: -0.000059249
+10: 0.003284
+11: 0.500001
+12: -0.5000001
+13: 1234567890123456789012345678.91
+14: 1234567890123456789012345678.921
index 91d192b0a78769befe870c9e59b2a15c64fa0f00..19329cedb204fe139cf80265906ded862dfd852e 100644 (file)
@@ -13,6 +13,7 @@ char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
                                                                       into decimal */
                                 "1234567890123456789012345678.921", /* 31 digits should NOT
                                                                        fit into decimal */
+                                "not a number",
                                 NULL};
 
 
@@ -27,46 +28,52 @@ main(void)
        numeric *num, *nin;
        decimal *dec;
        long l;
-       int i, q, r, k;
+       int i, j, k, q, r, count = 0;
        double d;
+       numeric **numarr = (numeric **) malloc(1);
 
        ECPGdebug(1, stderr);
 
        for (i = 0; nums[i]; i++)
        {
                num = PGTYPESnumeric_from_asc(nums[i], &endptr);
-               check_errno();
+               if (!num) check_errno();
                if (endptr != NULL)
                {
                        printf("endptr of %d is not NULL\n", i);
                        if (*endptr != '\0')
                                printf("*endptr of %d is not \\0\n", i);
                }
+               if (!num) continue;
+
+               numarr = realloc(numarr, sizeof(numeric *) * (count + 1));
+               numarr[count++] = num;
+
                text = PGTYPESnumeric_to_asc(num, -1);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,1]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 0);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,2]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 1);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,3]: %s\n", i, text); free(text);
                text = PGTYPESnumeric_to_asc(num, 2);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,4]: %s\n", i, text); free(text);
 
                nin = PGTYPESnumeric_new();
                text = PGTYPESnumeric_to_asc(nin, 2);
-               check_errno();
+               if (!text) check_errno();
                printf("num[%d,5]: %s\n", i, text); free(text);
 
                r = PGTYPESnumeric_to_long(num, &l);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_long(l, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,7]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -74,12 +81,12 @@ main(void)
                }
 
                r = PGTYPESnumeric_to_int(num, &k);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_int(k, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,9]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -87,12 +94,12 @@ main(void)
                }
 
                r = PGTYPESnumeric_to_double(num, &d);
-               check_errno();
+               if (r) check_errno();
                printf("num[%d,10]: %2.7f (r: %d)\n", i, r?0.0:d, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_double(d, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,11]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -101,14 +108,14 @@ main(void)
 
                dec = PGTYPESdecimal_new();
                r = PGTYPESnumeric_to_decimal(num, dec);
-               check_errno();
+               if (r) check_errno();
                /* we have no special routine for outputting decimal, it would
                 * convert to a numeric anyway */
                printf("num[%d,12]: - (r: %d)\n", i, r);
                if (r == 0)
                {
                        r = PGTYPESnumeric_from_decimal(dec, nin);
-                       check_errno();
+                       if (r) check_errno();
                        text = PGTYPESnumeric_to_asc(nin, 2);
                        q = PGTYPESnumeric_cmp(num, nin);
                        printf("num[%d,13]: %s (r: %d - cmp: %d)\n", i, text, r, q);
@@ -120,6 +127,72 @@ main(void)
                printf("\n");
        }
 
+       for (i = 0; i < count; i++)
+       {
+               for (j = 0; j < count; j++)
+               {
+                       numeric* a = PGTYPESnumeric_new();
+                       numeric* s = PGTYPESnumeric_new();
+                       numeric* m = PGTYPESnumeric_new();
+                       numeric* d = PGTYPESnumeric_new();
+                       r = PGTYPESnumeric_add(numarr[i], numarr[j], a);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(a, 10);
+                               printf("num[a,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_sub(numarr[i], numarr[j], s);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(s, 10);
+                               printf("num[s,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_mul(numarr[i], numarr[j], m);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(m, 10);
+                               printf("num[m,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+                       r = PGTYPESnumeric_div(numarr[i], numarr[j], d);
+                       if (r)
+                       {
+                               check_errno();
+                               printf("r: %d\n", r);
+                       }
+                       else
+                       {
+                               text = PGTYPESnumeric_to_asc(d, 10);
+                               printf("num[d,%d,%d]: %s\n", i, j, text);
+                               free(text);
+                       }
+               }
+       }
+
+       for (i = 0; i < count; i++)
+       {
+               text = PGTYPESnumeric_to_asc(numarr[i], -1);
+               printf("%d: %s\n", i, text);
+               free(text);
+       }
+
        return (0);
 }
 
@@ -134,9 +207,15 @@ check_errno(void)
                case PGTYPES_NUM_OVERFLOW:
                        printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
                        break;
+               case PGTYPES_NUM_UNDERFLOW:
+                       printf("(errno == PGTYPES_NUM_UNDERFLOW) - ");
+                       break;
                case PGTYPES_NUM_BAD_NUMERIC:
                        printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
                        break;
+               case PGTYPES_NUM_DIVIDE_ZERO:
+                       printf("(errno == PGTYPES_NUM_DIVIDE_ZERO) - ");
+                       break;
                default:
                        printf("(unknown errno (%d))\n", errno);
                        printf("(libc: (%s)) ", strerror(errno));