Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 182676a

Browse files
committed
Some platforms set errno on pow(), exp() overflow, some do not, so if
isinf(), fall through to our own infinity checks.
1 parent 09d09b9 commit 182676a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/adt/float.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.134 2007/01/02 21:25:50 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.135 2007/01/02 22:19:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1444,7 +1444,7 @@ dpow(PG_FUNCTION_ARGS)
14441444
*/
14451445
errno = 0;
14461446
result = pow(arg1, arg2);
1447-
if (errno != 0)
1447+
if (errno != 0 && !isinf(result))
14481448
ereport(ERROR,
14491449
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
14501450
errmsg("result is out of range")));
@@ -1469,7 +1469,7 @@ dexp(PG_FUNCTION_ARGS)
14691469
*/
14701470
errno = 0;
14711471
result = exp(arg1);
1472-
if (errno != 0)
1472+
if (errno != 0 && !isinf(result))
14731473
ereport(ERROR,
14741474
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
14751475
errmsg("result is out of range")));

0 commit comments

Comments
 (0)