Re: Make factorial(0::int2) return 1, as per spec. - Mailing list pgsql-patches

From Florian Weimer
Subject Re: Make factorial(0::int2) return 1, as per spec.
Date
Msg-id 877kllgymv.fsf@CERT.Uni-Stuttgart.DE
Whole thread Raw
In response to Make factorial(0::int2) return 1, as per spec.  (sugita@sra.co.jp)
Responses Re: Make factorial(0::int2) return 1, as per spec.
List pgsql-patches
sugita@sra.co.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@CERT.Uni-Stuttgart.DE
University of Stuttgart           http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898

pgsql-patches by date:

Previous
From: sugita@sra.co.jp
Date:
Subject: Make factorial(0::int2) return 1, as per spec.
Next
From: Bruce Momjian
Date:
Subject: Re: fix for typo in docs