Hi All,
This patch implements clog10/clog10f/clog10l in libmingwex.
Please review:)
From b4eb652558fe341a25c12935ee7b9939d1520f3f Mon Sep 17 00:00:00 2001
From: Yuta Nakai <nak5...@live.jp>
Date: Sun, 7 Feb 2016 17:10:12 +0900
Subject: [PATCH] complex: Add clog10*.
---
mingw-w64-crt/Makefile.am | 27 ++++++------
mingw-w64-crt/complex/clog10.c | 48 +++++++++++++++++++++
mingw-w64-crt/complex/clog10.def.h | 71 ++++++++++++++++++++++++++++++++
mingw-w64-crt/complex/clog10f.c | 48 +++++++++++++++++++++
mingw-w64-crt/complex/clog10l.c | 48 +++++++++++++++++++++
mingw-w64-crt/complex/complex_internal.h | 4 +-
mingw-w64-headers/crt/complex.h | 13 +++++-
7 files changed, 243 insertions(+), 16 deletions(-)
create mode 100644 mingw-w64-crt/complex/clog10.c
create mode 100644 mingw-w64-crt/complex/clog10.def.h
create mode 100644 mingw-w64-crt/complex/clog10f.c
create mode 100644 mingw-w64-crt/complex/clog10l.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 038dea5..2815196 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -221,19 +221,20 @@ src_msvcrt32=\
src_libmingwex=\
crt/dllentry.c crt/dllmain.c \
\
- complex/_cabs.c complex/cabs.c complex/cabsf.c complex/cabsl.c
complex/cacos.c complex/cacosf.c complex/cacosl.c \
- complex/carg.c complex/cargf.c complex/cargl.c complex/casin.c
complex/casinf.c complex/casinl.c \
- complex/catan.c complex/catanf.c complex/catanl.c complex/ccos.c
complex/ccosf.c complex/ccosl.c \
- complex/cexp.c complex/cexpf.c complex/cexpl.c complex/cimag.c
complex/cimagf.c complex/cimagl.c \
- complex/clog.c complex/clogf.c complex/clogl.c complex/conj.c
complex/conjf.c complex/conjl.c \
- complex/cpow.c complex/cpowf.c complex/cpowl.c complex/cproj.c
complex/cprojf.c complex/cprojl.c \
- complex/creal.c complex/crealf.c complex/creall.c complex/csin.c
complex/csinf.c complex/csinl.c \
- complex/csqrt.c complex/csqrtf.c complex/csqrtl.c complex/ctan.c
complex/ctanf.c complex/ctanl.c \
- complex/cabs.def.h complex/cacos.def.h complex/cacosh.def.h
complex/carg.def.h complex/casin.def.h \
- complex/casinh.def.h complex/catan.def.h complex/catanh.def.h
complex/ccos.def.h complex/ccosh.def.h \
- complex/cexp.def.h complex/cimag.def.h complex/clog.def.h
complex/complex_internal.h complex/conj.def.h \
- complex/cpow.def.h complex/cproj.def.h complex/creal.def.h
complex/csin.def.h complex/csinh.def.h \
- complex/csqrt.def.h complex/ctan.def.h complex/ctanh.def.h \
+ complex/_cabs.c complex/cabs.c complex/cabsf.c complex/cabsl.c
complex/cacos.c complex/cacosf.c \
+ complex/cacosl.c complex/carg.c complex/cargf.c complex/cargl.c
complex/casin.c complex/casinf.c \
+ complex/casinl.c complex/catan.c complex/catanf.c complex/catanl.c
complex/ccos.c complex/ccosf.c \
+ complex/ccosl.c complex/cexp.c complex/cexpf.c complex/cexpl.c
complex/cimag.c complex/cimagf.c \
+ complex/cimagl.c complex/clog.c complex/clogf.c complex/clogl.c
complex/clog10.c complex/clog10f.c \
+ complex/clog10l.c complex/conj.c complex/conjf.c complex/conjl.c
complex/cpow.c complex/cpowf.c \
+ complex/cpowl.c complex/cproj.c complex/cprojf.c complex/cprojl.c
complex/creal.c complex/crealf.c \
+ complex/creall.c complex/csin.c complex/csinf.c complex/csinl.c
complex/csqrt.c complex/csqrtf.c \
+ complex/csqrtl.c complex/ctan.c complex/ctanf.c complex/ctanl.c \
+ complex/cabs.def.h complex/cacos.def.h complex/cacosh.def.h
complex/carg.def.h complex/casin.def.h \
+ complex/casinh.def.h complex/catan.def.h complex/catanh.def.h
complex/ccos.def.h complex/ccosh.def.h \
+ complex/cexp.def.h complex/cimag.def.h complex/clog.def.h
complex/clog10.def.h complex/complex_internal.h \
+ complex/conj.def.h complex/cpow.def.h complex/cproj.def.h
complex/creal.def.h complex/csin.def.h \
+ complex/csinh.def.h complex/csqrt.def.h complex/ctan.def.h
complex/ctanh.def.h \
\
gdtoa/gd_arith.h gdtoa/gd_qnan.h gdtoa/gdtoa.h gdtoa/gdtoaimp.h \
gdtoa/arithchk.c gdtoa/dmisc.c gdtoa/dtoa.c gdtoa/g_dfmt.c
gdtoa/gdtoa.c gdtoa/gethex.c \
diff --git a/mingw-w64-crt/complex/clog10.c b/mingw-w64-crt/complex/clog10.c
new file mode 100644
index 0000000..f8545cd
--- /dev/null
+++ b/mingw-w64-crt/complex/clog10.c
@@ -0,0 +1,48 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 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.
+*/
+
+/* double version of the functions. */
+#define _NEW_COMPLEX_DOUBLE 1
+#include "complex_internal.h"
+#include "clog10.def.h"
diff --git a/mingw-w64-crt/complex/clog10.def.h
b/mingw-w64-crt/complex/clog10.def.h
new file mode 100644
index 0000000..cdd4eb6
--- /dev/null
+++ b/mingw-w64-crt/complex/clog10.def.h
@@ -0,0 +1,71 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(clog10) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE ret;
+ int r_class = fpclassify (__real__ z);
+ int i_class = fpclassify (__imag__ z);
+
+ if (r_class == FP_ZERO && i_class == FP_ZERO)
+ {
+ __imag__ ret = signbit (__real__ z) ? __FLT_PI : __FLT_CST(0.0);
+ __imag__ ret = __FLT_ABI(copysign) (__imag__ ret, __imag__ z);
+ __real__ ret = -__FLT_CST(1.0) / __FLT_ABI(fabs) (__real__ z);
+ return ret;
+ }
+
+ if (r_class == FP_NAN || i_class == FP_NAN)
+ {
+ __imag__ ret = __FLT_NAN;
+ __real__ ret = ((r_class == FP_INFINITE || i_class == FP_INFINITE) ?
__FLT_HUGE_VAL : __FLT_NAN);
+
+ return ret;
+ }
+
+ __real__ ret = __FLT_ABI(log10) (__FLT_ABI(hypot) (__real__ z, __imag__ z));
+ __imag__ ret = __FLT_LOG10E * __FLT_ABI(atan2) (__imag__ z, __real__ z);
+ return ret;
+}
diff --git a/mingw-w64-crt/complex/clog10f.c b/mingw-w64-crt/complex/clog10f.c
new file mode 100644
index 0000000..36ac497
--- /dev/null
+++ b/mingw-w64-crt/complex/clog10f.c
@@ -0,0 +1,48 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 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.
+*/
+
+/* Float version of the functions. */
+#define _NEW_COMPLEX_FLOAT 1
+#include "complex_internal.h"
+#include "clog10.def.h"
diff --git a/mingw-w64-crt/complex/clog10l.c b/mingw-w64-crt/complex/clog10l.c
new file mode 100644
index 0000000..8baa2aa
--- /dev/null
+++ b/mingw-w64-crt/complex/clog10l.c
@@ -0,0 +1,48 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+#include "clog10.def.h"
diff --git a/mingw-w64-crt/complex/complex_internal.h
b/mingw-w64-crt/complex/complex_internal.h
index d373a8e..cd23c0a 100644
--- a/mingw-w64-crt/complex/complex_internal.h
+++ b/mingw-w64-crt/complex/complex_internal.h
@@ -77,8 +77,8 @@
# define __FLT_PI_3_4 M_PI_3_4
# define __FLT_MAXLOG 88.72283905206835F
# define __FLT_MINLOG -103.278929903431851103F
-
# define __FLT_LOGE2 0.693147180559945309F
+# define __FLT_LOG10E 0.434294481903251828F
# define __FLT_REPORT(NAME) NAME "f"
#elif defined(_NEW_COMPLEX_DOUBLE)
# define __FLT_TYPE double
@@ -94,6 +94,7 @@
# define __FLT_MAXLOG 7.09782712893383996843E2
# define __FLT_MINLOG -7.45133219101941108420E2
# define __FLT_LOGE2 6.93147180559945309417E-1
+# define __FLT_LOG10E 4.34294481903251827651E-1
# define __FLT_REPORT(NAME) NAME
#elif defined(_NEW_COMPLEX_LDOUBLE)
# define __FLT_TYPE long double
@@ -109,6 +110,7 @@
# define __FLT_MAXLOG 1.1356523406294143949492E4L
# define __FLT_MINLOG -1.1355137111933024058873E4L
# define __FLT_LOGE2 6.9314718055994530941723E-1L
+# define __FLT_LOG10E 4.3429448190325182765113E-1L
# define __FLT_REPORT(NAME) NAME "l"
#else
# error "Unknown complex number type"
diff --git a/mingw-w64-headers/crt/complex.h b/mingw-w64-headers/crt/complex.h
index 32736b6..5d99a29 100644
--- a/mingw-w64-headers/crt/complex.h
+++ b/mingw-w64-headers/crt/complex.h
@@ -44,7 +44,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#ifndef RC_INVOKED
@@ -67,6 +67,9 @@ double _Complex csinh (double _Complex);
double _Complex ctanh (double _Complex);
double _Complex cexp (double _Complex);
double _Complex clog (double _Complex);
+#ifdef _GNU_SOURCE
+double _Complex clog10(double _Complex);
+#endif /* _GNU_SOURCE */
double _Complex cpow (double _Complex, double _Complex);
double _Complex csqrt (double _Complex);
double _Complex __MINGW_ATTRIB_CONST cproj (double _Complex);
@@ -90,6 +93,9 @@ float _Complex csinhf (float _Complex);
float _Complex ctanhf (float _Complex);
float _Complex cexpf (float _Complex);
float _Complex clogf (float _Complex);
+#ifdef _GNU_SOURCE
+float _Complex clog10f(float _Complex);
+#endif /* _GNU_SOURCE */
float _Complex cpowf (float _Complex, float _Complex);
float _Complex csqrtf (float _Complex);
float _Complex __MINGW_ATTRIB_CONST cprojf (float _Complex);
@@ -113,6 +119,9 @@ long double _Complex csinhl (long double _Complex);
long double _Complex ctanhl (long double _Complex);
long double _Complex cexpl (long double _Complex);
long double _Complex clogl (long double _Complex);
+#ifdef _GNU_SOURCE
+long double _Complex clog10l(long double _Complex);
+#endif /* _GNU_SOURCE */
long double _Complex cpowl (long double _Complex, long double _Complex);
long double _Complex csqrtl (long double _Complex);
long double _Complex __MINGW_ATTRIB_CONST cprojl (long double _Complex);
@@ -204,6 +213,6 @@ __CRT_INLINE long double __MINGW_ATTRIB_CONST cabsl (long
double _Complex _Z)
#ifdef __cplusplus
}
-#endif
+#endif
#endif /* _COMPLEX_H */
--
2.7.2
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public