Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dulHp-0001ur-69 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Sep 2017 20:07:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dulHo-0003gy-6q for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Sep 2017 20:07:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dulHm-0003ee-BM for pgsql-hackers@postgresql.org; Wed, 20 Sep 2017 20:07:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dulHj-0004k4-3f for pgsql-hackers@postgresql.org; Wed, 20 Sep 2017 20:07:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v8KK7XxQ032000; Wed, 20 Sep 2017 16:07:33 -0400 From: Tom Lane To: Darafei Praliaskouski cc: pgsql-hackers@postgresql.org, Heikki Linnakangas , Fedor Sigaev , Alexander Korotkov , Nikita Glukhov Subject: Re: compress method for spgist - 2 In-reply-to: <20170920190059.1354.29457.pgcf@coridan.postgresql.org> References: <54907069.1030506@sigaev.ru> <20170920190059.1354.29457.pgcf@coridan.postgresql.org> Comments: In-reply-to Darafei Praliaskouski message dated "Wed, 20 Sep 2017 19:00:59 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31998.1505938053.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 20 Sep 2017 16:07:33 -0400 Message-ID: <31999.1505938053@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Darafei Praliaskouski writes: > I have some questions about the circles example though. > * What is the reason for isnan check and swap of box ordinates for circl= e? It wasn't in the code previously. I hadn't paid any attention to this patch previously, but this comment excited my curiosity, so I went and looked: + bbox->high.x =3D circle->center.x + circle->radius; + bbox->low.x =3D circle->center.x - circle->radius; + bbox->high.y =3D circle->center.y + circle->radius; + bbox->low.y =3D circle->center.y - circle->radius; +=20 + if (isnan(bbox->low.x)) + { + double tmp =3D bbox->low.x; + bbox->low.x =3D bbox->high.x; + bbox->high.x =3D tmp; + } Maybe I'm missing something, but it appears to me that it's impossible for bbox->low.x to be NaN unless circle->center.x and/or circle->radius is a NaN, in which case bbox->high.x would also have been computed as a NaN, making the swap entirely useless. Likewise for the Y case. There may be something useful to do about NaNs here, but this doesn't seem like it. > How about removing circle from the scope of this patch, so it is smaller = and cleaner? Neither of those patches would be particularly large, and since they'd need to touch adjacent code in some places, the diffs wouldn't be independent. I think splitting them is just make-work. regards, tom lane --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers