mirror of
https://github.com/postgres/postgres.git
synced 2025-06-05 00:02:04 -04:00
Apply fix so pow() and exp() ERANGE is used only if result is not 0.
This commit is contained in:
parent
282f7f2eac
commit
f0f4a6d781
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.145 2007/01/06 15:18:02 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.146 2007/01/06 20:21:29 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1459,7 +1459,7 @@ dpow(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
else if (errno == ERANGE && !isinf(result))
|
else if (errno == ERANGE && result != 0 && !isinf(result))
|
||||||
result = get_float8_infinity();
|
result = get_float8_infinity();
|
||||||
|
|
||||||
CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
|
CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
|
||||||
@ -1478,7 +1478,7 @@ dexp(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
result = exp(arg1);
|
result = exp(arg1);
|
||||||
if (errno == ERANGE && !isinf(result))
|
if (errno == ERANGE && result != 0 && !isinf(result))
|
||||||
result = get_float8_infinity();
|
result = get_float8_infinity();
|
||||||
|
|
||||||
CHECKFLOATVAL(result, isinf(arg1), false);
|
CHECKFLOATVAL(result, isinf(arg1), false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user