Re: Strange behavior with polygon and NaN

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: tgl@sss.pgh.pa.us
Cc: gkokolatos@pm.me, pgsql-hackers@lists.postgresql.org
Date: 2020-11-13T06:39:23Z
Lists: pgsql-hackers
At Fri, 13 Nov 2020 15:35:58 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
> Thank you for the review, Georgios and Tom.
> 
> At Tue, 10 Nov 2020 14:30:08 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote in 
> > I spent some time looking this over, and have a few thoughts:
> > 
> > 1. I think it's useful to split the test changes into two patches,
> > as I've done below: first, just add the additional row in point_tbl
> > and let the fallout from that happen, and then in the second patch
> > make the code changes.  This way, it's much clearer what the actual
> > behavioral changes are.  Some of them don't look right, either.
> > For instance, in the very first hunk in geometry.out, we have
> > this:
> > 
> > - (Infinity,1e+300) | {1,0,5}                               |                NaN |                NaN
> > + (Infinity,1e+300) | {1,0,5}                               |           Infinity |           Infinity
> > 
> > which seems right, and also this:
> 
> For example, ('Infinity', 1e300) <-> {1,0,5}, that is:
> 
>    line "x = -5" <-> point(1e300, Inf)
> 
> So sqrt((1e300 - 5)^2 + Inf^2) = Inf, which looks right.

??! Correction:

 It's sqrt((1e300 - 5)^2 + 0^2) = Inf, which looks right.

reagrds.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Commits

  1. In geo_ops.c, represent infinite slope as Infinity, not DBL_MAX.

  2. Fix FPeq() and friends to get the right answers for infinities.

  3. Extend the geometric regression test cases a little.

  4. Remove underflow error in float division with infinite divisor.