From 182676ae274d610683ad8fbffeb7b11a1cfcccdb Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Tue, 2 Jan 2007 22:19:42 +0000
Subject: [PATCH] Some platforms set errno on pow(), exp() overflow, some do
 not, so if isinf(), fall through to our own infinity checks.

---
 src/backend/utils/adt/float.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 48b5fe878c5..dab6c35667f 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.134 2007/01/02 21:25:50 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.135 2007/01/02 22:19:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1444,7 +1444,7 @@ dpow(PG_FUNCTION_ARGS)
 	 */
 	errno = 0;
 	result = pow(arg1, arg2);
-	if (errno != 0)
+	if (errno != 0 && !isinf(result))
 		ereport(ERROR,
 				(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
 				 errmsg("result is out of range")));
@@ -1469,7 +1469,7 @@ dexp(PG_FUNCTION_ARGS)
 	 */
 	errno = 0;
 	result = exp(arg1);
-	if (errno != 0)
+	if (errno != 0 && !isinf(result))
 		ereport(ERROR,
 				(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
 				 errmsg("result is out of range")));
-- 
GitLab