about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-30 16:12:42 +0000
committerRoland McGrath <roland@gnu.org>1996-05-30 16:12:42 +0000
commit76060ec0b8b5d6f0a860a94f100dc6e48041bac3 (patch)
treeb4ff1b5370a30a16705239598cb8e98f4b80b9ca /sysdeps/libm-ieee754
parentc3352e623384fe221743a6d2212c17d9619041ef (diff)
downloadglibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.gz
glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.xz
glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.zip
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> cvs/libc-960602 cvs/libc-960601 cvs/libc-960531
	* po/header.pot: Replace with exact boilerplate pinard dictates.

	* sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set
	errno and the check that jumped to it.

	* sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx).

Thu May 30 03:21:57 1996  Ulrich Drepper  <drepper@cygnus.com>

	* FAQ: Document need of gperf program for developers.

	* elf/elf.h: Fix typos in comments.

	* libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add
        prototypes for `ctermid' and `cuserid'.

	* locale/programs/locale.c: Switch to user selected locale
	before printing variables.

	* math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines
        and long-c-routines.  Only if the `long double' data type is
        available we need to compile the functions.
	(libm-routines): Add $(long-m-routines).
	(routines): Remove isinfl, isnanl.  Use new file s_isinfl and
	s_isnanl instead if `long double' is available.

	* math/math.h: Include <mathcalls.h> again to define `long double'
        functions.

	* math/math_private.h: Define data types, prototypes and access
        macros for `long double'.

	* stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'.
	[GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which
	calls __strto{,u}q_internal.

	* stdlib/strfmon.c: Replace PTR by `void *'.

	* stdlib/strtoq.c: Define strtoll as weak alias.
	* stdlib/strtouq.c: Define strtoull as weak alias.

	* string/tester.c: Correct `strsep' test.

	* sysdeps/generic/strsep.c: Make compatible with BSD version.
        Trailing characters of skip set are not skipped.  In this case
        empty tokens are returned.

	* sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c,
        sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c,
        sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed.  We
        now use the versions part of libm.

	* sysdeps/i386/strsep.S: Removed.  Generic C version is of
	similar speed.
	* sysdeps/i386/strtok.S: Remove support for `strsep'.

	* sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S,
        sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S,
        sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c,
        sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c,
        sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S:
        New i387 specific math functions implementing `long double'
        versions.

	* sysdeps/libm-ieee754/s_ceill.c,
        sysdeps/libm-ieee754/s_copysignl.c,
        sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c,
        sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c,
        sysdeps/libm-ieee754/s_isnanl.c,
        sysdeps/libm-ieee754/s_nextafterl.c,
        sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c,
        sysdeps/libm-ieee754/s_significandl.c: New generic `long double'
        versions of libm functions.

	* sysdeps/libm-i387/e_exp.S: Add a few comments to explain the
        Intel FPU nonsense.

	* sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S,
        sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct
        handling of local variables.  The old version created a stack
        frame but stored the values outside.

	* sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c
        [!NO_LONG_DOUBLE]: Define alias with `long double' versions name.

	* login/pututline_r.c: Include sys/stat.h.  Fix typos.

        according to currently used locale for category LC_CTYPE by
	inet_nsap_ntoa.  Now in <arpa/inet.h>.
        _IO_dup2 to contain complete parameter list.
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/s_ceill.c89
-rw-r--r--sysdeps/libm-ieee754/s_copysignl.c43
-rw-r--r--sysdeps/libm-ieee754/s_fabsl.c40
-rw-r--r--sysdeps/libm-ieee754/s_finitel.c40
-rw-r--r--sysdeps/libm-ieee754/s_floorl.c89
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c3
-rw-r--r--sysdeps/libm-ieee754/s_isinfl.c33
-rw-r--r--sysdeps/libm-ieee754/s_isnan.c7
-rw-r--r--sysdeps/libm-ieee754/s_isnanl.c44
-rw-r--r--sysdeps/libm-ieee754/s_nextafterl.c99
-rw-r--r--sysdeps/libm-ieee754/s_rintl.c96
-rw-r--r--sysdeps/libm-ieee754/s_scalbnl.c71
-rw-r--r--sysdeps/libm-ieee754/s_significandl.c39
13 files changed, 691 insertions, 2 deletions
diff --git a/sysdeps/libm-ieee754/s_ceill.c b/sysdeps/libm-ieee754/s_ceill.c
new file mode 100644
index 0000000000..c5c86487ea
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_ceill.c
@@ -0,0 +1,89 @@
+/* s_ceill.c -- long double version of s_ceil.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * ceill(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ *	Bit twiddling.
+ * Exception:
+ *	Inexact flag raised if x not equal to ceil(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double huge = 1.0e4930;
+#else
+static long double huge = 1.0e4930;
+#endif
+
+#ifdef __STDC__
+	long double __ceill(long double x)
+#else
+	long double __ceill(x)
+	long double x;
+#endif
+{
+	int32_t i1,j0;
+	u_int32_t i,j,se,i0,sx;
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
+	sx = (se>>15)&1;
+	j0 = (se&0x7fff)-0x3fff;
+	if(j0<32) {
+	    if(j0<0) { 	/* raise inexact if x != 0 */
+		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+		    if(sx) {es=0x8000;i0=0;i1=0;}
+		    else if((i0|i1)!=0) { es=0x3fff;i0=0;i1=0;}
+		}
+	    } else {
+		i = (0xffffffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		if(huge+x>0.0) {	/* raise inexact flag */
+		    if(sx==0) {
+			if (j0>0) i0 += (0x80000000)>>(j0-1);
+			else ++se;
+		    }
+		    i0 &= (~i); i1=0;
+		}
+	    }
+	} else if (j0>63) {
+	    if(j0==0x4000) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((u_int32_t)(0xffffffff))>>(j0-32);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    if(huge+x>0.0) { 		/* raise inexact flag */
+		if(sx==0) {
+		    if(j0==32) i0+=1;
+		    else {
+			j = i1 + (1<<(64-j0));
+			if(j<i1) i0+=1;	/* got a carry */
+			i1 = j;
+		    }
+		}
+		i1 &= (~i);
+	    }
+	}
+	SET_LDOUBLE_WORDS(x,se,i0,i1);
+	return x;
+}
+weak_alias (__ceill, ceill)
diff --git a/sysdeps/libm-ieee754/s_copysignl.c b/sysdeps/libm-ieee754/s_copysignl.c
new file mode 100644
index 0000000000..9976575b3b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_copysignl.c
@@ -0,0 +1,43 @@
+/* s_copysignl.c -- long double version of s_copysign.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * copysignl(long double x, long double y)
+ * copysignl(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __copysignl(long double x, long double y)
+#else
+	long double __copysignl(x,y)
+	long double x,y;
+#endif
+{
+	u_int32_t es1,es2;
+	GET_LDOUBLE_EXP(es1,x);
+	GET_LDOUBLE_EXP(es2,y);
+	SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
+        return x;
+}
+weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/libm-ieee754/s_fabsl.c b/sysdeps/libm-ieee754/s_fabsl.c
new file mode 100644
index 0000000000..f7170503fb
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fabsl.c
@@ -0,0 +1,40 @@
+/* s_fabsl.c -- long double version of s_fabs.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * fabsl(x) returns the absolute value of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __fabsl(long double x)
+#else
+	long double __fabsl(x)
+	long double x;
+#endif
+{
+	u_int32_t exp;
+	GET_LDOUBLE_EXP(exp,x);
+	SET_LDOUBLE_EXP(x,exp&0x7fff);
+        return x;
+}
+weak_alias (__fabsl, fabsl)
diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c
new file mode 100644
index 0000000000..02487c610d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_finitel.c
@@ -0,0 +1,40 @@
+/* s_finitel.c -- long double version of s_finite.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * finitel(x) returns 1 is x is finite, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	int __finite(long double x)
+#else
+	int __finite(x)
+	long double x;
+#endif
+{
+	int32_t exp;
+	GET_LDOUBLE_EXP(exp,x);
+	return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>15);
+}
+weak_alias (__finitel, finitel)
diff --git a/sysdeps/libm-ieee754/s_floorl.c b/sysdeps/libm-ieee754/s_floorl.c
new file mode 100644
index 0000000000..8cd81c6302
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_floorl.c
@@ -0,0 +1,89 @@
+/* s_floorl.c -- long double version of s_floor.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * floorl(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ *	Bit twiddling.
+ * Exception:
+ *	Inexact flag raised if x not equal to floor(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double huge = 1.0e4930;
+#else
+static long double huge = 1.0e4930;
+#endif
+
+#ifdef __STDC__
+	long double __floorl(long double x)
+#else
+	long double __floorl(x)
+	long double x;
+#endif
+{
+	int32_t i1,j0;
+	u_int32_t i,j,se,i0,sx;
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
+	sx = (se>>15)&1;
+	j0 = (se&0x7fff)-0x3fff;
+	if(j0<32) {
+	    if(j0<0) { 	/* raise inexact if x != 0 */
+		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+		    if(sx==0) {se=0;i0=i1=0;}
+		    else if(((se&0x7fff)|i0|i1)!=0)
+			{ se=0xbfff;i0;i1=0;}
+		}
+	    } else {
+		i = (0xffffffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		if(huge+x>0.0) {	/* raise inexact flag */
+		    if(sx) {
+			if (j0>0) i0 += (0x80000000)>>(j0-1);
+			else ++se;
+		    i0 &= (~i); i1=0;
+		}
+	    }
+	} else if (j0>63) {
+	    if(j0==0x4000) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((u_int32_t)(0xffffffff))>>(j0-32);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    if(huge+x>0.0) { 		/* raise inexact flag */
+		if(sx) {
+		    if(j0==32) i0+=1;
+		    else {
+			j = i1+(1<<(64-j0));
+			if(j<i1) i0 +=1 ; 	/* got a carry */
+			i1=j;
+		    }
+		}
+		i1 &= (~i);
+	    }
+	}
+	SET_LDOUBLE_WORDS(x,se,i0,i1);
+	return x;
+}
+weak_alias (__floorl, floorl)
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index a54d97cba6..6d435f00b2 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -30,3 +30,6 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
 	return (hx == 0);
 }
 weak_alias (__isinf, isinf)
+#ifdef NO_LONG_DOUBLE
+weak_alias (__isinf, isinfl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_isinfl.c b/sysdeps/libm-ieee754/s_isinfl.c
new file mode 100644
index 0000000000..22dff75444
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_isinfl.c
@@ -0,0 +1,33 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isinfl(x) returns 1 is x is inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	int __isinfl(long double x)
+#else
+	int __isinfl(x)
+	long double x;
+#endif
+{
+	int32_t se,hx,lx;
+	GET_LDOUBLE_WORDS(se,hx,lx,x);
+	se &= 0x7fff;
+	se ^= 0x7fff;
+	se |= hx | lx;
+	return (se == 0);
+}
+weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/libm-ieee754/s_isnan.c b/sysdeps/libm-ieee754/s_isnan.c
index 2609a51968..4d8983c9b3 100644
--- a/sysdeps/libm-ieee754/s_isnan.c
+++ b/sysdeps/libm-ieee754/s_isnan.c
@@ -5,7 +5,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -32,8 +32,11 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
 	int32_t hx,lx;
 	EXTRACT_WORDS(hx,lx,x);
 	hx &= 0x7fffffff;
-	hx |= (u_int32_t)(lx|(-lx))>>31;	
+	hx |= (u_int32_t)(lx|(-lx))>>31;
 	hx = 0x7ff00000 - hx;
 	return (int)((u_int32_t)(hx))>>31;
 }
 weak_alias (__isnan, isnan)
+#ifdef NO_LONG_DOUBLE
+weak_alias (__isnan, isnanl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_isnanl.c b/sysdeps/libm-ieee754/s_isnanl.c
new file mode 100644
index 0000000000..0da97090bd
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_isnanl.c
@@ -0,0 +1,44 @@
+/* s_isnanl.c -- long double version of s_isnan.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isnanl(x) returns 1 is x is nan, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	int __isnanl(long double x)
+#else
+	int __isnanl(x)
+	long double x;
+#endif
+{
+	int32_t se,hx,lx;
+	GET_LDOUBLE_WORDS(se,hx,lx,x);
+	se = (se & 0x7fff) << 1;
+	hx |= lx;
+	se |= (u_int32_t)(hx|(-hx))>>31;
+	se = 0xfffe - se;
+	return (int)((u_int32_t)(se))>>16;
+}
+weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c
new file mode 100644
index 0000000000..0327261f33
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterl.c
@@ -0,0 +1,99 @@
+/* s_nextafterl.c -- long double version of s_nextafter.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ *	nextafterl(x,y)
+ *	return the next machine floating-point number of x in the
+ *	direction toward y.
+ *   Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __nextafterl(long double x, long double y)
+#else
+	long double __nextafterl(x,y)
+	long double x,y;
+#endif
+{
+	int32_t hx,hy,ix,iy;
+	u_int32_t lx,ly,esx,esy;
+
+	GET_LDOUBLE_WORDS(esx,hx,lx,x);
+	GET_LDOUBLE_WORDS(esy,hy,ly,y);
+	ix = esx&0x7fff;		/* |x| */
+	iy = esy&0x7fff;		/* |y| */
+
+	if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) ||   /* x is nan */
+	   ((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=0))     /* y is nan */
+	   return x+y;
+	if(x==y) return x;		/* x=y, return x */
+	if((ix|hx|lx)==0) {			/* x == 0 */
+	    SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */
+	    y = x*x;
+	    if(y==x) return y; else return x;	/* raise underflow flag */
+	}
+	if(esx<0x8000) {			/* x > 0 */
+	    if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
+	      /* x > y, x -= ulp */
+		if(lx==0) {
+		    if (hx==0) esx -= 1;
+		    hx -= 1;
+		}
+		lx -= 1;
+	    } else {				/* x < y, x += ulp */
+		lx += 1;
+		if(lx==0) {
+		    hx += 1;
+		    if (hx==0)
+			esx += 1;
+		}
+	    }
+	} else {				/* x < 0 */
+	    if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
+	      /* x < y, x -= ulp */
+		if(lx==0) {
+		    if (hx==0) esx -= 1;
+		    hx -= 1;
+		}
+		lx -= 1;
+	    } else {				/* x > y, x += ulp */
+		lx += 1;
+		if(lx==0) {
+		    hx += 1;
+		    if (hx==0) esx += 1;
+		}
+	    }
+	}
+	esy = esx&0x7fff;
+	if(esy==0x7fff) return x+x;	/* overflow  */
+	if(esy==0) {			/* underflow */
+	    y = x*x;
+	    if(y!=x) {		/* raise underflow flag */
+	        SET_LDOUBLE_WORDS(y,esx,hx,lx);
+		return y;
+	    }
+	}
+	SET_LDOUBLE_WORDS(x,esx,hx,lx);
+	return x;
+}
+weak_alias (__nextafterl, nextafterl)
diff --git a/sysdeps/libm-ieee754/s_rintl.c b/sysdeps/libm-ieee754/s_rintl.c
new file mode 100644
index 0000000000..c9f12b162a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_rintl.c
@@ -0,0 +1,96 @@
+/* s_rintl.c -- long double version of s_rint.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * rintl(x)
+ * Return x rounded to integral value according to the prevailing
+ * rounding mode.
+ * Method:
+ *	Using floating addition.
+ * Exception:
+ *	Inexact flag raised if x not equal to rintl(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+TWO64[2]={
+  1.844674407370955161600000e+19, /* 0x403F, 0x00000000, 0x00000000 */
+ -1.844674407370955161600000e+19, /* 0xC03F, 0x00000000, 0x00000000 */
+};
+
+#ifdef __STDC__
+	long double __rintl(long double x)
+#else
+	long double __rintl(x)
+	long double x;
+#endif
+{
+	int32_t se,j0,sx;
+	u_int32_t i,i0,i1;
+	long double w,t;
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
+	sx = (se>>15)&1;
+	j0 = (se&0x7fff)-0x3fff;
+	if(j0<32) {
+	    if(j0<0) {
+		if(((se&0x7fff)|i0|i1)==0) return x;
+		i1 |= i0;
+		i0 &= 0xe0000000;
+		i0 |= (i1|-i1)&0x80000000;
+		SET_LDOUBLE_MSW(x,i0);
+	        w = TWO64[sx]+x;
+	        t = w-TWO64[sx];
+		GET_LDOUBLE_EXP(i0,t);
+		SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
+	        return t;
+	    } else {
+		i = (0xffffffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		i>>=1;
+		if(((i0&i)|i1)!=0) {
+		    if(j0==31) i1 = 0x40000000; else
+		    i0 = (i0&(~i))|((0x20000000)>>j0);
+		    /* Shouldn't this be
+		         if (j0 >= 30) i1 = 0x80000000 >> (j0 - 30);
+		         i0 = (i0&(~i))|((0x20000000)>>j0);
+		       If yes, this should be correct in s_rint and
+		       s_rintf, too.  -- drepper@cygnus.com */
+		}
+	    }
+	} else if (j0>63) {
+	    if(j0==0x4000) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((u_int32_t)(0xffffffff))>>(j0-32);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    i>>=1;
+	    if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-32));
+	}
+	SET_LDOUBLE_WORDS(x,se,i0,i1);
+	w = TWO64[sx]+x;
+	return w-TWO64[sx];
+}
+weak_alias (__rintl, rintl)
diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c
new file mode 100644
index 0000000000..d00eb88167
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalbnl.c
@@ -0,0 +1,71 @@
+/* s_scalbnl.c -- long double version of s_scalbn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge   = 1.0e+300,
+tiny   = 1.0e-300;
+
+#ifdef __STDC__
+	long double __scalbnl (long double x, int n)
+#else
+	long double __scalbnl (x,n)
+	long double x; int n;
+#endif
+{
+	int32_t k,es,hx,lx;
+	GET_LDOUBLE_WORDS(es,hx,lx,x);
+        k = es&0x7fff;				/* extract exponent */
+        if (k==0) {				/* 0 or subnormal x */
+            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	    x *= two54;
+	    GET_HIGH_WORD(hx,x);
+	    k = ((hx&0x7ff00000)>>20) - 54;
+            if (n< -50000) return tiny*x; 	/*underflow*/
+	    }
+        if (k==0x7ff) return x+x;		/* NaN or Inf */
+        k = k+n;
+        if (k >  0x7fe) return huge*__copysign(huge,x); /* overflow  */
+        if (k > 0) 				/* normal result */
+	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
+        if (k <= -54)
+            if (n > 50000) 	/* in case integer overflow in n+k */
+		return huge*__copysign(huge,x);	/*overflow*/
+	    else return tiny*__copysign(tiny,x); 	/*underflow*/
+        k += 54;				/* subnormal result */
+	SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+        return x*twom54;
+}
+weak_alias (__scalbnl, scalbnl)
diff --git a/sysdeps/libm-ieee754/s_significandl.c b/sysdeps/libm-ieee754/s_significandl.c
new file mode 100644
index 0000000000..6339274b5a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_significandl.c
@@ -0,0 +1,39 @@
+/* s_significandl.c -- long double version of s_significand.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * significandl(x) computes just
+ * 	scalbl(x, (double) -ilogbl(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __significandl(long double x)
+#else
+	long double __significandl(x)
+	long double x;
+#endif
+{
+	return __ieee754_scalbl(x,(double) -ilogbl(x));
+}
+weak_alias (__significandl, significandl)