Re: [BUGS] BUG #12989: pg_size_pretty with negative values

From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Adrian(dot)Vondendriesch" <Adrian(dot)Vondendriesch(at)credativ(dot)de>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Christian Almeida <cbalmeida(at)gmail(dot)com>
Subject: Re: [BUGS] BUG #12989: pg_size_pretty with negative values
Date: 2015-11-03 11:18:37
Message-ID: 5638980D.9010103@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 03/11/2015 04:06, Robert Haas wrote:
> On Sat, Oct 31, 2015 at 2:25 PM, Julien Rouhaud
> <julien(dot)rouhaud(at)dalibo(dot)com> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-11-03 13:06:18 Re: BUG #13741: vacuumdb does not accept valid password
Previous Message Robert Haas 2015-11-03 03:06:55 Re: [BUGS] BUG #12989: pg_size_pretty with negative values

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-11-03 11:31:59 Re: Patent warning about the Greenplum source code
Previous Message Amit Kapila 2015-11-03 10:41:29 Re: Parallel Seq Scan