Re: Re: [GENERAL] +/- Inf for float8's

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Ross J. Reedstrom" <reedstrm@rice.edu>
Cc: Peter Eisentraut <peter_e@gmx.net>, Thomas Lockhart <lockhart@alumni.caltech.edu>, pgsql-hackers@hub.org
Date: 2000-08-21T05:25:11Z
Lists: pgsql-hackers
"Ross J. Reedstrom" <reedstrm@rice.edu> writes:
> ! 	switch (isinf(num))
> ! 	{
> ! 		case -1:
> ! 			PG_RETURN_CSTRING(strcpy(ascii, "-Infinity"));
> ! 			break;
> ! 		case 1:
> ! 			PG_RETURN_CSTRING(strcpy(ascii, "Infinity"));
> ! 			break;
> ! 		default:
> ! 			break;
> ! 	}

My man page for isinf() sez:

      isinf() returns a positive integer if x is +INFINITY, or a negative
      integer if x is -INFINITY.  Otherwise it returns zero.

so the above switch statement is making an unportable assumption about
exactly which positive or negative value will be returned.

> + 	if (isnan(arg2)) PG_RETURN_BOOL(1); 

PG_RETURN_BOOL(true), please...

> ! 	if (isnan(a))
> ! 		PG_RETURN_INT32(1);

Do not like this at all --- doesn't it make the result of btint4cmp(NaN,
NaN) dependent on which argument chances to be first?  Seems to me that
you must consider two NaNs to be equal, unless you want to subdivide
the category of NaNs.

			regards, tom lane