Please review, i'll commit it, just need an OK.
(Last time it was confirmed on IRC and is already pushed upstream)
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 5d4e469..2c0d85e 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -224,7 +224,7 @@ src_libmingwex=\
math/fma.S math/fmaf.S math/frexpl.S math/ilogbl.S \
math/internal_logl.S math/log10l.S math/log1pl.S \
math/log2l.S math/nearbyint.S math/nearbyintf.S math/nearbyintl.S math/remainder.S \
- math/remainderf.S math/remainderl.S math/remquo.S math/remquof.S math/remquol.S math/scalbn.S \
+ math/remainderf.S math/remainderl.S math/remquo.S math/remquof.S math/remquol.S \
math/scalbnl.S math/sinl_internal.S math/tanl.S math/trunc.S math/truncf.S \
math/acoshl.c math/acosl.c \
math/asinhl.c math/asinl.c math/atan2l.c \
@@ -234,13 +234,13 @@ src_libmingwex=\
math/expf.c math/expl.c math/expm1l.c \
math/fabs.c math/fabsf.c math/fabsl.c math/fdim.c math/fdimf.c math/fdiml.c \
math/fmal.c math/fmax.c math/fmaxf.c math/fmaxl.c math/fmin.c math/fminf.c \
- math/fminl.c math/fmod.c math/fmodl.c math/fp_consts.c math/fp_constsf.c \
+ math/fminl.c math/fmodl.c math/fp_consts.c math/fp_constsf.c \
math/fp_constsl.c math/fpclassify.c math/fpclassifyf.c math/fpclassifyl.c math/frexpf.c math/fucom.c \
math/hypotf.c math/hypotl.c math/isnan.c math/isnanf.c math/isnanl.c math/ldexp.c \
math/ldexpf.c math/ldexpl.c math/lgamma.c math/lgammaf.c math/lgammal.c math/llrint.c \
math/signgam.c \
math/llrintf.c math/llrintl.c math/llround.c math/llroundf.c math/llroundl.c math/log.c \
- math/log10f.c math/logb.c math/logbl.c math/logf.c math/logl.c \
+ math/log10f.c math/logbl.c math/logf.c math/logl.c \
math/lrint.c math/lrintf.c math/lrintl.c math/lround.c math/lroundf.c math/lroundl.c \
math/modf.c math/modff.c math/modfl.c math/nextafterf.c math/nextafterl.c math/nexttoward.c \
math/nexttowardf.c math/pow.c math/powf.c math/powi.c math/powif.c math/powil.c \
@@ -298,28 +298,28 @@ src_libmingwex64=\
math/acosf.c math/acosh.c math/acoshf.c math/asinf.c math/asinh.c \
math/asinhf.c math/atan2f.c math/atanf.c math/atanh.c math/atanhf.c \
math/cosf.c math/exp.c math/exp2.S math/exp2f.S math/expm1.c \
- math/expm1f.c math/fmodf.c math/ilogb.S math/ilogbf.S math/log1p.S \
- math/log1pf.S math/log2.S math/log2f.S math/logbf.c math/scalbnf.S \
- math/sinf.c math/tanf.c
+ math/expm1f.c math/fmod.c math/fmodf.c math/ilogb.S math/ilogbf.S \
+ math/log1p.S math/log1pf.S math/log2.S math/log2f.S math/logb.c \
+ math/logbf.c math/scalbn.S math/scalbnf.S math/sinf.c math/tanf.c
# these only go into the 32 bit version:
src_libmingwex32=\
math/acosf.c math/acosh.c math/acoshf.c math/asinf.c math/asinh.c \
math/asinhf.c math/atan2f.c math/atanf.c math/atanh.c math/atanhf.c \
math/cosf.c math/exp.c math/exp2.S math/exp2f.S math/expm1.c \
- math/expm1f.c math/fmodf.c math/ilogb.S math/ilogbf.S math/log1p.S \
- math/log1pf.S math/log2.S math/log2f.S math/logbf.c math/scalbnf.S \
- math/sinf.c math/tanf.c
+ math/expm1f.c math/fmod.c math/fmodf.c math/ilogb.S math/ilogbf.S \
+ math/log1p.S math/log1pf.S math/log2.S math/log2f.S math/logb.c \
+ math/logbf.c math/scalbn.S math/scalbnf.S math/sinf.c math/tanf.c
# these only go into the ARM32 version:
src_libmingwexarm32=\
- math/softmath/e_fmodf.c math/softmath/e_powf.c \
+ math/softmath/e_fmod.c math/softmath/e_fmodf.c math/softmath/e_powf.c \
math/softmath/acosf.c math/softmath/acosh.c math/softmath/acoshf.c math/softmath/asinf.c math/softmath/asinh.c \
math/softmath/asinhf.c math/softmath/atan2f.c math/softmath/atanf.c math/softmath/atanh.c math/softmath/atanhf.c \
math/softmath/cosf.c math/softmath/exp.c math/softmath/exp2.c math/softmath/exp2f.c math/softmath/expm1.c \
- math/softmath/expm1f.c math/softmath/fmodf.c math/softmath/ilogb.c math/softmath/ilogbf.c math/softmath/log1p.c \
- math/softmath/log1pf.c math/softmath/log2.c math/softmath/log2f.c math/softmath/logbf.c math/softmath/scalbnf.c \
- math/softmath/sinf.c math/softmath/tanf.c
+ math/softmath/expm1f.c math/softmath/fmod.c math/softmath/fmodf.c math/softmath/ilogb.c math/softmath/ilogbf.c \
+ math/softmath/log1p.c math/softmath/log1pf.c math/softmath/log2.c math/softmath/log2f.c math/softmath/logb.c \
+ math/softmath/logbf.c math/softmath/scalbn.c math/softmath/scalbnf.c math/softmath/sinf.c math/softmath/tanf.c
# These intrinsics are target independent:
diff --git a/mingw-w64-crt/math/softmath/e_fmod.c b/mingw-w64-crt/math/softmath/e_fmod.c
new file mode 100644
index 0000000..4b5c350
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/e_fmod.c
@@ -0,0 +1,124 @@
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+/*
+ * __ieee754_fmod(x,y)
+ * Return x mod y in exact arithmetic
+ * Method: shift and subtract
+ */
+
+#include "math.h"
+#include "bsd_private.h"
+
+double bsd__ieee754_fmod(double x, double y)
+{
+ int32_t n,hx,hy,hz,ix,iy,sx,i;
+ u_int32_t lx,ly,lz;
+
+ EXTRACT_WORDS(hx,lx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ sx = hx&0x80000000; /* sign of x */
+ hx ^=sx; /* |x| */
+ hy &= 0x7fffffff; /* |y| */
+
+ /* purge off exception values */
+ if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */
+ ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */
+ return (x*y)/(x*y);
+ if(hx<=hy) {
+ if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
+ if(lx==ly)
+ return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
+ }
+
+ /* determine ix = ilogb(x) */
+ if(hx<0x00100000) { /* subnormal x */
+ if(hx==0) {
+ for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
+ } else {
+ for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
+ }
+ } else ix = (hx>>20)-1023;
+
+ /* determine iy = ilogb(y) */
+ if(hy<0x00100000) { /* subnormal y */
+ if(hy==0) {
+ for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
+ } else {
+ for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
+ }
+ } else iy = (hy>>20)-1023;
+
+ /* set up {hx,lx}, {hy,ly} and align y to x */
+ if(ix >= -1022)
+ hx = 0x00100000|(0x000fffff&hx);
+ else { /* subnormal x, shift x to normal */
+ n = -1022-ix;
+ if(n<=31) {
+ hx = (hx<<n)|(lx>>(32-n));
+ lx <<= n;
+ } else {
+ hx = lx<<(n-32);
+ lx = 0;
+ }
+ }
+ if(iy >= -1022)
+ hy = 0x00100000|(0x000fffff&hy);
+ else { /* subnormal y, shift y to normal */
+ n = -1022-iy;
+ if(n<=31) {
+ hy = (hy<<n)|(ly>>(32-n));
+ ly <<= n;
+ } else {
+ hy = ly<<(n-32);
+ ly = 0;
+ }
+ }
+
+ /* fix point fmod */
+ n = ix - iy;
+ while(n--) {
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
+ else {
+ if((hz|lz)==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
+ hx = hz+hz+(lz>>31); lx = lz+lz;
+ }
+ }
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz>=0) {hx=hz;lx=lz;}
+
+ /* convert back to floating value and restore the sign */
+ if((hx|lx)==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
+ while(hx<0x00100000) { /* normalize x */
+ hx = hx+hx+(lx>>31); lx = lx+lx;
+ iy -= 1;
+ }
+ if(iy>= -1022) { /* normalize output */
+ hx = ((hx-0x00100000)|((iy+1023)<<20));
+ INSERT_WORDS(x,hx|sx,lx);
+ } else { /* subnormal output */
+ n = -1022 - iy;
+ if(n<=20) {
+ lx = (lx>>n)|((u_int32_t)hx<<(32-n));
+ hx >>= n;
+ } else if (n<=31) {
+ lx = (hx<<(32-n))|(lx>>n); hx = sx;
+ } else {
+ lx = hx>>(n-32); hx = sx;
+ }
+ INSERT_WORDS(x,hx|sx,lx);
+ x *= one; /* create necessary signal */
+ }
+ return x; /* exact output */
+}
diff --git a/mingw-w64-crt/math/softmath/fmod.c b/mingw-w64-crt/math/softmath/fmod.c
new file mode 100644
index 0000000..3020496
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/fmod.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2014 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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 "softmath_private.h"
+
+double fmod(double x, double y)
+{
+ return bsd__ieee754_fmod(x, y);
+}
diff --git a/mingw-w64-crt/math/softmath/logb.c b/mingw-w64-crt/math/softmath/logb.c
new file mode 100644
index 0000000..068194a
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/logb.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2014 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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 "softmath_private.h"
+
+double logb(double x)
+{
+ return floor(log2(x));
+}
diff --git a/mingw-w64-crt/math/softmath/scalbn.c b/mingw-w64-crt/math/softmath/scalbn.c
new file mode 100644
index 0000000..c9c7f2e
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/scalbn.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2014 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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 "softmath_private.h"
+
+double scalbn(double x, int exp)
+{
+ return x * exp2(exp);
+}
diff --git a/mingw-w64-crt/math/softmath/softmath_private.h b/mingw-w64-crt/math/softmath/softmath_private.h
index 1d8476f..105ea91 100644
--- a/mingw-w64-crt/math/softmath/softmath_private.h
+++ b/mingw-w64-crt/math/softmath/softmath_private.h
@@ -12,6 +12,7 @@
#include <math.h>
#include <inttypes.h>
+extern double bsd__ieee754_fmod(double, double);
extern float bsd__ieee754_fmodf(float, float);
extern double bsd__ieee754_pow(double, double);
extern float bsd__ieee754_powf(float, float);
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public