Re: Make factorial(0::int2) return 1, as per spec.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Florian Weimer <Weimer(at)CERT(dot)Uni-Stuttgart(dot)DE>
Cc: sugita(at)sra(dot)co(dot)jp, pgsql-patches(at)postgresql(dot)org
Subject: Re: Make factorial(0::int2) return 1, as per spec.
Date: 2002-06-07 23:43:24
Message-ID: 200206072343.g57NhOv07278@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Change made for int2 and int4.

---------------------------------------------------------------------------

Florian Weimer wrote:
> sugita(at)sra(dot)co(dot)jp writes:
>
> > - if (arg1 < 1)
> > + if (arg1 == 0)
> > + result = 1;
> > + else if (arg1 < 1)
> > result = 0;
> > else
> > for (result = 1; arg1 > 0; --arg1)
>
> The second "if" should compare with 0, not 1. (It doesn't make a
> difference, it's only about readability.)
>
> --
> Florian Weimer Weimer(at)CERT(dot)Uni-Stuttgart(dot)DE
> University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
> RUS-CERT +49-711-685-5973/fax +49-711-685-5898
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-06-08 02:18:10 Re: [PATCHES] JDBC CStmt (inline this time)
Previous Message Bruce Momjian 2002-06-07 23:42:16 Re: Make factorial(0::int2) return 1, as per spec.