Please review, i'll commit it, just need an OK.
After this patchset the crt builds on ARM!!!!!! Yay
Remaining todos on ARM:
softmath: correct error handling on bad input parameters
assembler: check reason for non-working inline assembler with floating
point paramters (e.g. in sqrt.def.h)
Find Bugs not yet visible :)
Remaining todos on AMD64:
Benchmark the softmath functions to see which ones are faster than a
native implementation.
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 9731aa9..9e1ff8a 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -222,9 +222,8 @@ src_libmingwex=\
\
math/_chgsignl.S math/ceil.S math/ceilf.S math/ceill.S math/copysignl.S \
math/floor.S math/floorf.S math/floorl.S \
- math/fma.S math/fmaf.S math/frexpl.S \
+ math/fma.S math/fmaf.S \
math/nearbyint.S math/nearbyintf.S math/nearbyintl.S \
- math/remquo.S math/remquof.S math/remquol.S \
math/trunc.S math/truncf.S \
math/cbrt.c \
math/cbrtf.c math/cbrtl.c math/cephes_emath.c math/copysign.c math/copysignf.c \
@@ -299,14 +298,14 @@ src_libmingwex64=\
math/atanhf.c math/atanhl.c math/cos.c math/cosf.c math/cosl.c \
math/cosl_internal.S math/cossin.c math/exp.c math/expl.c math/exp2.S \
math/exp2f.S math/exp2l.S math/expm1.c math/expm1f.c math/expm1l.c \
- math/fmod.c math/fmodf.c math/fmodl.c math/fucom.c math/ilogb.S \
- math/ilogbf.S math/ilogbl.S math/internal_logl.S math/ldexp.c math/ldexpl.c \
- math/log.c math/log10l.S math/log1p.S math/log1pf.S math/log1pl.S \
- math/log2.S math/log2f.S math/log2l.S math/logb.c math/logbf.c \
- math/logbl.c math/logl.c math/pow.c math/powl.c math/remainder.S \
- math/remainderf.S math/remainderl.S math/scalbn.S math/scalbnf.S math/scalbnl.S \
- math/sin.c math/sinf.c math/sinl.c math/sinl_internal.S math/tanf.c \
- math/tanl.S
+ math/fmod.c math/fmodf.c math/fmodl.c math/frexpl.S math/fucom.c \
+ math/ilogb.S math/ilogbf.S math/ilogbl.S math/internal_logl.S math/ldexp.c \
+ math/ldexpl.c math/log.c math/log10l.S math/log1p.S math/log1pf.S \
+ math/log1pl.S math/log2.S math/log2f.S math/log2l.S math/logb.c \
+ math/logbf.c math/logbl.c math/logl.c math/pow.c math/powl.c \
+ math/remainder.S math/remainderf.S math/remainderl.S math/remquo.S math/remquof.S \
+ math/remquol.S math/scalbn.S math/scalbnf.S math/scalbnl.S math/sin.c \
+ math/sinf.c math/sinl.c math/sinl_internal.S math/tanf.c math/tanl.S
# these only go into the 32 bit version:
src_libmingwex32=\
@@ -316,14 +315,14 @@ src_libmingwex32=\
math/atanhf.c math/atanhl.c math/cos.c math/cosf.c math/cosl.c \
math/cosl_internal.S math/cossin.c math/exp.c math/expl.c math/exp2.S \
math/exp2f.S math/exp2l.S math/expm1.c math/expm1f.c math/expm1l.c \
- math/fmod.c math/fmodf.c math/fmodl.c math/fucom.c math/ilogb.S \
- math/ilogbf.S math/ilogbl.S math/internal_logl.S math/ldexp.c math/ldexpl.c \
- math/log.c math/log10l.S math/log1p.S math/log1pf.S math/log1pl.S \
- math/log2.S math/log2f.S math/log2l.S math/logb.c math/logbf.c \
- math/logbl.c math/logl.c math/pow.c math/powl.c math/remainder.S \
- math/remainderf.S math/remainderl.S math/scalbn.S math/scalbnf.S math/scalbnl.S \
- math/sin.c math/sinf.c math/sinl.c math/sinl_internal.S math/tanf.c \
- math/tanl.S
+ math/fmod.c math/fmodf.c math/fmodl.c math/frexpl.S math/fucom.c \
+ math/ilogb.S math/ilogbf.S math/ilogbl.S math/internal_logl.S math/ldexp.c \
+ math/ldexpl.c math/log.c math/log10l.S math/log1p.S math/log1pf.S \
+ math/log1pl.S math/log2.S math/log2f.S math/log2l.S math/logb.c \
+ math/logbf.c math/logbl.c math/logl.c math/pow.c math/powl.c \
+ math/remainder.S math/remainderf.S math/remainderl.S math/remquo.S math/remquof.S \
+ math/remquol.S math/scalbn.S math/scalbnf.S math/scalbnl.S math/sin.c \
+ math/sinf.c math/sinl.c math/sinl_internal.S math/tanf.c math/tanl.S
# these only go into the ARM32 version:
src_libmingwexarm32=\
@@ -334,14 +333,15 @@ src_libmingwexarm32=\
math/softmath/atanhf.c math/softmath/atanhl.c math/softmath/cos.c math/softmath/cosf.c math/softmath/cosl.c \
math/softmath/exp.c math/softmath/expl.c math/softmath/exp2.c math/softmath/exp2f.c math/softmath/exp2l.c \
math/softmath/expm1.c math/softmath/expm1f.c math/softmath/expm1l.c math/softmath/fmod.c math/softmath/fmodf.c \
- math/softmath/fmodl.c math/softmath/ilogb.c math/softmath/ilogbf.c math/softmath/ilogbl.c math/softmath/ldexp.c \
- math/softmath/ldexpl.c math/softmath/log.c math/softmath/log10l.c math/softmath/log1p.c math/softmath/log1pf.c \
- math/softmath/log1pl.c math/softmath/log2.c math/softmath/log2f.c math/softmath/log2l.c math/softmath/logb.c \
- math/softmath/logbf.c math/softmath/logbl.c math/softmath/logl.c math/softmath/pow.c math/softmath/powl.c \
+ math/softmath/fmodl.c math/softmath/frexpl.c math/softmath/ilogb.c math/softmath/ilogbf.c math/softmath/ilogbl.c \
+ math/softmath/ldexp.c math/softmath/ldexpl.c math/softmath/log.c math/softmath/log10l.c math/softmath/log1p.c \
+ math/softmath/log1pf.c math/softmath/log1pl.c math/softmath/log2.c math/softmath/log2f.c math/softmath/log2l.c \
+ math/softmath/logb.c math/softmath/logbf.c math/softmath/logbl.c math/softmath/logl.c math/softmath/pow.c \
+ math/softmath/powl.c \
math/softmath/remainder.c math/softmath/remainderf.c math/softmath/remainderl.c \
- math/softmath/scalbn.c math/softmath/scalbnf.c math/softmath/scalbnl.c math/softmath/sin.c math/softmath/sincos.c \
- math/softmath/sincosf.c math/softmath/sincosl.c math/softmath/sinf.c math/softmath/sinl.c math/softmath/tanf.c \
- math/softmath/tanl.c
+ math/softmath/remquo.c math/softmath/remquof.c math/softmath/remquol.c math/softmath/scalbn.c math/softmath/scalbnf.c \
+ math/softmath/scalbnl.c math/softmath/sin.c math/softmath/sincos.c math/softmath/sincosf.c math/softmath/sincosl.c \
+ math/softmath/sinf.c math/softmath/sinl.c math/softmath/tanf.c math/softmath/tanl.c
# These intrinsics are target independent:
diff --git a/mingw-w64-crt/math/cephes_mconf.h b/mingw-w64-crt/math/cephes_mconf.h
index 80fa7c5..25ab33e 100644
--- a/mingw-w64-crt/math/cephes_mconf.h
+++ b/mingw-w64-crt/math/cephes_mconf.h
@@ -66,6 +66,16 @@ extern double __QNAN;
#endif
/*long double*/
+#if defined(__arm__) || defined(_ARM_)
+#define MAXNUML 1.7976931348623158E308
+#define MAXLOGL 7.09782712893383996843E2
+#define MINLOGL -7.08396418532264106224E2
+#define LOGE2L 6.93147180559945309417E-1
+#define LOG2EL 1.44269504088896340736
+#define PIL 3.14159265358979323846
+#define PIO2L 1.57079632679489661923
+#define PIO4L 7.85398163397448309616E-1
+#else
#define MAXNUML 1.189731495357231765021263853E4932L
#define MAXLOGL 1.1356523406294143949492E4L
#define MINLOGL -1.13994985314888605586758E4L
@@ -74,6 +84,7 @@ extern double __QNAN;
#define PIL 3.1415926535897932384626L
#define PIO2L 1.5707963267948966192313L
#define PIO4L 7.8539816339744830961566E-1L
+#endif /* defined(__arm__) || defined(_ARM_) */
#define isfinitel isfinite
#define isinfl isinf
diff --git a/mingw-w64-crt/math/fpclassifyl.c b/mingw-w64-crt/math/fpclassifyl.c
index 258b2ec..59f55e0 100644
--- a/mingw-w64-crt/math/fpclassifyl.c
+++ b/mingw-w64-crt/math/fpclassifyl.c
@@ -24,7 +24,7 @@ int __fpclassifyl (long double _x){
FP_INFINITE : FP_NAN);
return FP_NORMAL;
#elif defined(__arm__) || defined(_ARM_)
- __fpclassify(_x);
+ return __fpclassify(_x);
#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ (
diff --git a/mingw-w64-crt/math/isnanl.c b/mingw-w64-crt/math/isnanl.c
index 197a041..cc8018d 100644
--- a/mingw-w64-crt/math/isnanl.c
+++ b/mingw-w64-crt/math/isnanl.c
@@ -19,7 +19,7 @@ __isnanl (long double _x)
signexp = 0xfffe - signexp;
return (int) ((unsigned int) signexp) >> 16;
#elif defined(__arm__) || defined(_ARM_)
- __isnan(_x);
+ return __isnan(_x);
#elif defined(__i386__) || defined(_X86_)
unsigned short _sw;
__asm__ __volatile__ ("fxam;"
diff --git a/mingw-w64-crt/math/lgammal.c b/mingw-w64-crt/math/lgammal.c
index dabb1d3..13f367d 100644
--- a/mingw-w64-crt/math/lgammal.c
+++ b/mingw-w64-crt/math/lgammal.c
@@ -198,8 +198,11 @@ static uLD C[] = {
/* log( sqrt( 2*pi ) ) */
static const long double LS2PI = 0.91893853320467274178L;
+#if defined(__arm__) || defined(_ARM_)
+#define MAXLGM 2.035093e36
+#else
#define MAXLGM 1.04848146839019521116e+4928L
-
+#endif /* defined(__arm__) || defined(_ARM_) */
/* Logarithm of gamma function */
/* Reentrant version */
diff --git a/mingw-w64-crt/math/modf.c b/mingw-w64-crt/math/modf.c
index 5a34452..068aec6 100644
--- a/mingw-w64-crt/math/modf.c
+++ b/mingw-w64-crt/math/modf.c
@@ -6,15 +6,13 @@
#include <fenv.h>
#include <math.h>
#include <errno.h>
-#define FE_ROUNDING_MASK \
- (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
double
modf (double value, double* iptr)
{
double int_part = 0.0;
/* truncate */
-#ifdef _WIN64
+#if defined(_AMD64_) || defined(__x86_64__)
asm ("subq $8, %%rsp\n"
"fnstcw 4(%%rsp)\n"
"movzwl 4(%%rsp), %%eax\n"
@@ -24,7 +22,7 @@ modf (double value, double* iptr)
"frndint\n"
"fldcw 4(%%rsp)\n"
"addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
-#else
+#elif defined(_X86_) || defined(__i386__)
asm ("push %%eax\n\tsubl $8, %%esp\n"
"fnstcw 4(%%esp)\n"
"movzwl 4(%%esp), %%eax\n"
@@ -34,6 +32,8 @@ modf (double value, double* iptr)
"frndint\n"
"fldcw 4(%%esp)\n"
"addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round */
+#else
+ int_part = trunc(value);
#endif
if (iptr)
*iptr = int_part;
diff --git a/mingw-w64-crt/math/modff.c b/mingw-w64-crt/math/modff.c
index 36dd3fd..3e08f9d 100644
--- a/mingw-w64-crt/math/modff.c
+++ b/mingw-w64-crt/math/modff.c
@@ -6,8 +6,6 @@
#include <fenv.h>
#include <math.h>
#include <errno.h>
-#define FE_ROUNDING_MASK \
- (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
float
modff (float value, float* iptr)
@@ -15,7 +13,7 @@ modff (float value, float* iptr)
float int_part = 0.0F;
/* truncate */
/* truncate */
-#ifdef _WIN64
+#if defined(_AMD64_) || defined(__x86_64__)
asm ("subq $8, %%rsp\n"
"fnstcw 4(%%rsp)\n"
"movzwl 4(%%rsp), %%eax\n"
@@ -25,7 +23,7 @@ modff (float value, float* iptr)
"frndint\n"
"fldcw 4(%%rsp)\n"
"addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
-#else
+#elif defined(_X86_) || defined(__i386__)
asm ("push %%eax\n\tsubl $8, %%esp\n"
"fnstcw 4(%%esp)\n"
"movzwl 4(%%esp), %%eax\n"
@@ -35,6 +33,8 @@ modff (float value, float* iptr)
"frndint\n"
"fldcw 4(%%esp)\n"
"addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round */
+#else
+ int_part = truncf(value);
#endif
if (iptr)
*iptr = int_part;
diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c
index 4d34fe5..af75a8b 100644
--- a/mingw-w64-crt/math/modfl.c
+++ b/mingw-w64-crt/math/modfl.c
@@ -6,15 +6,13 @@
#include <fenv.h>
#include <math.h>
#include <errno.h>
-#define FE_ROUNDING_MASK \
- (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
long double
modfl (long double value, long double* iptr)
{
long double int_part = 0.0L;
/* truncate */
-#ifdef _WIN64
+#if defined(_AMD64_) || defined(__x86_64__)
asm ("subq $8, %%rsp\n"
"fnstcw 4(%%rsp)\n"
"movzwl 4(%%rsp), %%eax\n"
@@ -24,7 +22,7 @@ modfl (long double value, long double* iptr)
"frndint\n"
"fldcw 4(%%rsp)\n"
"addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
-#else
+#elif defined(_X86_) || defined(__i386__)
asm ("push %%eax\n\tsubl $8, %%esp\n"
"fnstcw 4(%%esp)\n"
"movzwl 4(%%esp), %%eax\n"
@@ -34,6 +32,8 @@ modfl (long double value, long double* iptr)
"frndint\n"
"fldcw 4(%%esp)\n"
"addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round */
+#else
+ int_part = truncl(value);
#endif
if (iptr)
*iptr = int_part;
diff --git a/mingw-w64-crt/math/signbitl.c b/mingw-w64-crt/math/signbitl.c
index e0c29c7..6bd3338 100644
--- a/mingw-w64-crt/math/signbitl.c
+++ b/mingw-w64-crt/math/signbitl.c
@@ -21,6 +21,7 @@ typedef union __mingw_fp_types_t
} __mingw_fp_types_t;
#define __FP_SIGNBIT 0x0200
+extern int __signbit (double x);
int __signbitl (long double x);
@@ -30,7 +31,7 @@ int __signbitl (long double x) {
ld.ld = &x;
return ((ld.ldt->lh.sign_exponent & 0x8000) != 0);
#elif defined(__arm__) || defined(_ARM_)
- __signbit(x);
+ return __signbit(x);
#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ ("fxam; fstsw %%ax;"
diff --git a/mingw-w64-crt/math/softmath/frexpl.c b/mingw-w64-crt/math/softmath/frexpl.c
new file mode 100644
index 0000000..efe68aa
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/frexpl.c
@@ -0,0 +1,70 @@
+/*
+ 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"
+
+long double frexpl(long double x, int *exp)
+{
+ long double a;
+ int i = 0;
+
+ if (isnan(x) || isinf(x)) return x;
+ if (x == 0.0)
+ {
+ if (exp) *exp = 0;
+ return x;
+ }
+
+ a = fabsl(x);
+
+ if (a >= 1)
+ while (powl(2, i) < a) i++;
+ else
+ while (powl(2, i) > a) i--;
+
+ if (a/powl(2, i) >= 1.0) i++;
+
+ if (exp) *exp = i;
+ return x/powl(2, i);
+}
diff --git a/mingw-w64-crt/math/softmath/remquo.c b/mingw-w64-crt/math/softmath/remquo.c
new file mode 100644
index 0000000..5cb62ad
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/remquo.c
@@ -0,0 +1,62 @@
+/*
+ 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 remquo(double x, double y, int *quo)
+{
+ double r;
+
+ if (isnan(x) || isnan(y)) return NAN;
+ if (y == 0.0)
+ {
+ errno = EDOM;
+ __mingw_raise_matherr (_DOMAIN, "remquo", x, y, NAN);
+ return NAN;
+ }
+
+ r = remainder(x, y);
+ if (quo) *quo = (int)((x - r) / y) % 8;
+ return r;
+}
diff --git a/mingw-w64-crt/math/softmath/remquof.c b/mingw-w64-crt/math/softmath/remquof.c
new file mode 100644
index 0000000..dbdd243
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/remquof.c
@@ -0,0 +1,62 @@
+/*
+ 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"
+
+float remquof(float x, float y, int *quo)
+{
+ float r;
+
+ if (isnan(x) || isnan(y)) return NANF;
+ if (y == 0.0)
+ {
+ errno = EDOM;
+ __mingw_raise_matherr (_DOMAIN, "remquof", x, y, NANF);
+ return NANF;
+ }
+
+ r = remainderf(x, y);
+ if (quo) *quo = (int)((x - r) / y) % 8;
+ return r;
+}
diff --git a/mingw-w64-crt/math/softmath/remquol.c b/mingw-w64-crt/math/softmath/remquol.c
new file mode 100644
index 0000000..4863b2f
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/remquol.c
@@ -0,0 +1,62 @@
+/*
+ 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"
+
+long double remquol(long double x, long double y, int *quo)
+{
+ long double r;
+
+ if (isnan(x) || isnan(y)) return NANL;
+ if (y == 0.0)
+ {
+ errno = EDOM;
+ __mingw_raise_matherr (_DOMAIN, "remquo", x, y, NANL);
+ return NANL;
+ }
+
+ r = remainderl(x, y);
+ if (quo) *quo = (int)((x - r) / y) % 8;
+ return r;
+}
diff --git a/mingw-w64-crt/math/softmath/sincosl.c b/mingw-w64-crt/math/softmath/sincosl.c
index 54cf0dc..4366d2f 100644
--- a/mingw-w64-crt/math/softmath/sincosl.c
+++ b/mingw-w64-crt/math/softmath/sincosl.c
@@ -46,9 +46,6 @@
void sincosl(long double x, long double *s, long double *c)
{
-#if defined(__arm__) || defined(_ARM_)
- return sincos(x, s, c);
-#else
-#error Not supported on your platform yet
-#endif
+ if (s) *s = sinl(x);
+ if (c) *c = cosl(x);
}
------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public