Re: 8.2beta1 failure on IRIX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Singer <ssinger_pg(at)sympatico(dot)ca>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: 8.2beta1 failure on IRIX
Date: 2006-10-05 01:42:51
Message-ID: 5705.1160012571@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've applied the attached patch which merges ideas from your version and
John Jorgensen's. Please check it.

regards, tom lane

*** src/backend/utils/adt/float.c.orig Tue Oct 3 23:16:36 2006
--- src/backend/utils/adt/float.c Wed Oct 4 21:21:17 2006
***************
*** 328,333 ****
--- 328,359 ----
}
#endif /* HAVE_BUGGY_SOLARIS_STRTOD */

+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ /*
+ * In some IRIX versions, strtod() recognizes only "inf", so if the
+ * input is "infinity" we have to skip over "inity". Also, it may
+ * return positive infinity for "-inf".
+ */
+ if (isinf(val))
+ {
+ if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ {
+ val = get_float4_infinity();
+ endptr = num + 8;
+ }
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ {
+ val = -get_float4_infinity();
+ endptr = num + 9;
+ }
+ else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ {
+ val = -get_float4_infinity();
+ endptr = num + 4;
+ }
+ }
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */
+
/* skip trailing whitespace */
while (*endptr != '\0' && isspace((unsigned char) *endptr))
endptr++;
***************
*** 494,499 ****
--- 520,551 ----
endptr--;
}
#endif /* HAVE_BUGGY_SOLARIS_STRTOD */
+
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ /*
+ * In some IRIX versions, strtod() recognizes only "inf", so if the
+ * input is "infinity" we have to skip over "inity". Also, it may
+ * return positive infinity for "-inf".
+ */
+ if (isinf(val))
+ {
+ if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ {
+ val = get_float8_infinity();
+ endptr = num + 8;
+ }
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ {
+ val = -get_float8_infinity();
+ endptr = num + 9;
+ }
+ else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ {
+ val = -get_float8_infinity();
+ endptr = num + 4;
+ }
+ }
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */

/* skip trailing whitespace */
while (*endptr != '\0' && isspace((unsigned char) *endptr))
*** src/include/port/irix.h.orig Fri Mar 10 23:38:38 2006
--- src/include/port/irix.h Wed Oct 4 21:20:50 2006
***************
*** 1 ****
--- 1,7 ----
/* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */
+
+ /*
+ * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts
+ * "infinity", but leaves endptr pointing to "inity".
+ */
+ #define HAVE_BUGGY_IRIX_STRTOD

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-10-05 02:03:01 Re: [HACKERS] Updated version of FAQ_Solaris
Previous Message Tom Lane 2006-10-05 00:40:03 Re: 8.2beta1 failure on IRIX