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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, pgsql-hackers(at)hub(dot)org
Subject: Re: Re: [GENERAL] +/- Inf for float8's
Date: 2000-08-21 05:25:11
Message-ID: 26690.966835511@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Ross J. Reedstrom" <reedstrm(at)rice(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-08-21 05:42:13 fmgr rewrite milestone
Previous Message Tom Lane 2000-08-21 05:05:01 BIT/BIT VARYING status