[libcxx+newlib] nexttoward{f,l,} shims for _LDBL_EQ_DBL systems

Jonathan Roelofs jonathan@codesourcery.com
Wed Sep 24 16:37:00 GMT 2014


Craig,

Thanks for the review!

On 9/23/14 7:17 PM, Craig Howland wrote:
> On 09/23/2014 04:33 PM, Jonathan Roelofs wrote:
>> Please see the attached patch.
>>
> Needs a ChangeLog entry.  Missing the patch for libm/common/Makefile.am.
Oops. I'm not very familiar with Newlib processes, so please let me know if I'm 
missing other things that you'd normally expect from such an upstream 
submission.... For example, some of my co-workers reminded me to also update 
COPYING.NEWLIB, and add copyright headers to the new files.
>
> Operationally, all looks OK, but aesthetically, the use of casting is
> inconsistent.  For example:
>
> +long double
> +nexttowardl (long double x, long double y)
> +{
> +  return nextafter((double)x, (double)y);
> +}
>
> The x and y arguments are cast to double to pass to nextafter(), but the return
> value is not cast to long double.  It works OK, but could be confusing.  Are the
> casts intended to highlight the spots where the double/long double equality is
> required?
Yeah, that was my intent.
> If so, it would probably be better to either cast in all places where
> it is theoretically needed, or to just leave them out.  The other existing
> functions of this style left all of them out (i.e. no casts from ld to d or d to
> ld)--see, for example, libm/common/nextafterl.c.  I suggest that the precedent
> is the better way.
Agreed, consistency is probably better.

Attached is a new version of this patch with these things addressed, and I've 
added another similar shim for log2l.


Cheers,

Jon
>
> Craig

-- 
Jon Roelofs
jonathan@codesourcery.com
CodeSourcery / Mentor Embedded
-------------- next part --------------
diff --git a/src/COPYING.NEWLIB b/src/COPYING.NEWLIB
index 0655d35..1cec9ad 100644
--- a/src/COPYING.NEWLIB
+++ b/src/COPYING.NEWLIB
@@ -934,20 +934,47 @@ 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 AUTHOR 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 AUTHOR 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.
 
+(42) - Mentor Graphics, Inc.
+
+Copyright (c) 2014 Mentor Graphics, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Mentor Graphics nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY MENTOR GRAPHICS, INC. ``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 MENTOR GRAPHICS 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.
+
diff --git a/src/ChangeLog b/src/ChangeLog
index 5bea065..f283dc4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,20 +1,24 @@
+2014-09-24  Jonathan Roelofs  <jonathan@codesourcery.com>
+
+	* COPYING.NEWLIB: Add Mentor Graphics copyright.
+
 2014-07-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* configure.ac: Don't accept isl 0.10.
 	* configure: Regenerate.
 
 2014-05-14  Sandra Loosemore  <sandra@codesourcery.com>
 
 	* configure.ac (target_makefile_frag): Set for nios2-*-elf*.
 	* configure: Regenerated.
 
 2014-04-04  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* COPYING.NEWLIB: Add to current TI license to
         include tirtos addition.
 
 2014-02-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	PR target/59788
 	* ltmain.sh (opt_duplicate_compiler_generated_deps): Enable on
 	*solaris2*.
diff --git a/src/newlib/ChangeLog b/src/newlib/ChangeLog
index a157623..5180ee3 100644
--- a/src/newlib/ChangeLog
+++ b/src/newlib/ChangeLog
@@ -1,20 +1,31 @@
+2014-09-24  Jonathan Roelofs  <jonathan@codesourcery.com>
+
+	* libc/include/math.h: Add nexttowardf,nexttoward,nexttowardl,logbl,and log2l.
+	* libm/common/logbl.c: New File.
+	* libm/common/log2l.c: Likewise.
+	* libm/common/nexttowardf.c: Likewise.
+	* libm/common/nexttoward.c: Likewise.
+	* libm/common/nexttowardl.c: Likewise.
+	* libm/common/Makefile.am: Add dependencies.
+	* libm/common/Makefile.in: Add dependencies.
+
 2014-09-17  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* libc/include/sys/features.h: Add __NEWLIB__ and
 	__NEWLIB_MINOR__ macros.
 
 2014-09-17  Joel Sherrill <joel.sherrill@oarcorp.com>
 	    Thomas Uhle <thomas.uhle@eas.iis.fraunhofer.de>
 
 	* libc/include/string.h: Correct guard for strnlen().
 
 2014-09-15  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* libc/time/month_lengths.c: Fix to define __month_lengths.
 
 2014-09-12  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* libc/time/tzcalc_limits.c: Fix __month_lengths reference.
 
 2014-09-12  Jeff Johnston  <jjohnstn@redhat.com>
 
diff --git a/src/newlib/libc/include/math.h b/src/newlib/libc/include/math.h
index 2da05f1..eda6146 100644
--- a/src/newlib/libc/include/math.h
+++ b/src/newlib/libc/include/math.h
@@ -405,40 +405,45 @@ extern long double acosl _PARAMS((long double));
 extern long double asinl _PARAMS((long double));
 extern long double atan2l _PARAMS((long double, long double));
 extern long double coshl _PARAMS((long double));
 extern long double sinhl _PARAMS((long double));
 extern long double expl _PARAMS((long double));
 extern long double ldexpl _PARAMS((long double, int));
 extern long double logl _PARAMS((long double));
 extern long double log10l _PARAMS((long double));
 extern long double powl _PARAMS((long double, long double));
 extern long double sqrtl _PARAMS((long double));
 extern long double fmodl _PARAMS((long double, long double));
 extern long double hypotl _PARAMS((long double, long double));
 #endif /* ! defined (__math_68881) */
 #endif /* ! defined (_REENT_ONLY) */
 extern long double copysignl _PARAMS((long double, long double));
 extern long double nanl _PARAMS((const char *));
 extern int ilogbl _PARAMS((long double));
 extern long double asinhl _PARAMS((long double));
 extern long double cbrtl _PARAMS((long double));
 extern long double nextafterl _PARAMS((long double, long double));
+extern float nexttowardf _PARAMS((float, long double));
+extern double nexttoward _PARAMS((double, long double));
+extern long double nexttowardl _PARAMS((long double, long double));
+extern long double logbl _PARAMS((long double));
+extern long double log2l _PARAMS((long double));
 extern long double rintl _PARAMS((long double));
 extern long double scalbnl _PARAMS((long double, int));
 extern long double exp2l _PARAMS((long double));
 extern long double scalblnl _PARAMS((long double, long));
 extern long double tgammal _PARAMS((long double));
 extern long double nearbyintl _PARAMS((long double));
 extern long int lrintl _PARAMS((long double));
 extern long long int llrintl _PARAMS((long double));
 extern long double roundl _PARAMS((long double));
 extern long lroundl _PARAMS((long double));
 extern _LONG_LONG_TYPE int llroundl _PARAMS((long double));
 extern long double truncl _PARAMS((long double));
 extern long double remquol _PARAMS((long double, long double, int *));
 extern long double fdiml _PARAMS((long double, long double));
 extern long double fmaxl _PARAMS((long double, long double));
 extern long double fminl _PARAMS((long double, long double));
 extern long double fmal _PARAMS((long double, long double, long double));
 #ifndef _REENT_ONLY
 extern long double acoshl _PARAMS((long double));
 extern long double atanhl _PARAMS((long double));
diff --git a/src/newlib/libm/common/Makefile.am b/src/newlib/libm/common/Makefile.am
index ed556ef..b370b2e 100644
--- a/src/newlib/libm/common/Makefile.am
+++ b/src/newlib/libm/common/Makefile.am
@@ -13,41 +13,43 @@ src = 	s_finite.c s_copysign.c s_modf.c s_scalbn.c \
 	s_lrint.c s_llrint.c \
 	s_lround.c s_llround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c \
 	s_signbit.c s_trunc.c
 
 fsrc =	sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \
 	sf_cbrt.c sf_exp10.c sf_expm1.c sf_ilogb.c \
 	sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \
 	sf_log1p.c sf_nan.c sf_nextafter.c sf_pow10.c \
 	sf_rint.c sf_logb.c sf_log2.c \
 	sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_fpclassify.c \
 	sf_lrint.c sf_llrint.c \
 	sf_lround.c sf_llround.c sf_nearbyint.c sf_remquo.c sf_round.c \
 	sf_scalbln.c sf_trunc.c
 
 lsrc =	atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.c \
 	floorl.c log1pl.c expm1l.c acosl.c asinl.c atan2l.c coshl.c sinhl.c \
 	expl.c ldexpl.c logl.c log10l.c powl.c sqrtl.c fmodl.c hypotl.c \
 	copysignl.c nanl.c ilogbl.c asinhl.c cbrtl.c nextafterl.c rintl.c \
 	scalbnl.c exp2l.c scalblnl.c tgammal.c nearbyintl.c lrintl.c llrintl.c \
 	roundl.c lroundl.c llroundl.c truncl.c remquol.c fdiml.c fmaxl.c fminl.c \
-	fmal.c acoshl.c atanhl.c remainderl.c lgammal.c erfl.c erfcl.c
+	fmal.c acoshl.c atanhl.c remainderl.c lgammal.c erfl.c erfcl.c \
+	logbl.c nexttowardf.c nexttoward.c nexttowardl.c log2l.c
+
 
 libcommon_la_LDFLAGS = -Xcompiler -nostdlib
 
 if USE_LIBTOOL
 noinst_LTLIBRARIES = libcommon.la
 libcommon_la_SOURCES = $(src) $(fsrc)
 if HAVE_LONG_DOUBLE
 libcommon_la_SOURCES += $(lsrc)
 endif # HAVE_LONG_DOUBLE
 noinst_DATA = objectlist.awk.in
 else
 noinst_LIBRARIES = lib.a
 lib_a_SOURCES = $(src) $(fsrc)
 if HAVE_LONG_DOUBLE
 lib_a_SOURCES += $(lsrc)
 endif # HAVE_LONG_DOUBLE
 lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
diff --git a/src/newlib/libm/common/Makefile.in b/src/newlib/libm/common/Makefile.in
index 12b5a30..7964531 100644
--- a/src/newlib/libm/common/Makefile.in
+++ b/src/newlib/libm/common/Makefile.in
@@ -119,74 +119,79 @@ am__objects_3 = lib_a-atanl.$(OBJEXT) lib_a-cosl.$(OBJEXT) \
 	lib_a-acosl.$(OBJEXT) lib_a-asinl.$(OBJEXT) \
 	lib_a-atan2l.$(OBJEXT) lib_a-coshl.$(OBJEXT) \
 	lib_a-sinhl.$(OBJEXT) lib_a-expl.$(OBJEXT) \
 	lib_a-ldexpl.$(OBJEXT) lib_a-logl.$(OBJEXT) \
 	lib_a-log10l.$(OBJEXT) lib_a-powl.$(OBJEXT) \
 	lib_a-sqrtl.$(OBJEXT) lib_a-fmodl.$(OBJEXT) \
 	lib_a-hypotl.$(OBJEXT) lib_a-copysignl.$(OBJEXT) \
 	lib_a-nanl.$(OBJEXT) lib_a-ilogbl.$(OBJEXT) \
 	lib_a-asinhl.$(OBJEXT) lib_a-cbrtl.$(OBJEXT) \
 	lib_a-nextafterl.$(OBJEXT) lib_a-rintl.$(OBJEXT) \
 	lib_a-scalbnl.$(OBJEXT) lib_a-exp2l.$(OBJEXT) \
 	lib_a-scalblnl.$(OBJEXT) lib_a-tgammal.$(OBJEXT) \
 	lib_a-nearbyintl.$(OBJEXT) lib_a-lrintl.$(OBJEXT) \
 	lib_a-llrintl.$(OBJEXT) lib_a-roundl.$(OBJEXT) \
 	lib_a-lroundl.$(OBJEXT) lib_a-llroundl.$(OBJEXT) \
 	lib_a-truncl.$(OBJEXT) lib_a-remquol.$(OBJEXT) \
 	lib_a-fdiml.$(OBJEXT) lib_a-fmaxl.$(OBJEXT) \
 	lib_a-fminl.$(OBJEXT) lib_a-fmal.$(OBJEXT) \
 	lib_a-acoshl.$(OBJEXT) lib_a-atanhl.$(OBJEXT) \
 	lib_a-remainderl.$(OBJEXT) lib_a-lgammal.$(OBJEXT) \
-	lib_a-erfl.$(OBJEXT) lib_a-erfcl.$(OBJEXT)
+	lib_a-erfl.$(OBJEXT) lib_a-erfcl.$(OBJEXT) \
+	lib_a-logbl.$(OBJEXT) lib_a-nexttoward.$(OBJEXT) \
+	lib_a-nexttowardl.$(OBJEXT) lib_a-nexttowardf.$(OBJEXT) \
+	lib_a-log2l.$(OBJEXT)
+
 @HAVE_LONG_DOUBLE_TRUE@@USE_LIBTOOL_FALSE@am__objects_4 =  \
 @HAVE_LONG_DOUBLE_TRUE@@USE_LIBTOOL_FALSE@	$(am__objects_3)
 @USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
 @USE_LIBTOOL_FALSE@	$(am__objects_2) $(am__objects_4)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libcommon_la_LIBADD =
 am__objects_5 = s_finite.lo s_copysign.lo s_modf.lo s_scalbn.lo \
 	s_cbrt.lo s_exp10.lo s_expm1.lo s_ilogb.lo s_infconst.lo \
 	s_infinity.lo s_isinf.lo s_isinfd.lo s_isnan.lo s_isnand.lo \
 	s_log1p.lo s_nan.lo s_nextafter.lo s_pow10.lo s_rint.lo \
 	s_logb.lo s_log2.lo s_matherr.lo s_lib_ver.lo s_fdim.lo \
 	s_fma.lo s_fmax.lo s_fmin.lo s_fpclassify.lo s_lrint.lo \
 	s_llrint.lo s_lround.lo s_llround.lo s_nearbyint.lo \
 	s_remquo.lo s_round.lo s_scalbln.lo s_signbit.lo s_trunc.lo
 am__objects_6 = sf_finite.lo sf_copysign.lo sf_modf.lo sf_scalbn.lo \
 	sf_cbrt.lo sf_exp10.lo sf_expm1.lo sf_ilogb.lo sf_infinity.lo \
 	sf_isinf.lo sf_isinff.lo sf_isnan.lo sf_isnanf.lo sf_log1p.lo \
 	sf_nan.lo sf_nextafter.lo sf_pow10.lo sf_rint.lo sf_logb.lo \
 	sf_log2.lo sf_fdim.lo sf_fma.lo sf_fmax.lo sf_fmin.lo \
 	sf_fpclassify.lo sf_lrint.lo sf_llrint.lo sf_lround.lo \
 	sf_llround.lo sf_nearbyint.lo sf_remquo.lo sf_round.lo \
 	sf_scalbln.lo sf_trunc.lo
 am__objects_7 = atanl.lo cosl.lo sinl.lo tanl.lo tanhl.lo frexpl.lo \
 	modfl.lo ceill.lo fabsl.lo floorl.lo log1pl.lo expm1l.lo \
 	acosl.lo asinl.lo atan2l.lo coshl.lo sinhl.lo expl.lo \
 	ldexpl.lo logl.lo log10l.lo powl.lo sqrtl.lo fmodl.lo \
 	hypotl.lo copysignl.lo nanl.lo ilogbl.lo asinhl.lo cbrtl.lo \
 	nextafterl.lo rintl.lo scalbnl.lo exp2l.lo scalblnl.lo \
 	tgammal.lo nearbyintl.lo lrintl.lo llrintl.lo roundl.lo \
 	lroundl.lo llroundl.lo truncl.lo remquol.lo fdiml.lo fmaxl.lo \
 	fminl.lo fmal.lo acoshl.lo atanhl.lo remainderl.lo lgammal.lo \
-	erfl.lo erfcl.lo
+	erfl.lo erfcl.lo logbl.lo nexttowardf.lo nexttoward.lo nexttowardl.lo \
+	log2l.lo
 @HAVE_LONG_DOUBLE_TRUE@@USE_LIBTOOL_TRUE@am__objects_8 =  \
 @HAVE_LONG_DOUBLE_TRUE@@USE_LIBTOOL_TRUE@	$(am__objects_7)
 @USE_LIBTOOL_TRUE@am_libcommon_la_OBJECTS = $(am__objects_5) \
 @USE_LIBTOOL_TRUE@	$(am__objects_6) $(am__objects_8)
 libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
 libcommon_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libcommon_la_LDFLAGS) $(LDFLAGS) -o $@
 @USE_LIBTOOL_TRUE@am_libcommon_la_rpath =
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
 am__depfiles_maybe =
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
@@ -338,41 +343,42 @@ src = s_finite.c s_copysign.c s_modf.c s_scalbn.c \
 	s_lrint.c s_llrint.c \
 	s_lround.c s_llround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c \
 	s_signbit.c s_trunc.c
 
 fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \
 	sf_cbrt.c sf_exp10.c sf_expm1.c sf_ilogb.c \
 	sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \
 	sf_log1p.c sf_nan.c sf_nextafter.c sf_pow10.c \
 	sf_rint.c sf_logb.c sf_log2.c \
 	sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_fpclassify.c \
 	sf_lrint.c sf_llrint.c \
 	sf_lround.c sf_llround.c sf_nearbyint.c sf_remquo.c sf_round.c \
 	sf_scalbln.c sf_trunc.c
 
 lsrc = atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.c \
 	floorl.c log1pl.c expm1l.c acosl.c asinl.c atan2l.c coshl.c sinhl.c \
 	expl.c ldexpl.c logl.c log10l.c powl.c sqrtl.c fmodl.c hypotl.c \
 	copysignl.c nanl.c ilogbl.c asinhl.c cbrtl.c nextafterl.c rintl.c \
 	scalbnl.c exp2l.c scalblnl.c tgammal.c nearbyintl.c lrintl.c llrintl.c \
 	roundl.c lroundl.c llroundl.c truncl.c remquol.c fdiml.c fmaxl.c fminl.c \
-	fmal.c acoshl.c atanhl.c remainderl.c lgammal.c erfl.c erfcl.c
+	fmal.c acoshl.c atanhl.c remainderl.c lgammal.c erfl.c erfcl.c \
+	logbl.c nexttowardf.c nexttoward.c nexttowardl.c log2l.c
 
 libcommon_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libcommon.la
 @USE_LIBTOOL_TRUE@libcommon_la_SOURCES = $(src) $(fsrc) \
 @USE_LIBTOOL_TRUE@	$(am__append_1)
 @USE_LIBTOOL_FALSE@noinst_DATA = 
 @USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) $(fsrc) $(am__append_2)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
 chobj = s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \
 	s_infinity.def s_isnan.def s_log1p.def s_matherr.def s_modf.def \
 	s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \
 	s_fdim.def s_fma.def s_fmax.def s_fmin.def \
 	s_logb.def s_log2.def s_lrint.def s_lround.def s_nearbyint.def \
 	s_remquo.def s_rint.def s_round.def s_signbit.def s_trunc.def \
 	isgreater.def
 
 SUFFIXES = .def
 CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
@@ -1048,40 +1054,70 @@ lib_a-ilogbl.obj: ilogbl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ilogbl.obj `if test -f 'ilogbl.c'; then $(CYGPATH_W) 'ilogbl.c'; else $(CYGPATH_W) '$(srcdir)/ilogbl.c'; fi`
 
 lib_a-asinhl.o: asinhl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-asinhl.o `test -f 'asinhl.c' || echo '$(srcdir)/'`asinhl.c
 
 lib_a-asinhl.obj: asinhl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-asinhl.obj `if test -f 'asinhl.c'; then $(CYGPATH_W) 'asinhl.c'; else $(CYGPATH_W) '$(srcdir)/asinhl.c'; fi`
 
 lib_a-cbrtl.o: cbrtl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cbrtl.o `test -f 'cbrtl.c' || echo '$(srcdir)/'`cbrtl.c
 
 lib_a-cbrtl.obj: cbrtl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cbrtl.obj `if test -f 'cbrtl.c'; then $(CYGPATH_W) 'cbrtl.c'; else $(CYGPATH_W) '$(srcdir)/cbrtl.c'; fi`
 
 lib_a-nextafterl.o: nextafterl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nextafterl.o `test -f 'nextafterl.c' || echo '$(srcdir)/'`nextafterl.c
 
 lib_a-nextafterl.obj: nextafterl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nextafterl.obj `if test -f 'nextafterl.c'; then $(CYGPATH_W) 'nextafterl.c'; else $(CYGPATH_W) '$(srcdir)/nextafterl.c'; fi`
 
+lib_a-logbl.o: logbl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-logbl.o `test -f 'logbl.c' || echo '$(srcdir)/'`logbl.c
+
+lib_a-logbl.obj: logbl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-logbl.obj `if test -f 'logbl.c'; then $(CYGPATH_W) 'logbl.c'; else $(CYGPATH_W) '$(srcdir)/logbll.c'; fi`
+
+lib_a-log2l.o: log2l.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-log2l.o `test -f 'log2l.c' || echo '$(srcdir)/'`log2l.c
+
+lib_a-log2l.obj: log2l.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-log2l.obj `if test -f 'log2l.c'; then $(CYGPATH_W) 'log2l.c'; else $(CYGPATH_W) '$(srcdir)/log2ll.c'; fi`
+
+lib_a-nexttowardf.o: nexttowardf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttowardf.o `test -f 'nexttowardf.c' || echo '$(srcdir)/'`nexttowardf.c
+
+lib_a-nexttowardf.obj: nexttowardf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttowardf.obj `if test -f 'nexttowardf.c'; then $(CYGPATH_W) 'nexttowardf.c'; else $(CYGPATH_W) '$(srcdir)/nexttowardfl.c'; fi`
+
+lib_a-nexttoward.o: nexttoward.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttoward.o `test -f 'nexttoward.c' || echo '$(srcdir)/'`nexttoward.c
+
+lib_a-nexttoward.obj: nexttoward.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttoward.obj `if test -f 'nexttoward.c'; then $(CYGPATH_W) 'nexttoward.c'; else $(CYGPATH_W) '$(srcdir)/nexttowardl.c'; fi`
+
+lib_a-nexttowardl.o: nexttowardl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttowardl.o `test -f 'nexttowardl.c' || echo '$(srcdir)/'`nexttowardl.c
+
+lib_a-nexttowardl.obj: nexttowardl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nexttowardl.obj `if test -f 'nexttowardl.c'; then $(CYGPATH_W) 'nexttowardl.c'; else $(CYGPATH_W) '$(srcdir)/nexttowardll.c'; fi`
+
 lib_a-rintl.o: rintl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rintl.o `test -f 'rintl.c' || echo '$(srcdir)/'`rintl.c
 
 lib_a-rintl.obj: rintl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rintl.obj `if test -f 'rintl.c'; then $(CYGPATH_W) 'rintl.c'; else $(CYGPATH_W) '$(srcdir)/rintl.c'; fi`
 
 lib_a-scalbnl.o: scalbnl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scalbnl.o `test -f 'scalbnl.c' || echo '$(srcdir)/'`scalbnl.c
 
 lib_a-scalbnl.obj: scalbnl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scalbnl.obj `if test -f 'scalbnl.c'; then $(CYGPATH_W) 'scalbnl.c'; else $(CYGPATH_W) '$(srcdir)/scalbnl.c'; fi`
 
 lib_a-exp2l.o: exp2l.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-exp2l.o `test -f 'exp2l.c' || echo '$(srcdir)/'`exp2l.c
 
 lib_a-exp2l.obj: exp2l.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-exp2l.obj `if test -f 'exp2l.c'; then $(CYGPATH_W) 'exp2l.c'; else $(CYGPATH_W) '$(srcdir)/exp2l.c'; fi`
 
 lib_a-scalblnl.o: scalblnl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scalblnl.o `test -f 'scalblnl.c' || echo '$(srcdir)/'`scalblnl.c
diff --git a/src/newlib/libm/common/log2l.c b/src/newlib/libm/common/log2l.c
new file mode 100644
index 0000000..e92e9eb
--- /dev/null
+++ b/src/newlib/libm/common/log2l.c
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2014 Mentor Graphics, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Mentor Graphics nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``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 CODESOURCERY 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 <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+long double
+log2l (long double x)
+{
+  return log2(x);
+}
+#endif
+
diff --git a/src/newlib/libm/common/logbl.c b/src/newlib/libm/common/logbl.c
new file mode 100644
index 0000000..56c1cf5
--- /dev/null
+++ b/src/newlib/libm/common/logbl.c
@@ -0,0 +1,22 @@
+#include <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+long double
+logbl (long double x)
+{
+  return logb(x);
+}
+#endif
+
+#include <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+long double
+logbl (long double x)
+{
+  return logb((double)x);
+}
+#endif
+
diff --git a/src/newlib/libm/common/nexttoward.c b/src/newlib/libm/common/nexttoward.c
new file mode 100644
index 0000000..92093e9
--- /dev/null
+++ b/src/newlib/libm/common/nexttoward.c
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2014 Mentor Graphics, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Mentor Graphics nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``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 CODESOURCERY 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 <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+double
+nexttoward (double x, long double y)
+{
+  return nextafter(x, y);
+}
+#endif
+
+#include <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+double
+nexttoward (double x, long double y)
+{
+  return nextafter(x, (double)y);
+}
+#endif
+
diff --git a/src/newlib/libm/common/nexttowardf.c b/src/newlib/libm/common/nexttowardf.c
new file mode 100644
index 0000000..3fca64f
--- /dev/null
+++ b/src/newlib/libm/common/nexttowardf.c
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2014 Mentor Graphics, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Mentor Graphics nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``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 CODESOURCERY 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 <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+float
+nexttowardf (float x, long double y)
+{
+  return nextafterf(x, y);
+}
+#endif
+
+#include <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+float
+nexttowardf (float x, long double y)
+{
+  return nextafterf(x, (double)y);
+}
+#endif
+
diff --git a/src/newlib/libm/common/nexttowardl.c b/src/newlib/libm/common/nexttowardl.c
new file mode 100644
index 0000000..fbfd498
--- /dev/null
+++ b/src/newlib/libm/common/nexttowardl.c
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2014 Mentor Graphics, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Mentor Graphics nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``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 CODESOURCERY 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 <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+long double
+nexttowardl (long double x, long double y)
+{
+  return nextafter(x, y);
+}
+#endif
+
+#include <math.h>
+#include "local.h"
+
+#ifdef _LDBL_EQ_DBL
+long double
+nexttowardl (long double x, long double y)
+{
+  return nextafter((double)x, (double)y);
+}
+#endif
+


More information about the Newlib mailing list