]> sourceware.org Git - newlib-cygwin.git/commitdiff
2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com>
authorJeff Johnston <jjohnstn@redhat.com>
Mon, 15 Dec 2014 20:50:23 +0000 (20:50 +0000)
committerJeff Johnston <jjohnstn@redhat.com>
Mon, 15 Dec 2014 20:50:23 +0000 (20:50 +0000)
        * libc/include/math.h: Add log2l,logbl,nexttowardf,
        * nexttoward,nexttowardl
        * libm/common/Makefile.am: Reference new files
        * libm/common/Makefile.in: Reference new files
        * libm/common/log2l.c: New File
        * libm/common/logbl.c: Likewise
        * libm/common/nexttowardf.c: Likewise
        * libm/common/nexttoward.c: Likewise
        * libm/common/nexttowardl.c: Likewise

newlib/ChangeLog
newlib/libc/include/math.h
newlib/libm/common/Makefile.am
newlib/libm/common/Makefile.in
newlib/libm/common/log2l.c [new file with mode: 0644]
newlib/libm/common/logbl.c [new file with mode: 0644]
newlib/libm/common/nexttoward.c [new file with mode: 0644]
newlib/libm/common/nexttowardf.c [new file with mode: 0644]
newlib/libm/common/nexttowardl.c [new file with mode: 0644]

index e092d1f62c7225a4f8faf623303553ad8c5250fd..10a77557f67eb6cb3a4874a5d1881788ddee2b4f 100644 (file)
@@ -1,3 +1,15 @@
+2014-12-15  Jonathan Roelofs  <jonathan@codesourcery.com>
+
+       * libc/include/math.h: Add log2l,logbl,nexttowardf,
+       * nexttoward,nexttowardl
+       * libm/common/Makefile.am: Reference new files
+       * libm/common/Makefile.in: Reference new files
+       * libm/common/log2l.c: New File
+       * libm/common/logbl.c: Likewise
+       * libm/common/nexttowardf.c: Likewise
+       * libm/common/nexttoward.c: Likewise
+       * libm/common/nexttowardl.c: Likewise
+
 2014-12-15  Yaakov Selkowitz  <yselkowi@redhat.com>
 
        * libc/include/stdio.h (__SNLK): Define.
index 6717cb3ee6361cf771551a274a46b7d3226d6cc4..d16ce30741de8661d632ba8bf78ffe1b1d4811a1 100644 (file)
@@ -423,6 +423,11 @@ 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));
index ed556ef1d9b6ce8e869cffe40a0b3e537038b444..b370b2e093d52eae48e6a917448e2ca6cf98a7c3 100644 (file)
@@ -30,7 +30,9 @@ lsrc =        atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.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
 
index 12b5a30fb80a6bd27d892a327cdba24e2a5cb38a..af3c88d713e144e015a37caeacd23f292fd1d942 100644 (file)
@@ -136,7 +136,10 @@ am__objects_3 = lib_a-atanl.$(OBJEXT) lib_a-cosl.$(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-nexttowardf.$(OBJEXT) \
+       lib_a-nexttoward.$(OBJEXT) lib_a-nexttowardl.$(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) \
@@ -169,7 +172,8 @@ am__objects_7 = atanl.lo cosl.lo sinl.lo tanl.lo tanhl.lo frexpl.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) \
@@ -355,7 +359,8 @@ lsrc = atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.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
@@ -1203,6 +1208,36 @@ lib_a-erfcl.o: erfcl.c
 lib_a-erfcl.obj: erfcl.c
        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-erfcl.obj `if test -f 'erfcl.c'; then $(CYGPATH_W) 'erfcl.c'; else $(CYGPATH_W) '$(srcdir)/erfcl.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)/logbl.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)/nexttowardf.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)/nexttoward.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)/nexttowardl.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)/log2l.c'; fi`
+
 mostlyclean-libtool:
        -rm -f *.lo
 
diff --git a/newlib/libm/common/log2l.c b/newlib/libm/common/log2l.c
new file mode 100644 (file)
index 0000000..e92e9eb
--- /dev/null
@@ -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/newlib/libm/common/logbl.c b/newlib/libm/common/logbl.c
new file mode 100644 (file)
index 0000000..59d24a2
--- /dev/null
@@ -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
+logbl (long double x)
+{
+  return logb(x);
+}
+#endif
+
diff --git a/newlib/libm/common/nexttoward.c b/newlib/libm/common/nexttoward.c
new file mode 100644 (file)
index 0000000..71dd71d
--- /dev/null
@@ -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
+double
+nexttoward (double x, long double y)
+{
+  return nextafter(x, y);
+}
+#endif
+
diff --git a/newlib/libm/common/nexttowardf.c b/newlib/libm/common/nexttowardf.c
new file mode 100644 (file)
index 0000000..6f47319
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <math.h>
+#include <inttypes.h>
+#include "local.h"
+
+union fshape {
+  float value;
+  uint32_t bits;
+};
+
+// This is only necessary because the implementation of isnan only works
+// properly when long double == double.
+// See: https://sourceware.org/ml/newlib/2014/msg00684.html
+#ifdef _LDBL_EQ_DOUBLE
+
+float
+nexttowardf (float x, long double y)
+{
+  union fshape ux;
+  uint32_t e;
+
+  if (isnan(x) || isnan(y))
+    return x + y;
+  if (x == y)
+    return y;
+  ux.value = x;
+  if (x == 0) {
+    ux.bits = 1;
+    if (signbit(y))
+      ux.bits |= 0x80000000;
+  } else if (x < y) {
+    if (signbit(x))
+      ux.bits--;
+    else
+      ux.bits++;
+  } else {
+    if (signbit(x))
+      ux.bits++;
+    else
+      ux.bits--;
+  }
+  e = ux.bits & 0x7f800000;
+  /* raise overflow if ux.value is infinite and x is finite */
+  if (e == 0x7f800000) {
+    volatile float force_eval;
+    force_eval = x + x;
+  }
+  /* raise underflow if ux.value is subnormal or zero */
+  if (e == 0) {
+    volatile float force_eval;
+    force_eval = x*x + ux.value*ux.value;
+  }
+  return ux.value;
+}
+
+#endif // _LDBL_EQ_DOUBLE
diff --git a/newlib/libm/common/nexttowardl.c b/newlib/libm/common/nexttowardl.c
new file mode 100644 (file)
index 0000000..59af4ce
--- /dev/null
@@ -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
+nexttowardl (long double x, long double y)
+{
+  return nextafter(x, y);
+}
+#endif
+
This page took 0.065156 seconds and 5 git commands to generate.