Add scalbnl to libm.

This commit is contained in:
joerg 2011-07-26 16:10:15 +00:00
parent 6fc42c7792
commit afda0f82d1
16 changed files with 147 additions and 32 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: ad.mips64eb,v 1.61 2011/07/25 03:09:51 christos Exp $
# $NetBSD: ad.mips64eb,v 1.62 2011/07/26 16:10:15 joerg Exp $
./libexec/ld.elf_so-64 base-compat-shlib compat,pic
./libexec/ld.elf_so-o32 base-sysutil-bin compat,pic
./usr/lib/64 base-compat-lib
@ -154,7 +154,7 @@
./usr/lib/64/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/64/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/64/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/64/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/64/libmenu.so.6 base-compat-shlib compat,pic
@ -438,7 +438,7 @@
./usr/lib/o32/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/o32/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/o32/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/o32/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/o32/libmenu.so.6 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: ad.mips64el,v 1.58 2011/07/25 03:09:51 christos Exp $
# $NetBSD: ad.mips64el,v 1.59 2011/07/26 16:10:15 joerg Exp $
./libexec/ld.elf_so-64 base-compat-shlib compat,pic
./libexec/ld.elf_so-o32 base-sysutil-bin compat,pic
./usr/lib/64 base-compat-lib
@ -154,7 +154,7 @@
./usr/lib/64/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/64/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/64/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/64/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/64/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/64/libmenu.so.6 base-compat-shlib compat,pic
@ -438,7 +438,7 @@
./usr/lib/o32/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/o32/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/o32/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/o32/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/o32/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/o32/libmenu.so.6 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: md.amd64,v 1.131 2011/07/25 03:09:51 christos Exp $
# $NetBSD: md.amd64,v 1.132 2011/07/26 16:10:15 joerg Exp $
./dev/lms0 base-obsolete obsolete
./dev/mms0 base-obsolete obsolete
./libexec/ld.elf_so-i386 base-sys-shlib compat,pic
@ -164,7 +164,7 @@
./usr/lib/i386/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/i386/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/i386/libm.so.0 base-compat-shlib compat,pic
./usr/lib/i386/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/i386/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/i386/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/i386/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/i386/libmenu.so.6 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: md.sparc64,v 1.125 2011/07/25 03:09:52 christos Exp $
# $NetBSD: md.sparc64,v 1.126 2011/07/26 16:10:15 joerg Exp $
./libexec/ld.elf_so-sparc base-sysutil-bin compat,pic
./sbin/edlabel base-sysutil-root obsolete
./usr/bin/fdformat base-util-bin
@ -156,7 +156,7 @@
./usr/lib/sparc/liblzma.so.1 base-compat-shlib compat,pic
./usr/lib/sparc/liblzma.so.1.0 base-compat-shlib compat,pic
./usr/lib/sparc/libm.so.0 base-compat-shlib compat,pic
./usr/lib/sparc/libm.so.0.9 base-compat-shlib compat,pic
./usr/lib/sparc/libm.so.0.10 base-compat-shlib compat,pic
./usr/lib/sparc/libmagic.so.3 base-compat-shlib compat,pic
./usr/lib/sparc/libmagic.so.3.1 base-compat-shlib compat,pic
./usr/lib/sparc/libmenu.so.6 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: shl.mi,v 1.594 2011/07/25 03:09:52 christos Exp $
# $NetBSD: shl.mi,v 1.595 2011/07/26 16:10:15 joerg Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -48,7 +48,7 @@
./lib/liblzma.so.1.0 base-sys-shlib dynamicroot
./lib/libm.so base-sys-shlib dynamicroot
./lib/libm.so.0 base-sys-shlib dynamicroot
./lib/libm.so.0.9 base-sys-shlib dynamicroot
./lib/libm.so.0.10 base-sys-shlib dynamicroot
./lib/libprop.so base-sys-shlib dynamicroot
./lib/libprop.so.1 base-sys-shlib dynamicroot
./lib/libprop.so.1.1 base-sys-shlib dynamicroot
@ -313,7 +313,7 @@
./usr/lib/liblzf.so.0.0 base-sys-shlib
./usr/lib/libm.so base-sys-shlib
./usr/lib/libm.so.0 base-sys-shlib
./usr/lib/libm.so.0.9 base-sys-shlib
./usr/lib/libm.so.0.10 base-sys-shlib
./usr/lib/libmagic.so base-sys-shlib
./usr/lib/libmagic.so.3 base-sys-shlib
./usr/lib/libmagic.so.3.1 base-sys-shlib

View File

@ -1,4 +1,4 @@
# $NetBSD: ad.mips64eb,v 1.46 2011/07/25 03:09:52 christos Exp $
# $NetBSD: ad.mips64eb,v 1.47 2011/07/26 16:10:15 joerg Exp $
./usr/bin/elf2aout comp-obsolete obsolete
./usr/bin/elf2ecoff comp-sysutil-bin
./usr/include/gcc-4.5/loongson.h comp-c-include gcccmds,gcc=45
@ -1289,7 +1289,7 @@
./usr/libdata/debug/usr/lib/64/liblwres.so.5.3.debug comp-bind-debug debug,compat
./usr/libdata/debug/usr/lib/64/liblzf.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/liblzma.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libm.so.0.9.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libm.so.0.10.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmagic.so.3.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmenu.so.6.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmj.so.1.0.debug comp-crypto-debug debug,compat
@ -1437,7 +1437,7 @@
./usr/libdata/debug/usr/lib/o32/liblwres.so.5.3.debug comp-bind-debug debug,compat
./usr/libdata/debug/usr/lib/o32/liblzf.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/liblzma.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libm.so.0.9.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libm.so.0.10.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmagic.so.3.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmenu.so.6.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmj.so.1.0.debug comp-crypto-debug debug,compat

View File

@ -1,4 +1,4 @@
# $NetBSD: ad.mips64el,v 1.46 2011/07/25 03:09:52 christos Exp $
# $NetBSD: ad.mips64el,v 1.47 2011/07/26 16:10:16 joerg Exp $
./usr/bin/elf2aout comp-obsolete obsolete
./usr/bin/elf2ecoff comp-sysutil-bin
./usr/include/gcc-4.5/loongson.h comp-c-include gcccmds,gcc=45
@ -1289,7 +1289,7 @@
./usr/libdata/debug/usr/lib/64/liblwres.so.5.3.debug comp-bind-debug debug,compat
./usr/libdata/debug/usr/lib/64/liblzf.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/liblzma.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libm.so.0.9.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libm.so.0.10.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmagic.so.3.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmenu.so.6.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/64/libmj.so.1.0.debug comp-crypto-debug debug,compat
@ -1437,7 +1437,7 @@
./usr/libdata/debug/usr/lib/o32/liblwres.so.5.3.debug comp-bind-debug debug,compat
./usr/libdata/debug/usr/lib/o32/liblzf.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/liblzma.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libm.so.0.9.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libm.so.0.10.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmagic.so.3.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmenu.so.6.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/o32/libmj.so.1.0.debug comp-crypto-debug debug,compat

View File

@ -1,4 +1,4 @@
# $NetBSD: md.amd64,v 1.127 2011/07/25 03:09:52 christos Exp $
# $NetBSD: md.amd64,v 1.128 2011/07/26 16:10:16 joerg Exp $
./usr/include/amd64 comp-c-include
./usr/include/amd64/ansi.h comp-c-include
./usr/include/amd64/aout_machdep.h comp-c-include
@ -1065,7 +1065,7 @@
./usr/libdata/debug/usr/lib/i386/liblwres.so.5.3.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/liblzf.so.0.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/liblzma.so.1.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libm.so.0.9.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libm.so.0.10.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libmagic.so.3.1.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libmenu.so.6.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libmj.so.1.0.debug comp-compat-shlib compat,pic,debug

View File

@ -1,4 +1,4 @@
# $NetBSD: md.sparc64,v 1.113 2011/07/25 03:09:52 christos Exp $
# $NetBSD: md.sparc64,v 1.114 2011/07/26 16:10:16 joerg Exp $
./usr/include/gcc-4.5/tgmath.h comp-c-include gcccmds,gcc=45
./usr/include/ieeefp.h comp-c-include
./usr/include/sparc comp-c-include
@ -928,7 +928,7 @@
./usr/libdata/debug/usr/lib/sparc/liblwres.so.5.3.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/liblzf.so.0.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/liblzma.so.1.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libm.so.0.9.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libm.so.0.10.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libmagic.so.3.1.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libmenu.so.6.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libmj.so.1.0.debug comp-compat-shlib compat,pic,debug

View File

@ -1,4 +1,4 @@
# $NetBSD: shl.mi,v 1.183 2011/07/25 03:09:52 christos Exp $
# $NetBSD: shl.mi,v 1.184 2011/07/26 16:10:16 joerg Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -290,7 +290,7 @@
./usr/libdata/debug/usr/lib/liblwres.so.5.3.debug comp-bind-debug debug
./usr/libdata/debug/usr/lib/liblzf.so.0.0.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/liblzma.so.1.0.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libm.so.0.9.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libm.so.0.10.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libmagic.so.3.1.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libmenu.so.6.0.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libmj.so.1.0.debug comp-crypto-debug debug

View File

@ -1,4 +1,4 @@
/* $NetBSD: math.h,v 1.54 2011/02/06 00:44:08 christos Exp $ */
/* $NetBSD: math.h,v 1.55 2011/07/26 16:10:15 joerg Exp $ */
/*
* ====================================================
@ -497,6 +497,9 @@ int __isinfl(long double);
int __isnanl(long double);
int __signbitl(long double);
#endif
long double scalbnl(long double, int);
__END_DECLS
#endif /* _MATH_H_ */

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.111 2011/06/20 07:43:58 mrg Exp $
# $NetBSD: Makefile,v 1.112 2011/07/26 16:10:16 joerg Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@ -140,7 +140,7 @@ COMMON_SRCS+= e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \
s_isinff.c s_isnanf.c s_ldexpf.c s_lib_version.c s_log1p.c \
s_log1pf.c s_logb.c s_logbf.c s_matherr.c s_modff.c s_nextafter.c \
s_nextafterf.c s_remquo.c s_remquof.c s_rint.c s_rintf.c s_round.c s_roundf.c s_scalbn.c \
s_scalbnf.c s_signgam.c s_significand.c s_significandf.c s_sin.c \
s_scalbnf.c s_scalbnl.c s_signgam.c s_significand.c s_significandf.c s_sin.c \
s_sinf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_trunc.c s_truncf.c \
w_acos.c w_acosf.c w_acosh.c w_acoshf.c w_asin.c w_asinf.c w_atan2.c \
w_atan2f.c w_atanh.c w_atanhf.c w_cosh.c w_coshf.c \

View File

@ -1,5 +1,5 @@
# $NetBSD: shlib_version,v 1.12 2011/02/06 00:44:09 christos Exp $
# $NetBSD: shlib_version,v 1.13 2011/07/26 16:10:16 joerg Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=0
minor=9
minor=10

View File

@ -1,4 +1,4 @@
/* $NetBSD: namespace.h,v 1.3 2010/04/23 19:17:07 drochner Exp $ */
/* $NetBSD: namespace.h,v 1.4 2011/07/26 16:10:16 joerg Exp $ */
#define atan2 _atan2
#define atan2f _atan2f
@ -32,3 +32,4 @@
#define scalbn _scalbn
#define scalbnf _scalbnf
#define scalbnl _scalbnl

View File

@ -12,7 +12,7 @@
#include <sys/cdefs.h>
#if defined(LIBM_SCCS) && !defined(lint)
__RCSID("$NetBSD: s_scalbn.c,v 1.14 2010/04/23 19:17:07 drochner Exp $");
__RCSID("$NetBSD: s_scalbn.c,v 1.15 2011/07/26 16:10:16 joerg Exp $");
#endif
/*
@ -26,6 +26,11 @@ __RCSID("$NetBSD: s_scalbn.c,v 1.14 2010/04/23 19:17:07 drochner Exp $");
#include "math.h"
#include "math_private.h"
#ifndef __HAVE_LONG_DOUBLE
__strong_alias(_scalbnl, _scalbn)
__weak_alias(scalbnl, _scalbnl)
#endif
#ifdef __weak_alias
__weak_alias(scalbn, _scalbn)
#endif

106
lib/libm/src/s_scalbnl.c Normal file
View File

@ -0,0 +1,106 @@
/* $NetBSD: s_scalbnl.c,v 1.1 2011/07/26 16:10:16 joerg Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Joerg Sonnenberger.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: s_scalbnl.c,v 1.1 2011/07/26 16:10:16 joerg Exp $");
#include "namespace.h"
#include <float.h>
#include <math.h>
#include <machine/ieee.h>
#ifdef __HAVE_LONG_DOUBLE
#ifdef __weak_alias
__weak_alias(scalbnl, _scalbnl)
#endif
#if LDBL_MANT_DIG == 64
#define FROM_UNDERFLOW 0x1p65L
#define TO_UNDERFLOW 0x1p-65L
#elif LDBL_MANT_DIG == 113
#define FROM_UNDERFLOW 0x1p114L
#define TO_UNDERFLOW 0x1p-114L
#else
#error Unsupported long double format
#endif
long double
scalbnl(long double x, int n)
{
union ieee_ext_u u;
/* Trivial cases first */
if (n == 0 || x == 0.0L)
return x;
u.extu_ld = x;
/* NaN and infinite don't change either, but trigger exception */
if (u.extu_ext.ext_exp == EXT_EXP_INFNAN)
return x + x;
/* Protect against integer overflow in calculation of new exponent */
if (n > LDBL_MAX_EXP - LDBL_MIN_EXP + LDBL_MANT_DIG)
goto overflow;
if (n < LDBL_MAX_EXP - LDBL_MIN_EXP + LDBL_MANT_DIG)
goto underflow;
/* Scale denormalized numbers slightly, so that they are normal */
if (u.extu_ext.ext_exp == 0) {
u.extu_ld *= FROM_UNDERFLOW;
n -= LDBL_MANT_DIG + 1;
}
n += u.extu_ext.ext_exp;
if (n >= LDBL_MAX_EXP + EXT_EXP_BIAS)
goto overflow;
/* Positive exponent (incl. bias) means normal result */
if (n > 0) {
u.extu_ext.ext_exp = n;
return u.extu_ld;
}
/* Shift the exponent and let the multiply below handle subnormal */
n += LDBL_MANT_DIG + 1;
if (n <= 0)
goto underflow;
u.extu_ext.ext_exp = n;
return u.extu_ld * TO_UNDERFLOW;
underflow:
return LDBL_MIN * copysignl(LDBL_MIN, x);
overflow:
return LDBL_MAX * copysignl(LDBL_MAX, x);
}
#endif