Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtZc5-0006bY-DW for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2015 11:18:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZtZc4-0005Te-GA for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2015 11:18:52 +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) (envelope-from ) id 1ZtZc3-0005SY-7c; Tue, 03 Nov 2015 11:18:51 +0000 Received: from mimolette.dalibo.net ([212.85.157.144]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZtZbv-0003ik-SW; Tue, 03 Nov 2015 11:18:50 +0000 Received: from [192.168.1.56] (gut75-2-82-66-247-92.fbx.proxad.net [82.66.247.92]) by mimolette.dalibo.net (Postfix) with ESMTPSA id F28551F103CC; Tue, 3 Nov 2015 12:18:37 +0100 (CET) Subject: Re: [BUGS] BUG #12989: pg_size_pretty with negative values To: Robert Haas References: <20150406173026.2550.39773@wrigleys.postgresql.org> <31955.1428346338@sss.pgh.pa.us> <55FEA38F.40301@credativ.de> <56350782.3040400@dalibo.com> Cc: "Adrian.Vondendriesch" , "pgsql-bugs@postgresql.org" , "pgsql-hackers@postgresql.org" , Tom Lane , "David G. Johnston" , Christian Almeida From: Julien Rouhaud X-Enigmail-Draft-Status: N1010 Message-ID: <5638980D.9010103@dalibo.com> Date: Tue, 3 Nov 2015 12:18:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) 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 On 03/11/2015 04:06, Robert Haas wrote: > On Sat, Oct 31, 2015 at 2:25 PM, Julien Rouhaud > wrote: >> I just reviewed your patch, everything looks fine for me. Maybe some >> minor cosmetic changes could be made to avoid declaring too many vars, >> but I think a committer would have a better idea on this, so I mark >> this patch as ready for committer. > > I don't think we should define Sign(x) as a macro in c.h. c.h is > really only supposed to contain stuff that's pretty generic and > universal, and the fact that we haven't needed it up until now > suggests that Sign(x) isn't. I'd suggest instead defining something > like: > > #define half_rounded(x) (((x) + (x) < 0 ? 0 : 1) / 2) > > Maybe rename numeric_divide_by_two to numeric_half_rounded. > Generally, let's try to make the numeric and int64 code paths look as > similar as possible. > > Recomputing numeric_absolute(x) multiple times should be avoided. > Compute it once and save the answer. > Thanks for these comments. I therefore change the status to waiting on author. Regards. -- Julien Rouhaud http://dalibo.com - http://dalibo.org -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers