diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-04-19 16:48:03 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-04-19 16:48:03 +0000 |
commit | 8ed1cbfa28c59700ddf6eb4499ca2168dd5102ef (patch) | |
tree | 921a1d2f2291fde92afea666d8ceb2ad65c1f517 /lib | |
parent | 96b4e1796d2cb7605b65d985063a6fb9490658cb (diff) |
make ldexpf behavior consistent with the double and extended-precision
versions; spotted by kettenis@
while here also remove unused ldexp; it lives in libc
ok kettenis@, "looks good" millert@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libm/Makefile | 6 | ||||
-rw-r--r-- | lib/libm/src/s_ldexp.c | 37 | ||||
-rw-r--r-- | lib/libm/src/s_ldexpf.c | 31 | ||||
-rw-r--r-- | lib/libm/src/s_scalbnf.c | 8 |
4 files changed, 10 insertions, 72 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 3cf6e436d80..80ecc5dd1ac 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.65 2009/04/10 11:30:33 martynas Exp $ +# $OpenBSD: Makefile,v 1.66 2009/04/19 16:48:02 martynas Exp $ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ # # @(#)Makefile 5.1beta 93/09/24 @@ -94,7 +94,7 @@ COMMON_SRCS = b_exp__D.c b_log__D.c b_tgamma.c \ s_ctanhf.c s_erf.c s_erff.c s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c \ s_fabsf.c s_fdim.c s_fmax.c s_fmaxf.c s_fmin.c s_fminf.c \ s_floor.c s_floorf.c s_frexpf.c s_ilogb.c s_ilogbf.c \ - s_ldexpf.c s_log1p.c \ + s_log1p.c \ s_log1pf.c s_logb.c s_logbf.c s_llrint.c s_llrintf.c s_lrint.c \ s_lrintf.c s_modff.c s_nan.c \ s_nextafter.c s_nextafterf.c s_remquo.c s_remquof.c s_rint.c \ @@ -125,7 +125,7 @@ NOIEEE_SRCS = n_acosh.c n_argred.c n_asincos.c n_asinh.c n_atan.c \ n_sqrt.c n_support.c n_tan.c n_tanh.c n_tgamma.c # OpenBSD's C library supplies these functions: -#COMMON_SRCS+= s_fabs.c s_frexp.c s_ldexp.c s_modf.c +#COMMON_SRCS+= s_fabs.c s_frexp.c s_modf.c .if (${MACHINE_ARCH} == "vax") SRCS= ${NOIEEE_SRCS} ${NOIEEE_ARCH} diff --git a/lib/libm/src/s_ldexp.c b/lib/libm/src/s_ldexp.c deleted file mode 100644 index 5f03c4c73cb..00000000000 --- a/lib/libm/src/s_ldexp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* @(#)s_ldexp.c 5.1 93/09/24 */ -/* - * ==================================================== - * 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: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $"; -#endif - -#include <sys/cdefs.h> -#include <errno.h> -#include <float.h> -#include <math.h> - -#include "math_private.h" - -double -ldexp(double value, int exp) -{ - if(!finite(value)||value==0.0) return value; - value = scalbn(value,exp); - if(!finite(value)||value==0.0) errno = ERANGE; - return value; -} - -#if LDBL_MANT_DIG == 53 -#ifdef __weak_alias -__weak_alias(ldexpl, ldexp); -#endif /* __weak_alias */ -#endif /* LDBL_MANT_DIG == 53 */ diff --git a/lib/libm/src/s_ldexpf.c b/lib/libm/src/s_ldexpf.c deleted file mode 100644 index f992c0e7c84..00000000000 --- a/lib/libm/src/s_ldexpf.c +++ /dev/null @@ -1,31 +0,0 @@ -/* s_ldexpf.c -- float version of s_ldexp.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" -#include <errno.h> - -float -ldexpf(float value, int exp) -{ - if(!finitef(value)||value==(float)0.0) return value; - value = scalbnf(value,exp); - if(!finitef(value)||value==(float)0.0) errno = ERANGE; - return value; -} diff --git a/lib/libm/src/s_scalbnf.c b/lib/libm/src/s_scalbnf.c index 9b64fcad782..0f935db76cf 100644 --- a/lib/libm/src/s_scalbnf.c +++ b/lib/libm/src/s_scalbnf.c @@ -27,7 +27,7 @@ huge = 1.0e+30, tiny = 1.0e-30; float -scalbnf (float x, int n) +scalbnf(float x, int n) { int32_t k,ix; GET_FLOAT_WORD(ix,x); @@ -52,3 +52,9 @@ scalbnf (float x, int n) SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x*twom25; } + +float +ldexpf(float x, int n) +{ + return scalbnf(x, n); +} |