From: Abigail <abigail@abigail.be>
Date: Thu, 17 Aug 2000 20:49:18 +0000 (+0000)
Subject: Use NVs in POSIX math, not doubles.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1ca407b4adcd5a31e0df6bc6b8955a291235650;p=p5sagit%2Fp5-mst-13.2.git

Use NVs in POSIX math, not doubles.
Subject: [ID 20000817.014] POSIX & modfl
Message-Id: <20000817204918.23123.qmail@foad.org>

p4raw-id: //depot/perl@6686
---

diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index b8b80d4..473610f 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -538,24 +538,6 @@ mini_mktime(struct tm *ptm)
 	ptm->tm_wday = (jday + WEEKDAY_BIAS) % 7;
 }
 
-#ifdef HAS_LONG_DOUBLE
-#  if LONG_DOUBLESIZE > DOUBLESIZE
-#    undef HAS_LONG_DOUBLE  /* XXX until we figure out how to use them */
-#  endif
-#endif
-
-#ifndef HAS_LONG_DOUBLE 
-#ifdef LDBL_MAX
-#undef LDBL_MAX
-#endif
-#ifdef LDBL_MIN
-#undef LDBL_MIN
-#endif
-#ifdef LDBL_EPSILON
-#undef LDBL_EPSILON
-#endif
-#endif
-
 static int
 not_here(char *s)
 {
@@ -564,11 +546,7 @@ not_here(char *s)
 }
 
 static
-#if defined(HAS_LONG_DOUBLE) && (LONG_DOUBLESIZE > DOUBLESIZE)
-long double
-#else
-double
-#endif
+NV
 constant(char *name, int arg)
 {
     errno = 0;
@@ -1528,7 +1506,7 @@ constant(char *name, int arg)
     case 'H':
 	if (strEQ(name, "HUGE_VAL"))
 #if defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)
-	  /* HUGE_VALL is admittedly non-POSIX but if are using long doubles
+	  /* HUGE_VALL is admittedly non-POSIX but if we are using long doubles
 	   * we might as well use long doubles. --jhi */
 	    return HUGE_VALL;
 #endif
@@ -3020,7 +2998,7 @@ setcc(termios_ref, ccix, cc)
 
 MODULE = POSIX		PACKAGE = POSIX
 
-double
+NV
 constant(name,arg)
 	char *		name
 	int		arg
@@ -3309,73 +3287,73 @@ setlocale(category, locale = 0)
 	RETVAL
 
 
-double
+NV
 acos(x)
-	double		x
+	NV		x
 
-double
+NV
 asin(x)
-	double		x
+	NV		x
 
-double
+NV
 atan(x)
-	double		x
+	NV		x
 
-double
+NV
 ceil(x)
-	double		x
+	NV		x
 
-double
+NV
 cosh(x)
-	double		x
+	NV		x
 
-double
+NV
 floor(x)
-	double		x
+	NV		x
 
-double
+NV
 fmod(x,y)
-	double		x
-	double		y
+	NV		x
+	NV		y
 
 void
 frexp(x)
-	double		x
+	NV		x
     PPCODE:
 	int expvar;
 	/* (We already know stack is long enough.) */
 	PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
 	PUSHs(sv_2mortal(newSViv(expvar)));
 
-double
+NV
 ldexp(x,exp)
-	double		x
+	NV		x
 	int		exp
 
-double
+NV
 log10(x)
-	double		x
+	NV		x
 
 void
 modf(x)
-	double		x
+	NV		x
     PPCODE:
-	double intvar;
+	NV intvar;
 	/* (We already know stack is long enough.) */
 	PUSHs(sv_2mortal(newSVnv(Perl_modf(x,&intvar))));
 	PUSHs(sv_2mortal(newSVnv(intvar)));
 
-double
+NV
 sinh(x)
-	double		x
+	NV		x
 
-double
+NV
 tan(x)
-	double		x
+	NV		x
 
-double
+NV
 tanh(x)
-	double		x
+	NV		x
 
 SysRet
 sigaction(sig, action, oldaction = 0)
diff --git a/ext/POSIX/typemap b/ext/POSIX/typemap
index 63e41c7..baf9bfc 100644
--- a/ext/POSIX/typemap
+++ b/ext/POSIX/typemap
@@ -5,6 +5,7 @@ Time_t			T_NV
 Gid_t			T_NV
 Off_t			T_NV
 Dev_t			T_NV
+NV			T_NV
 fd			T_IV
 speed_t			T_IV
 tcflag_t		T_IV