8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.144 2007/01/06 04:14:55 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.145 2007/01/06 15:18:02 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1444,8 +1444,8 @@ dpow(PG_FUNCTION_ARGS)
1444
1444
* using errno. However, some platform/CPU combinations return
1445
1445
* errno == EDOM and result == Nan for negative arg1 and very large arg2
1446
1446
* (they must be using something different from our floor() test to
1447
- * decide it's invalid). Other platforms return errno == ERANGE and a
1448
- * large but finite result to signal overflow.
1447
+ * decide it's invalid). Other platforms (HPPA) return errno == ERANGE
1448
+ * and a large (HUGE_VAL) but finite result to signal overflow.
1449
1449
*/
1450
1450
errno = 0 ;
1451
1451
result = pow (arg1 , arg2 );
@@ -1459,7 +1459,6 @@ dpow(PG_FUNCTION_ARGS)
1459
1459
else
1460
1460
result = 1 ;
1461
1461
}
1462
- /* Some platoforms, e.g. HPPA, return ERANGE, but HUGE_VAL, not Inf */
1463
1462
else if (errno == ERANGE && !isinf (result ))
1464
1463
result = get_float8_infinity ();
1465
1464
@@ -1477,7 +1476,10 @@ dexp(PG_FUNCTION_ARGS)
1477
1476
float8 arg1 = PG_GETARG_FLOAT8 (0 );
1478
1477
float8 result ;
1479
1478
1479
+ errno = 0 ;
1480
1480
result = exp (arg1 );
1481
+ if (errno == ERANGE && !isinf (result ))
1482
+ result = get_float8_infinity ();
1481
1483
1482
1484
CHECKFLOATVAL (result , isinf (arg1 ), false);
1483
1485
PG_RETURN_FLOAT8 (result );
0 commit comments