Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe74581

Browse files
author
Thomas G. Lockhart
committed
Use finite() macro if available to check returns from pow() and exp().
1 parent93ac35f commitfe74581

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+
#ifndeffinite
977978
errno=0;
979+
#endif
978980
*result= (float64data)pow(tmp1,tmp2);
981+
#ifndeffinite
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+
#ifndeffinite
10011008
errno=0;
1009+
#endif
10021010
*result= (float64data)exp(tmp);
1011+
#ifndeffinite
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)

[8]ページ先頭

©2009-2025 Movatter.jp