mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-04 00:02:52 -05:00 
			
		
		
		
	Fix for factorial(0::int2) returning 1, from sugita@sra.co.jp.
This commit is contained in:
		
							parent
							
								
									74a8af099f
								
							
						
					
					
						commit
						8a3f34b558
					
				@ -8,7 +8,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.48 2002/02/23 01:01:30 momjian Exp $
 | 
			
		||||
 *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.49 2002/06/07 23:41:53 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@ -800,7 +800,9 @@ int2fac(PG_FUNCTION_ARGS)
 | 
			
		||||
	int16		arg1 = PG_GETARG_INT16(0);
 | 
			
		||||
	int32		result;
 | 
			
		||||
 | 
			
		||||
	if (arg1 < 1)
 | 
			
		||||
	if (arg1 == 0)
 | 
			
		||||
		result = 1;
 | 
			
		||||
	else if (arg1 < 1)
 | 
			
		||||
		result = 0;
 | 
			
		||||
	else
 | 
			
		||||
		for (result = 1; arg1 > 0; --arg1)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user