Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2c04d5

Browse files
committed
Work around buggy strtod on (some versions of?) IRIX. Combination of
proposed patches from John Jorgensen and Steve Singer.
1 parent9e6c358 commitb2c04d5

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

‎src/backend/utils/adt/float.c

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.129 2006/10/04 00:29:58 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.130 2006/10/05 01:40:45 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -328,6 +328,32 @@ float4in(PG_FUNCTION_ARGS)
328328
}
329329
#endif/* HAVE_BUGGY_SOLARIS_STRTOD */
330330

331+
#ifdefHAVE_BUGGY_IRIX_STRTOD
332+
/*
333+
* In some IRIX versions, strtod() recognizes only "inf", so if the
334+
* input is "infinity" we have to skip over "inity". Also, it may
335+
* return positive infinity for "-inf".
336+
*/
337+
if (isinf(val))
338+
{
339+
if (pg_strncasecmp(num,"Infinity",8)==0)
340+
{
341+
val=get_float4_infinity();
342+
endptr=num+8;
343+
}
344+
elseif (pg_strncasecmp(num,"-Infinity",9)==0)
345+
{
346+
val=-get_float4_infinity();
347+
endptr=num+9;
348+
}
349+
elseif (pg_strncasecmp(num,"-inf",4)==0)
350+
{
351+
val=-get_float4_infinity();
352+
endptr=num+4;
353+
}
354+
}
355+
#endif/* HAVE_BUGGY_IRIX_STRTOD */
356+
331357
/* skip trailing whitespace */
332358
while (*endptr!='\0'&&isspace((unsignedchar)*endptr))
333359
endptr++;
@@ -495,6 +521,32 @@ float8in(PG_FUNCTION_ARGS)
495521
}
496522
#endif/* HAVE_BUGGY_SOLARIS_STRTOD */
497523

524+
#ifdefHAVE_BUGGY_IRIX_STRTOD
525+
/*
526+
* In some IRIX versions, strtod() recognizes only "inf", so if the
527+
* input is "infinity" we have to skip over "inity". Also, it may
528+
* return positive infinity for "-inf".
529+
*/
530+
if (isinf(val))
531+
{
532+
if (pg_strncasecmp(num,"Infinity",8)==0)
533+
{
534+
val=get_float8_infinity();
535+
endptr=num+8;
536+
}
537+
elseif (pg_strncasecmp(num,"-Infinity",9)==0)
538+
{
539+
val=-get_float8_infinity();
540+
endptr=num+9;
541+
}
542+
elseif (pg_strncasecmp(num,"-inf",4)==0)
543+
{
544+
val=-get_float8_infinity();
545+
endptr=num+4;
546+
}
547+
}
548+
#endif/* HAVE_BUGGY_IRIX_STRTOD */
549+
498550
/* skip trailing whitespace */
499551
while (*endptr!='\0'&&isspace((unsignedchar)*endptr))
500552
endptr++;

‎src/include/port/irix.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
/* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.4 2006/10/05 01:40:45 tgl Exp $ */
2+
3+
/*
4+
* IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts
5+
* "infinity", but leaves endptr pointing to "inity".
6+
*/
7+
#defineHAVE_BUGGY_IRIX_STRTOD

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp