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

Commit936d89e

Browse files
committed
Fix NAN code.
1 parent6fd29f2 commit936d89e

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

‎src/backend/utils/adt/numeric.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*1998 Jan Wieck
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.4 1999/01/0302:40:12 momjian Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.5 1999/01/0305:30:47 momjian Exp $
99
*
1010
* ----------
1111
*/
@@ -16,7 +16,6 @@
1616
#include<ctype.h>
1717
#include<float.h>
1818
#include<math.h>
19-
/*#include <nan.h> BSD/OS does not have this */
2019
#include<errno.h>
2120
#include<sys/types.h>
2221

@@ -48,6 +47,9 @@
4847
# defineMAX(a,b) (((a)>(b)) ? (a) : (b))
4948
#endif
5049

50+
#ifndefNAN
51+
#defineNAN(0.0/0.0)
52+
#endif
5153

5254

5355
/* ----------
@@ -1722,14 +1724,8 @@ numeric_float8(Numeric num)
17221724

17231725
if (NUMERIC_IS_NAN(num))
17241726
{
1725-
float64dummy=1;
1726-
17271727
result= (float64)palloc(sizeof(float64data));
1728-
#ifdefNAN
17291728
*result=NAN;
1730-
#else
1731-
*result= (dummy-dummy)/(dummy-dummy);/* generate NAN */
1732-
#endif
17331729
returnresult;
17341730
}
17351731

@@ -1778,14 +1774,8 @@ numeric_float4(Numeric num)
17781774

17791775
if (NUMERIC_IS_NAN(num))
17801776
{
1781-
float32dummy=1;
1782-
17831777
result= (float32)palloc(sizeof(float32data));
1784-
#ifdefNAN
17851778
*result=NAN;
1786-
#else
1787-
*result= (dummy-dummy)/(dummy-dummy);/* generate NAN */
1788-
#endif
17891779
returnresult;
17901780
}
17911781

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp