Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 936d89e

Browse files
committed
Fix NAN code.
1 parent 6fd29f2 commit 936d89e

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/03 02:40:12 momjian Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.5 1999/01/03 05: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
# define MAX(a,b) (((a)>(b)) ? (a) : (b))
4948
#endif
5049

50+
#ifndef NAN
51+
#define NAN (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-
float64 dummy = 1;
1726-
17271727
result = (float64)palloc(sizeof(float64data));
1728-
#ifdef NAN
17291728
*result = NAN;
1730-
#else
1731-
*result = (dummy-dummy)/(dummy-dummy); /* generate NAN */
1732-
#endif
17331729
return result;
17341730
}
17351731

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

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

0 commit comments

Comments
 (0)