Skip to content

Commit fe74581

Browse files
author
Thomas G. Lockhart
committed
Use finite() macro if available to check returns from pow() and exp().
1 parent 93ac35f commit fe74581

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/backend/utils/adt/float.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.15 1997/05/14 04:35:10 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.16 1997/06/03 13:58:06 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -974,9 +974,15 @@ float64 dpow(float64 arg1, float64 arg2)
974974

975975
tmp1 = *arg1;
976976
tmp2 = *arg2;
977+
#ifndef finite
977978
errno = 0;
979+
#endif
978980
*result = (float64data) pow(tmp1, tmp2);
981+
#ifndef finite
979982
if (errno == ERANGE)
983+
#else
984+
if (!finite(*result))
985+
#endif
980986
elog(WARN, "pow() returned a floating point out of the range\n");
981987

982988
CheckFloat8Val(*result);
@@ -998,9 +1004,15 @@ float64 dexp(float64 arg1)
9981004
result = (float64) palloc(sizeof(float64data));
9991005

10001006
tmp = *arg1;
1007+
#ifndef finite
10011008
errno = 0;
1009+
#endif
10021010
*result = (float64data) exp(tmp);
1011+
#ifndef finite
10031012
if (errno == ERANGE)
1013+
#else
1014+
if (!finite(*result))
1015+
#endif
10041016
elog(WARN, "exp() returned a floating point out of range\n");
10051017

10061018
CheckFloat8Val(*result);

0 commit comments

Comments
 (0)