From e80b0bd69d7f01fc6faabd8a025d7b1de9adc10e Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sat, 6 Jan 2007 15:18:03 +0000
Subject: [PATCH] Check for ERANGE in exp() as well.

Improve release docs for ecpg regression tests.
---
 src/backend/utils/adt/float.c | 10 ++++++----
 src/tools/RELEASE_CHANGES     |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index ef2da34a80e..263a13a3148 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.144 2007/01/06 04:14:55 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.145 2007/01/06 15:18:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1444,8 +1444,8 @@ dpow(PG_FUNCTION_ARGS)
 	 * using errno.  However, some platform/CPU combinations return
 	 * errno == EDOM and result == Nan for negative arg1 and very large arg2
 	 * (they must be using something different from our floor() test to
-	 * decide it's invalid).  Other platforms return errno == ERANGE and a
-	 * large but finite result to signal overflow.
+	 * decide it's invalid).  Other platforms (HPPA) return errno == ERANGE
+	 * and a large (HUGE_VAL) but finite result to signal overflow.
 	 */
 	errno = 0;
 	result = pow(arg1, arg2);
@@ -1459,7 +1459,6 @@ dpow(PG_FUNCTION_ARGS)
 		else
 			result = 1;
 	}
-	/* Some platoforms, e.g. HPPA, return ERANGE, but HUGE_VAL, not Inf */
 	else if (errno == ERANGE && !isinf(result))
 		result = get_float8_infinity();
 	
@@ -1477,7 +1476,10 @@ dexp(PG_FUNCTION_ARGS)
 	float8		arg1 = PG_GETARG_FLOAT8(0);
 	float8		result;
 
+	errno = 0;
 	result = exp(arg1);
+	if (errno == ERANGE && !isinf(result))
+		result = get_float8_infinity();
 
 	CHECKFLOATVAL(result, isinf(arg1), false);
 	PG_RETURN_FLOAT8(result);
diff --git a/src/tools/RELEASE_CHANGES b/src/tools/RELEASE_CHANGES
index 727b434cabc..acefa1a000e 100644
--- a/src/tools/RELEASE_CHANGES
+++ b/src/tools/RELEASE_CHANGES
@@ -35,7 +35,7 @@ For Major Releases
 * Bump library versions, if appropriate (see below)
 	o src/interfaces/*/Makefile
 	o src/interfaces/*/*/Makefile
-	o update ecpg regression expected files
+	o update ecpg regression expected files for new library number
 
 * Release notes
 	o check that dashed items from the TODO list are complete
-- 
GitLab