add more functions required by fma

This commit is contained in:
christos 2013-02-11 01:47:04 +00:00
parent 2ee19bcb19
commit be32181245
3 changed files with 29 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.129 2013/02/11 01:29:58 christos Exp $
# $NetBSD: Makefile,v 1.130 2013/02/11 01:47:04 christos Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@ -67,7 +67,9 @@ COMMON_SRCS+= fenv.c
.PATH: ${.CURDIR}/arch/i387
COMMON_SRCS+= fenv.c s_nextafterl.c s_nexttoward.c s_nexttowardf.c \
s_nearbyint.c s_rintl.c s_fma.c s_fmaf.c s_fmal.c # s_nan.c
s_nearbyint.c s_rintl.c s_fma.c s_fmaf.c s_fmal.c \
s_scalbln.c s_frexpl.c # s_nan.c
ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
e_logf.S e_log10.S e_log10f.S e_log2.S e_log2f.S e_remainder.S \
e_remainderf.S e_scalb.S e_scalbf.S e_sqrt.S e_sqrtf.S s_atan.S \

View File

@ -1,3 +1,5 @@
/* $NetBSD: s_frexpl.c,v 1.2 2013/02/11 01:47:04 christos Exp $ */
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@ -26,11 +28,16 @@
* $FreeBSD: src/lib/msun/src/s_frexpl.c,v 1.1 2005/03/07 04:54:51 das Exp $
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: s_frexpl.c,v 1.2 2013/02/11 01:47:04 christos Exp $");
#include <machine/ieee.h>
#include <float.h>
#include <math.h>
#include "fpmath.h"
#include "math_private.h"
#ifdef EXT_EXPBITS
#if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format"
#endif
@ -38,25 +45,26 @@
long double
frexpl(long double x, int *ex)
{
union IEEEl2bits u;
union ieee_ext_u u;
u.e = x;
switch (u.bits.exp) {
u.extu_ld = x;
switch (u.extu_ext.ext_exp) {
case 0: /* 0 or subnormal */
if ((u.bits.manl | u.bits.manh) == 0) {
if ((u.extu_ext.ext_fracl | u.extu_ext.ext_frach) == 0) {
*ex = 0;
} else {
u.e *= 0x1.0p514;
*ex = u.bits.exp - 0x4200;
u.bits.exp = 0x3ffe;
u.extu_ld *= 0x1.0p514;
*ex = u.extu_ext.ext_exp - 0x4200;
u.extu_ext.ext_exp = 0x3ffe;
}
break;
case 0x7fff: /* infinity or NaN; value of *ex is unspecified */
break;
default: /* normal */
*ex = u.bits.exp - 0x3ffe;
u.bits.exp = 0x3ffe;
*ex = u.extu_ext.ext_exp - 0x3ffe;
u.extu_ext.ext_exp = 0x3ffe;
break;
}
return (u.e);
return (u.extu_ld);
}
#endif

View File

@ -1,3 +1,5 @@
/* $NetBSD: s_scalbln.c,v 1.2 2013/02/11 01:47:04 christos Exp $ */
/*-
* Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@ -25,7 +27,11 @@
*/
#include <sys/cdefs.h>
#if 0
__FBSDID("$FreeBSD: src/lib/msun/src/s_scalbln.c,v 1.2 2005/03/07 04:57:50 das Exp $");
#else
__RCSID("$NetBSD: s_scalbln.c,v 1.2 2013/02/11 01:47:04 christos Exp $");
#endif
#include <limits.h>
#include <math.h>