From 330679c11a911f38ee6da83d9bdc4f0b5292d561 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 3 Jan 1999 05:30:47 +0000 Subject: [PATCH] Fix NAN code. --- src/backend/utils/adt/numeric.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 5481586571..0f8f5ce9a8 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -16,7 +16,6 @@ #include #include #include -/*#include BSD/OS does not have this */ #include #include @@ -48,6 +47,9 @@ # define MAX(a,b) (((a)>(b)) ? (a) : (b)) #endif +#ifndef NAN +#define NAN (0.0/0.0) +#endif /* ---------- @@ -1722,14 +1724,8 @@ numeric_float8(Numeric num) if (NUMERIC_IS_NAN(num)) { - float64 dummy = 1; - result = (float64)palloc(sizeof(float64data)); -#ifdef NAN *result = NAN; -#else - *result = (dummy-dummy)/(dummy-dummy); /* generate NAN */ -#endif return result; } @@ -1778,14 +1774,8 @@ numeric_float4(Numeric num) if (NUMERIC_IS_NAN(num)) { - float32 dummy = 1; - result = (float32)palloc(sizeof(float32data)); -#ifdef NAN *result = NAN; -#else - *result = (dummy-dummy)/(dummy-dummy); /* generate NAN */ -#endif return result; } -- 2.39.5