Skip site navigation (1) Skip section navigation (2)

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

From: Florian Weimer <Weimer(at)CERT(dot)Uni-Stuttgart(dot)DE>
To: sugita(at)sra(dot)co(dot)jp
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Make factorial(0::int2) return 1, as per spec.
Date: 2002-05-30 20:38:00
Message-ID: 877kllgymv.fsf@CERT.Uni-Stuttgart.DE (view raw or flat)
Thread:
Lists: pgsql-patches
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

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-06-03 01:10:47
Subject: Re: fix for typo in docs
Previous:From: sugitaDate: 2002-05-29 16:04:20
Subject: Make factorial(0::int2) return 1, as per spec.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group