Line intersection point is wrong

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Line intersection point is wrong
Date: 2016-06-19 13:20:24
Message-ID: CAE2gYzw_-z=V2kh8QqFjenu=8MJXzOP44wRW=AzzeamrmTT1=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

While working on removing FP macros of the geometric type operators,
I noticed that line intersection is giving wrong results:

regression=# select '{1,1,1}'::line # '{2,1,0}'::line;
?column?
----------
(1,2)
(1 row)

There are a few other operators relying on this function which are also
returning wrong results. Segfaults should be possible at least on
assert enabled builds, though FP macros makes it hard to get them.

The bug seems to be introduced by 215bc83d on 1997. I couldn't find
any relevant bug report on the archives except Tom Lane's doubtful
comment [1] from 1999. Patch attached to fix the formula.

[1] https://www.postgresql.org/message-id/5537.941498236%40sss.pgh.pa.us

Attachment Content-Type Size
fix-line-interpt.patch text/x-diff 1.3 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-06-19 16:18:57 Re: Line intersection point is wrong
Previous Message Дилян Палаузов 2016-06-19 13:09:44 Re: BUG #14201: In psql prompt2 %R can be (