about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
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)