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

Commit e6e3640

Browse files
committed
Move all the isinf() stuff from float.c to isinf.c, and build it according to
configure vs port specific #ifdef's...
1 parent 79f99a3 commit e6e3640

File tree

6 files changed

+181
-186
lines changed

6 files changed

+181
-186
lines changed

src/backend/parser/scan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* A lexical scanner generated by flex */
22

33
/* Scanner skeleton version:
4-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $
55
*/
66

77
#define FLEX_SCANNER
@@ -539,7 +539,7 @@ char *yytext;
539539
*
540540
*
541541
* IDENTIFICATION
542-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $
542+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $
543543
*
544544
*-------------------------------------------------------------------------
545545
*/

src/backend/port/isinf.c

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,63 @@
1-
/* $Id: isinf.c,v 1.1 1998/01/15 20:54:37 scrappy Exp $ */
1+
/* $Id: isinf.c,v 1.2 1998/02/02 00:03:46 scrappy Exp $ */
22

3-
#include <ieeefp.h>
43
#include <math.h>
5-
64
#include "config.h"
75

6+
#if HAVE_FPCLASS
7+
# if HAVE_IEEEFP_H
8+
# include <ieeefp.h>
9+
# endif
10+
int
11+
isinf(double d)
12+
{
13+
fpclass_t type = fpclass(d);
14+
15+
switch (type)
16+
{
17+
case FP_SNAN:
18+
case FP_QNAN:
19+
case FP_NINF:
20+
case FP_PINF:
21+
return (1);
22+
default:
23+
break;
24+
}
25+
return (0);
26+
}
27+
#endif
828

29+
#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
30+
# if HAVE_FP_CLASS_H
31+
# include <fp_class.h>
32+
# endif
33+
int
34+
isinf(x)
35+
double x;
36+
{
37+
#if HAVE_FP_CLASS
38+
int fpclass = fp_class(x);
39+
#else
40+
int fpclass = fp_class_d(x);
41+
#endif
42+
43+
if (fpclass == FP_POS_INF)
44+
return (1);
45+
if (fpclass == FP_NEG_INF)
46+
return (-1);
47+
return (0);
48+
}
49+
#endif
50+
51+
#if defined(HAVE_CLASS)
952
int
1053
isinf(double x)
1154
{
12-
if((fpclass(x) == FP_PINF) || (fpclass(x) == FP_NINF)) return 1;
13-
else return 0;
14-
}
55+
int fpclass = class(x);
1556

57+
if (fpclass == FP_PLUS_INF)
58+
return (1);
59+
if (fpclass == FP_MINUS_INF)
60+
return (-1);
61+
return (0);
62+
}
63+
#endif

src/backend/utils/adt/float.c

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.27 1998/01/13 19:28:32 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.28 1998/02/02 00:03:54 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1507,130 +1507,3 @@ double x;
15071507
}
15081508

15091509
#endif /* !HAVE_CBRT */
1510-
1511-
#ifndef HAVE_ISINF
1512-
1513-
#if defined(aix)
1514-
1515-
#ifdef CLASS_CONFLICT
1516-
/* we want the math symbol */
1517-
#undef class
1518-
#endif /* CLASS_CONFICT */
1519-
1520-
/* The gcc doesn't support isinf() (without libgcc?) so we
1521-
* have to do it - Gerhard Reitofer
1522-
*/
1523-
#ifdef __GNUC__
1524-
1525-
static int
1526-
isinf(double x)
1527-
{
1528-
if (x == HUGE_VAL)
1529-
return(1);
1530-
if (x == -HUGE_VAL)
1531-
return(-1);
1532-
return(0);
1533-
}
1534-
1535-
#else /* __GNUC__ */
1536-
1537-
static int
1538-
isinf(double x)
1539-
{
1540-
int fpclass = class(x);
1541-
1542-
if (fpclass == FP_PLUS_INF)
1543-
return (1);
1544-
if (fpclass == FP_MINUS_INF)
1545-
return (-1);
1546-
return (0);
1547-
}
1548-
1549-
#endif /* __GNUC__ */
1550-
1551-
#endif /* aix */
1552-
1553-
#if defined(ultrix4)
1554-
#include <fp_class.h>
1555-
static int
1556-
isinf(x)
1557-
double x;
1558-
{
1559-
int fpclass = fp_class_d(x);
1560-
1561-
if (fpclass == FP_POS_INF)
1562-
return (1);
1563-
if (fpclass == FP_NEG_INF)
1564-
return (-1);
1565-
return (0);
1566-
}
1567-
1568-
#endif /* ultrix4 */
1569-
1570-
#if defined(alpha)
1571-
#include <fp_class.h>
1572-
static int
1573-
isinf(x)
1574-
double x;
1575-
{
1576-
int fpclass = fp_class(x);
1577-
1578-
if (fpclass == FP_POS_INF)
1579-
return (1);
1580-
if (fpclass == FP_NEG_INF)
1581-
return (-1);
1582-
return (0);
1583-
}
1584-
1585-
#endif /* alpha */
1586-
1587-
#if defined(sparc_solaris) || defined(i386_solaris) || defined(svr4) || \
1588-
defined(sco)
1589-
#include <ieeefp.h>
1590-
static int
1591-
isinf(d)
1592-
double d;
1593-
{
1594-
fpclass_t type = fpclass(d);
1595-
1596-
switch (type)
1597-
{
1598-
case FP_SNAN:
1599-
case FP_QNAN:
1600-
case FP_NINF:
1601-
case FP_PINF:
1602-
return (1);
1603-
default:
1604-
break;
1605-
}
1606-
1607-
return (0);
1608-
}
1609-
1610-
#endif /* sparc_solaris */
1611-
1612-
#if defined(irix5)
1613-
#include <ieeefp.h>
1614-
static int
1615-
isinf(d)
1616-
double d;
1617-
{
1618-
fpclass_t type = fpclass(d);
1619-
1620-
switch (type)
1621-
{
1622-
case FP_SNAN:
1623-
case FP_QNAN:
1624-
case FP_NINF:
1625-
case FP_PINF:
1626-
return (1);
1627-
default:
1628-
break;
1629-
}
1630-
1631-
return (0);
1632-
}
1633-
1634-
#endif /* irix5 */
1635-
1636-
#endif /* !HAVE_ISINF */

0 commit comments

Comments
 (0)