Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 812095d

Browse files
committed
Fix erroneous error tests in pow/exp.
1 parent 0d5eb8f commit 812095d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/utils/adt/float.c

Lines changed: 3 additions & 4 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.137 2007/01/03 14:35:24 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.138 2007/01/03 19:34:23 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1445,7 +1445,7 @@ dpow(PG_FUNCTION_ARGS)
14451445
*/
14461446
errno = 0;
14471447
result = pow(arg1, arg2);
1448-
if (errno == ERANGE && isnan(result))
1448+
if (errno == ERANGE || isnan(result))
14491449
{
14501450
if ((fabs(arg1) > 1 && arg2 >= 0) || (fabs(arg1) < 1 && arg2 < 0))
14511451
result = (arg1 >= 0) ? get_float8_infinity() : -get_float8_infinity();
@@ -1474,14 +1474,13 @@ dexp(PG_FUNCTION_ARGS)
14741474
*/
14751475
errno = 0;
14761476
result = exp(arg1);
1477-
if (errno == ERANGE && isnan(result))
1477+
if (errno == ERANGE || isnan(result))
14781478
{
14791479
if (arg1 >= 0)
14801480
result = get_float8_infinity();
14811481
else
14821482
result = 0;
14831483
}
1484-
14851484

14861485
CHECKFLOATVAL(result, isinf(arg1), false);
14871486
PG_RETURN_FLOAT8(result);

0 commit comments

Comments
 (0)