Support copysignl on PowerPC.

This commit is contained in:
joerg 2014-10-22 10:32:50 +00:00
parent 8bb734fd0d
commit 6602b2dcba
3 changed files with 23 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: s_copysignl.c,v 1.2 2010/09/17 20:39:39 christos Exp $ */
/* $NetBSD: s_copysignl.c,v 1.3 2014/10/22 10:32:50 joerg Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: s_copysignl.c,v 1.2 2010/09/17 20:39:39 christos Exp $");
__RCSID("$NetBSD: s_copysignl.c,v 1.3 2014/10/22 10:32:50 joerg Exp $");
#include <math.h>
#include <machine/ieee.h>
@ -48,4 +48,17 @@ copysignl(long double x, long double y)
return (ux.extu_ld);
}
#elif defined(__HAVE_IBM_LONGDOUBLE)
long double
copysignl(long double x, long double y)
{
union ldbl_u ux, uy;
ux.ldblu_ld = x;
uy.ldblu_ld = y;
ux.ldblu_d[0] = copysign(ux.ldblu_d[0], uy.ldblu_d[0]);
ux.ldblu_d[1] = copysign(ux.ldblu_d[1], uy.ldblu_d[1]);
return ux.ldblu_ld;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee.h,v 1.5 2005/12/11 12:18:43 christos Exp $ */
/* $NetBSD: ieee.h,v 1.6 2014/10/22 10:32:50 joerg Exp $ */
#include <sys/ieee754.h>
@ -11,3 +11,8 @@
#define SNG_QUIETNAN (1 << 22)
#define DBL_QUIETNAN (1 << 19)
#endif
union ldbl_u {
long double ldblu_ld;
double ldblu_d[2];
};

View File

@ -1,3 +1,4 @@
/* $NetBSD: math.h,v 1.4 2002/02/19 13:08:15 simonb Exp $ */
/* $NetBSD: math.h,v 1.5 2014/10/22 10:32:50 joerg Exp $ */
#define __HAVE_NANF
#define __HAVE_IBM_LONGDOUBLE /* Uses double-double as long double */