Commit 6fd29f2c authored by Bruce Momjian's avatar Bruce Momjian

Fix for NAN generation.

parent 61e16ade
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.3 1999/01/01 04:17:13 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.4 1999/01/03 02:40:12 momjian Exp $
* *
* ---------- * ----------
*/ */
...@@ -1722,11 +1722,13 @@ numeric_float8(Numeric num) ...@@ -1722,11 +1722,13 @@ numeric_float8(Numeric num)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
{ {
float64 dummy = 1;
result = (float64)palloc(sizeof(float64data)); result = (float64)palloc(sizeof(float64data));
#ifdef NAN #ifdef NAN
*result = NAN; *result = NAN;
#else #else
*result = num; *result = (dummy-dummy)/(dummy-dummy); /* generate NAN */
#endif #endif
return result; return result;
} }
...@@ -1776,11 +1778,13 @@ numeric_float4(Numeric num) ...@@ -1776,11 +1778,13 @@ numeric_float4(Numeric num)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
{ {
float32 dummy = 1;
result = (float32)palloc(sizeof(float32data)); result = (float32)palloc(sizeof(float32data));
#ifdef NAN #ifdef NAN
*result = NAN; *result = NAN;
#else #else
*result = num; *result = (dummy-dummy)/(dummy-dummy); /* generate NAN */
#endif #endif
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment