diff options
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/parser/scan.c | 4 | ||||
| -rw-r--r-- | src/backend/port/isinf.c | 60 | ||||
| -rw-r--r-- | src/backend/utils/adt/float.c | 129 |
3 files changed, 57 insertions, 136 deletions
diff --git a/src/backend/parser/scan.c b/src/backend/parser/scan.c index 8b29019c7f..8785f35d83 100644 --- a/src/backend/parser/scan.c +++ b/src/backend/parser/scan.c @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $ */ #define FLEX_SCANNER @@ -539,7 +539,7 @@ char *yytext; * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/backend/port/isinf.c b/src/backend/port/isinf.c index ca5d22bfe5..6e9d83e600 100644 --- a/src/backend/port/isinf.c +++ b/src/backend/port/isinf.c @@ -1,15 +1,63 @@ -/* $Id: isinf.c,v 1.1 1998/01/15 20:54:37 scrappy Exp $ */ +/* $Id: isinf.c,v 1.2 1998/02/02 00:03:46 scrappy Exp $ */ -#include <ieeefp.h> #include <math.h> - #include "config.h" +#if HAVE_FPCLASS +# if HAVE_IEEEFP_H +# include <ieeefp.h> +# endif +int +isinf(double d) +{ + fpclass_t type = fpclass(d); + + switch (type) + { + case FP_SNAN: + case FP_QNAN: + case FP_NINF: + case FP_PINF: + return (1); + default: + break; + } + return (0); +} +#endif +#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D) +# if HAVE_FP_CLASS_H +# include <fp_class.h> +# endif +int +isinf(x) +double x; +{ +#if HAVE_FP_CLASS + int fpclass = fp_class(x); +#else + int fpclass = fp_class_d(x); +#endif + + if (fpclass == FP_POS_INF) + return (1); + if (fpclass == FP_NEG_INF) + return (-1); + return (0); +} +#endif + +#if defined(HAVE_CLASS) int isinf(double x) { - if((fpclass(x) == FP_PINF) || (fpclass(x) == FP_NINF)) return 1; - else return 0; -} + int fpclass = class(x); + if (fpclass == FP_PLUS_INF) + return (1); + if (fpclass == FP_MINUS_INF) + return (-1); + return (0); +} +#endif diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index a157c992c3..71b324a5c3 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.27 1998/01/13 19:28:32 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.28 1998/02/02 00:03:54 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -1507,130 +1507,3 @@ double x; } #endif /* !HAVE_CBRT */ - -#ifndef HAVE_ISINF - -#if defined(aix) - -#ifdef CLASS_CONFLICT -/* we want the math symbol */ -#undef class -#endif /* CLASS_CONFICT */ - -/* The gcc doesn't support isinf() (without libgcc?) so we - * have to do it - Gerhard Reitofer - */ -#ifdef __GNUC__ - -static int -isinf(double x) -{ - if (x == HUGE_VAL) - return(1); - if (x == -HUGE_VAL) - return(-1); - return(0); -} - -#else /* __GNUC__ */ - -static int -isinf(double x) -{ - int fpclass = class(x); - - if (fpclass == FP_PLUS_INF) - return (1); - if (fpclass == FP_MINUS_INF) - return (-1); - return (0); -} - -#endif /* __GNUC__ */ - -#endif /* aix */ - -#if defined(ultrix4) -#include <fp_class.h> -static int -isinf(x) -double x; -{ - int fpclass = fp_class_d(x); - - if (fpclass == FP_POS_INF) - return (1); - if (fpclass == FP_NEG_INF) - return (-1); - return (0); -} - -#endif /* ultrix4 */ - -#if defined(alpha) -#include <fp_class.h> -static int -isinf(x) -double x; -{ - int fpclass = fp_class(x); - - if (fpclass == FP_POS_INF) - return (1); - if (fpclass == FP_NEG_INF) - return (-1); - return (0); -} - -#endif /* alpha */ - -#if defined(sparc_solaris) || defined(i386_solaris) || defined(svr4) || \ - defined(sco) -#include <ieeefp.h> -static int -isinf(d) -double d; -{ - fpclass_t type = fpclass(d); - - switch (type) - { - case FP_SNAN: - case FP_QNAN: - case FP_NINF: - case FP_PINF: - return (1); - default: - break; - } - - return (0); -} - -#endif /* sparc_solaris */ - -#if defined(irix5) -#include <ieeefp.h> -static int -isinf(d) -double d; -{ - fpclass_t type = fpclass(d); - - switch (type) - { - case FP_SNAN: - case FP_QNAN: - case FP_NINF: - case FP_PINF: - return (1); - default: - break; - } - - return (0); -} - -#endif /* irix5 */ - -#endif /* !HAVE_ISINF */ |
