From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id 7F4813857C7B for ; Thu, 20 Aug 2020 22:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F4813857C7B Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id ADDB73F2D5C4 for ; Thu, 20 Aug 2020 15:14:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WXnwb9bIVwtg; Thu, 20 Aug 2020 15:14:51 -0700 (PDT) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id E1FD63F2D5B6; Thu, 20 Aug 2020 15:14:50 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 8C0A41582202; Thu, 20 Aug 2020 15:14:50 -0700 (PDT) From: Keith Packard To: newlib@sourceware.org Subject: [PATCH 3/6] Avoid implicit floating point conversions Date: Thu, 20 Aug 2020 15:14:46 -0700 Message-Id: <20200820221449.686006-4-keithp@keithp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820221449.686006-1-keithp@keithp.com> References: <20200820221449.686006-1-keithp@keithp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 22:15:00 -0000 These were found with clang -Wdouble-promotion and show places where floating point values were being implicitly converted between representations. These conversions can result in unexpected use of double precision arithmetic. Those which are intentional all have an explicit cast added. Signed-off-by: Keith Packard --- newlib/libc/include/complex.h | 4 +++- newlib/libc/include/limits.h | 5 +++++ newlib/libc/include/math.h | 20 ++++++++++++++++++-- newlib/libc/stdlib/efgcvt.c | 4 ++-- newlib/libc/stdlib/strtod.c | 4 ++-- newlib/libc/stdlib/wcstod.c | 6 +++--- newlib/libm/common/cosf.c | 2 +- newlib/libm/common/math_errf.c | 2 +- newlib/libm/common/nexttowardf.c | 8 ++++---- newlib/libm/common/sf_logb.c | 2 +- newlib/libm/common/sf_pow.c | 2 +- newlib/libm/common/sincosf.c | 2 +- newlib/libm/common/sinf.c | 2 +- newlib/libm/common/sqrtl.c | 25 +++---------------------- newlib/libm/complex/cacosf.c | 6 +++--- newlib/libm/complex/cacoshf.c | 4 ++-- newlib/libm/complex/casinf.c | 18 +++++++++--------- newlib/libm/complex/casinhf.c | 6 +++--- newlib/libm/complex/catanf.c | 8 ++++---- newlib/libm/complex/catanhf.c | 6 +++--- newlib/libm/complex/ccosf.c | 6 +++--- newlib/libm/complex/ccoshf.c | 6 +++--- newlib/libm/complex/cephes_subrf.c | 8 ++++---- newlib/libm/complex/cexpf.c | 6 +++--- newlib/libm/complex/clog10f.c | 2 +- newlib/libm/complex/clogf.c | 6 +++--- newlib/libm/complex/cpowf.c | 8 ++++---- newlib/libm/complex/cprojf.c | 8 ++++---- newlib/libm/complex/csinf.c | 6 +++--- newlib/libm/complex/csinhf.c | 6 +++--- newlib/libm/complex/csqrtf.c | 20 ++++++++++---------- newlib/libm/complex/ctanf.c | 8 ++++---- newlib/libm/complex/ctanhf.c | 6 +++--- newlib/libm/math/ef_scalb.c | 10 +++++----- newlib/libm/math/wf_acos.c | 2 +- newlib/libm/math/wf_acosh.c | 2 +- newlib/libm/math/wf_asin.c | 2 +- newlib/libm/math/wf_atanh.c | 2 +- newlib/libm/math/wf_cosh.c | 2 +- newlib/libm/math/wf_fmod.c | 2 +- newlib/libm/math/wf_j0.c | 4 ++-- newlib/libm/math/wf_j1.c | 4 ++-- newlib/libm/math/wf_jn.c | 4 ++-- newlib/libm/math/wf_log.c | 2 +- newlib/libm/math/wf_log10.c | 2 +- newlib/libm/math/wf_pow.c | 4 ++-- newlib/libm/math/wf_remainder.c | 2 +- newlib/libm/math/wf_scalb.c | 6 +++--- newlib/libm/math/wf_sqrt.c | 2 +- 49 files changed, 144 insertions(+), 140 deletions(-) diff --git a/newlib/libc/include/complex.h b/newlib/libc/include/complex.h index 0a3ea97ed..13b300021 100644 --- a/newlib/libc/include/complex.h +++ b/newlib/libc/include/complex.h @@ -9,8 +9,10 @@ #define _COMPLEX_H #define complex _Complex -#define _Complex_I 1.0fi +#define _Complex_I 1.0i +#define _Complex_If 1.0if #define I _Complex_I +#define I_f _Complex_If #include diff --git a/newlib/libc/include/limits.h b/newlib/libc/include/limits.h index 893f10834..011a888e6 100644 --- a/newlib/libc/include/limits.h +++ b/newlib/libc/include/limits.h @@ -129,6 +129,11 @@ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ +#ifdef __clang__ +#ifndef __GLIBC_USE +#define __GLIBC_USE(x) 1 +#endif +#endif # include_next #endif /* __GNUC__ && !_GCC_LIMITS_H_ */ diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index 5e6155cc4..d8e25ab5c 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -28,11 +28,27 @@ _BEGIN_STD_C # endif # ifndef INFINITY -# define INFINITY (__builtin_inff()) +# define INFINITY (__builtin_inf()) +# endif + +# ifndef INFINITYF +# define INFINITYF (__builtin_inff()) +# endif + +# ifndef INFINITYL +# define INFINITYL (__builtin_infl()) # endif # ifndef NAN -# define NAN (__builtin_nanf("")) +# define NAN (__builtin_nan("")) +# endif + +# ifndef NANF +# define NANF (__builtin_nanf("")) +# endif + +# ifndef NANL +# define NANL (__builtin_nanl("")) # endif #else /* !gcc >= 3.3 */ diff --git a/newlib/libc/stdlib/efgcvt.c b/newlib/libc/stdlib/efgcvt.c index 3cdb9c420..3328cb75f 100644 --- a/newlib/libc/stdlib/efgcvt.c +++ b/newlib/libc/stdlib/efgcvt.c @@ -120,7 +120,7 @@ fcvtf (float d, int *decpt, int *sign) { - return fcvt ((float) d, ndigit, decpt, sign); + return fcvt ((double) d, ndigit, decpt, sign); } @@ -144,7 +144,7 @@ gcvtf (float d, int ndigit, char *buf) { - double asd = d; + double asd = (double) d; return gcvt (asd, ndigit, buf); } diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index 8bb75ef0a..850393b22 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -1292,7 +1292,7 @@ strtof_l (const char *__restrict s00, char **__restrict se, locale_t loc) return signbit (val) ? -nanf ("") : nanf (""); float retval = (float) val; #ifndef NO_ERRNO - if (isinf (retval) && !isinf (val)) + if (isinff (retval) && !isinff (val)) _REENT->_errno = ERANGE; #endif return retval; @@ -1307,7 +1307,7 @@ strtof (const char *__restrict s00, return signbit (val) ? -nanf ("") : nanf (""); float retval = (float) val; #ifndef NO_ERRNO - if (isinf (retval) && !isinf (val)) + if (isinff (retval) && !isinff (val)) _REENT->_errno = ERANGE; #endif return retval; diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c index 375ffe288..6bb01cdd8 100644 --- a/newlib/libc/stdlib/wcstod.c +++ b/newlib/libc/stdlib/wcstod.c @@ -227,7 +227,7 @@ _wcstof_r (struct _reent *ptr, wchar_t **endptr) { double retval = _wcstod_l (ptr, nptr, endptr, __get_current_locale ()); - if (isnan (retval)) + if (isnanf (retval)) return nanf (""); return (float)retval; } @@ -256,7 +256,7 @@ wcstof_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, return nanf (""); float retval = (float) val; #ifndef NO_ERRNO - if (isinf (retval) && !isinf (val)) + if (isinff (retval) && !isinff (val)) _REENT->_errno = ERANGE; #endif return retval; @@ -271,7 +271,7 @@ wcstof (const wchar_t *__restrict nptr, return nanf (""); float retval = (float) val; #ifndef NO_ERRNO - if (isinf (retval) && !isinf (val)) + if (isinff (retval) && !isinff (val)) _REENT->_errno = ERANGE; #endif diff --git a/newlib/libm/common/cosf.c b/newlib/libm/common/cosf.c index 1fafcbc24..7f59adf13 100644 --- a/newlib/libm/common/cosf.c +++ b/newlib/libm/common/cosf.c @@ -41,7 +41,7 @@ float cosf (float y) { - double x = y; + double x = (double) y; double s; int n; const sincos_t *p = &__sincosf_table[0]; diff --git a/newlib/libm/common/math_errf.c b/newlib/libm/common/math_errf.c index bb8273b8d..e513d9547 100644 --- a/newlib/libm/common/math_errf.c +++ b/newlib/libm/common/math_errf.c @@ -86,5 +86,5 @@ HIDDEN float __math_invalidf (float x) { float y = (x - x) / (x - x); - return isnan (x) ? y : with_errnof (y, EDOM); + return isnanf (x) ? y : with_errnof (y, EDOM); } diff --git a/newlib/libm/common/nexttowardf.c b/newlib/libm/common/nexttowardf.c index e2a1d90e6..4c4da6c70 100644 --- a/newlib/libm/common/nexttowardf.c +++ b/newlib/libm/common/nexttowardf.c @@ -41,16 +41,16 @@ nexttowardf (float x, long double y) union fshape ux; uint32_t e; - if (isnan(x) || isnan(y)) - return x + y; - if (x == y) + if (isnanf(x) || isnan(y)) + return (long double) x + y; + if ((long double) x == y) return y; ux.value = x; if (x == 0) { ux.bits = 1; if (signbit(y)) ux.bits |= 0x80000000; - } else if (x < y) { + } else if ((long double) x < y) { if (signbit(x)) ux.bits--; else diff --git a/newlib/libm/common/sf_logb.c b/newlib/libm/common/sf_logb.c index 75336a1e0..8319a47ff 100644 --- a/newlib/libm/common/sf_logb.c +++ b/newlib/libm/common/sf_logb.c @@ -36,7 +36,7 @@ float x; float xx; /* arg==0: return -inf and raise divide-by-zero exception */ SET_FLOAT_WORD(xx,hx); /* +0.0 */ - return -1./xx; /* logbf(0) = -inf */ + return -1.f/xx; /* logbf(0) = -inf */ } if(FLT_UWORD_IS_SUBNORMAL(hx)) { for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; diff --git a/newlib/libm/common/sf_pow.c b/newlib/libm/common/sf_pow.c index 2946c611b..1820cc868 100644 --- a/newlib/libm/common/sf_pow.c +++ b/newlib/libm/common/sf_pow.c @@ -213,7 +213,7 @@ powf (float x, float y) } } double_t logx = log2_inline (ix); - double_t ylogx = y * logx; /* Note: cannot overflow, y is single prec. */ + double_t ylogx = (double) y * logx; /* Note: cannot overflow, y is single prec. */ if (__builtin_expect ((asuint64 (ylogx) >> 47 & 0xffff) >= asuint64 (126.0 * POWF_SCALE) >> 47, 0)) diff --git a/newlib/libm/common/sincosf.c b/newlib/libm/common/sincosf.c index 5053baf26..538cc5673 100644 --- a/newlib/libm/common/sincosf.c +++ b/newlib/libm/common/sincosf.c @@ -41,7 +41,7 @@ void sincosf (float y, float *sinp, float *cosp) { - double x = y; + double x = (double) y; double s; int n; const sincos_t *p = &__sincosf_table[0]; diff --git a/newlib/libm/common/sinf.c b/newlib/libm/common/sinf.c index 8cb77ef81..4f4e6d3ae 100644 --- a/newlib/libm/common/sinf.c +++ b/newlib/libm/common/sinf.c @@ -40,7 +40,7 @@ float sinf (float y) { - double x = y; + double x = (double) y; double s; int n; const sincos_t *p = &__sincosf_table[0]; diff --git a/newlib/libm/common/sqrtl.c b/newlib/libm/common/sqrtl.c index 9976f35e7..234f1b7a3 100644 --- a/newlib/libm/common/sqrtl.c +++ b/newlib/libm/common/sqrtl.c @@ -98,25 +98,6 @@ inc (long double x) return ux.extu_ld; } -/* Return (x - ulp) for normal positive x. Assumes no underflow. */ - -static inline long double -dec (long double x) -{ - union ieee_ext_u ux = { .extu_ld = x, }; - - if (ux.extu_ext.ext_fracl-- == 0) - { - if (ux.extu_ext.ext_frach-- == LDBL_NBIT) - { - ux.extu_ext.ext_exp--; - ux.extu_ext.ext_frach |= LDBL_NBIT; - } - } - - return ux.extu_ld; -} - /* This is slow, but simple and portable. */ long double @@ -143,7 +124,7 @@ sqrtl (long double x) if (ux.extu_ext.ext_exp == 0) { /* Adjust subnormal numbers. */ - ux.extu_ld *= 0x1.0p514; + ux.extu_ld *= 0x1.0p514l; k = -514; } else @@ -167,10 +148,10 @@ sqrtl (long double x) /* Newton's iteration. Split ux.extu_ld into a high and low part to achieve additional precision. */ - xn = sqrt ((double) ux.extu_ld); /* 53-bit estimate of sqrtl(x). */ + xn = (long double) sqrt ((double) ux.extu_ld); /* 53-bit estimate of sqrtl(x). */ #if LDBL_MANT_DIG > 100 - xn = (xn + (ux.extu_ld / xn)) * 0.5; /* 106-bit estimate. */ + xn = (xn + (ux.extu_ld / xn)) * 0.5l; /* 106-bit estimate. */ #endif lo = ux.extu_ld; diff --git a/newlib/libm/complex/cacosf.c b/newlib/libm/complex/cacosf.c index 3874dd5f6..ba698e584 100644 --- a/newlib/libm/complex/cacosf.c +++ b/newlib/libm/complex/cacosf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -41,6 +41,6 @@ cacosf(float complex z) float complex w; w = casinf(z); - w = ((float)M_PI_2 - crealf(w)) - cimagf(w) * I; + w = ((float)M_PI_2 - crealf(w)) - cimagf(w) * I_f; return w; } diff --git a/newlib/libm/complex/cacoshf.c b/newlib/libm/complex/cacoshf.c index 41a557ad7..2ce04258e 100644 --- a/newlib/libm/complex/cacoshf.c +++ b/newlib/libm/complex/cacoshf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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/newlib/libm/complex/casinf.c b/newlib/libm/complex/casinf.c index 9a9f759ef..c4c120de4 100644 --- a/newlib/libm/complex/casinf.c +++ b/newlib/libm/complex/casinf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -52,12 +52,12 @@ casinf(float complex z) #if 0 /* MD: test is incorrect, casin(>1) is defined */ if (y == 0.0f) { if (fabsf(x) > 1.0) { - w = M_PI_2 + 0.0f * I; + w = M_PI_2 + 0.0f * I_f; #if 0 mtherr ("casin", DOMAIN); #endif } else { - w = asinf(x) + 0.0f * I; + w = asinf(x) + 0.0f * I_f; } return w; } @@ -104,19 +104,19 @@ return; */ - ca = x + y * I; - ct = ca * I; + ca = x + y * I_f; + ct = ca * I_f; /* sqrt( 1 - z*z) */ /* cmul( &ca, &ca, &zz ) */ /*x * x - y * y */ - zz = (x - y) * (x + y) + (2.0f * x * y) * I; + zz = (x - y) * (x + y) + (2.0f * x * y) * I_f; - zz = 1.0f - crealf(zz) - cimagf(zz) * I; + zz = 1.0f - crealf(zz) - cimagf(zz) * I_f; z2 = csqrtf(zz); zz = ct + z2; zz = clogf(zz); /* multiply by 1/i = -i */ - w = zz * (-1.0f * I); + w = zz * (-1.0f * I_f); return w; } diff --git a/newlib/libm/complex/casinhf.c b/newlib/libm/complex/casinhf.c index 0db55a0ad..b9b92d2c7 100644 --- a/newlib/libm/complex/casinhf.c +++ b/newlib/libm/complex/casinhf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -39,6 +39,6 @@ casinhf(float complex z) { float complex w; - w = -1.0f * I * casinf(z * I); + w = -1.0f * I_f * casinf(z * I_f); return w; } diff --git a/newlib/libm/complex/catanf.c b/newlib/libm/complex/catanf.c index ac1a65c08..1043e193b 100644 --- a/newlib/libm/complex/catanf.c +++ b/newlib/libm/complex/catanf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -67,13 +67,13 @@ catanf(float complex z) t = y + 1.0f; a = (x2 + (t * t))/a; - w = w + (0.25f * logf(a)) * I; + w = w + (0.25f * logf(a)) * I_f; return w; ovrf: #if 0 mtherr ("catan", OVERFLOW); #endif - w = HUGE_VALF + HUGE_VALF * I; + w = HUGE_VALF + HUGE_VALF * I_f; return w; } diff --git a/newlib/libm/complex/catanhf.c b/newlib/libm/complex/catanhf.c index fe6127a9d..96dfafb26 100644 --- a/newlib/libm/complex/catanhf.c +++ b/newlib/libm/complex/catanhf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -39,6 +39,6 @@ catanhf(float complex z) { float complex w; - w = -1.0f * I * catanf(z * I); + w = -1.0f * I_f * catanf(z * I_f); return w; } diff --git a/newlib/libm/complex/ccosf.c b/newlib/libm/complex/ccosf.c index 805e24feb..1520aec36 100644 --- a/newlib/libm/complex/ccosf.c +++ b/newlib/libm/complex/ccosf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -43,6 +43,6 @@ ccosf(float complex z) float ch, sh; _cchshf(cimagf(z), &ch, &sh); - w = cosf(crealf(z)) * ch - (sinf(crealf(z)) * sh) * I; + w = cosf(crealf(z)) * ch - (sinf(crealf(z)) * sh) * I_f; return w; } diff --git a/newlib/libm/complex/ccoshf.c b/newlib/libm/complex/ccoshf.c index af11353e4..118e85542 100644 --- a/newlib/libm/complex/ccoshf.c +++ b/newlib/libm/complex/ccoshf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -43,6 +43,6 @@ ccoshf(float complex z) x = crealf(z); y = cimagf(z); - w = coshf(x) * cosf(y) + (sinhf(x) * sinf(y)) * I; + w = coshf(x) * cosf(y) + (sinhf(x) * sinf(y)) * I_f; return w; } diff --git a/newlib/libm/complex/cephes_subrf.c b/newlib/libm/complex/cephes_subrf.c index 4a325811f..98b5a74f3 100644 --- a/newlib/libm/complex/cephes_subrf.c +++ b/newlib/libm/complex/cephes_subrf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -61,7 +61,7 @@ _cchshf(float x, float *c, float *s) static const double DP1 = 3.140625; static const double DP2 = 9.67502593994140625E-4; static const double DP3 = 1.509957990978376432E-7; -#define MACHEPF 3.0e-8 +#define MACHEPF 3.0e-8f float _redupif(float x) @@ -77,7 +77,7 @@ _redupif(float x) i = t; /* the multiple */ t = i; - t = ((x - t * DP1) - t * DP2) - t * DP3; + t = (((double) x - (double) t * DP1) - (double) t * DP2) - (double) t * DP3; return t; } diff --git a/newlib/libm/complex/cexpf.c b/newlib/libm/complex/cexpf.c index 07fab1f16..85a1579d7 100644 --- a/newlib/libm/complex/cexpf.c +++ b/newlib/libm/complex/cexpf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -44,6 +44,6 @@ cexpf(float complex z) x = crealf(z); y = cimagf(z); r = expf(x); - w = r * cosf(y) + r * sinf(y) * I; + w = r * cosf(y) + r * sinf(y) * I_f; return w; } diff --git a/newlib/libm/complex/clog10f.c b/newlib/libm/complex/clog10f.c index 124273227..d15d89f69 100644 --- a/newlib/libm/complex/clog10f.c +++ b/newlib/libm/complex/clog10f.c @@ -10,6 +10,6 @@ clog10f(float complex z) rr = cabsf(z); p = log10f(rr); rr = atan2f(cimagf(z), crealf(z)) * (float) M_IVLN10; - w = p + rr * I; + w = p + rr * I_f; return w; } diff --git a/newlib/libm/complex/clogf.c b/newlib/libm/complex/clogf.c index 078cea5d3..25ef42154 100644 --- a/newlib/libm/complex/clogf.c +++ b/newlib/libm/complex/clogf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -44,6 +44,6 @@ clogf(float complex z) rr = cabsf(z); p = logf(rr); rr = atan2f(cimagf(z), crealf(z)); - w = p + rr * I; + w = p + rr * I_f; return w; } diff --git a/newlib/libm/complex/cpowf.c b/newlib/libm/complex/cpowf.c index 1e736af36..3b5e9f8ee 100644 --- a/newlib/libm/complex/cpowf.c +++ b/newlib/libm/complex/cpowf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -45,7 +45,7 @@ cpowf(float complex a, float complex z) y = cimagf(z); absa = cabsf(a); if (absa == 0.0f) { - return (0.0f + 0.0f * I); + return (0.0f + 0.0f * I_f); } arga = cargf(a); r = powf(absa, x); @@ -54,6 +54,6 @@ cpowf(float complex a, float complex z) r = r * expf(-y * arga); theta = theta + y * logf(absa); } - w = r * cosf(theta) + (r * sinf(theta)) * I; + w = r * cosf(theta) + (r * sinf(theta)) * I_f; return w; } diff --git a/newlib/libm/complex/cprojf.c b/newlib/libm/complex/cprojf.c index 1310170b6..c8dac492d 100644 --- a/newlib/libm/complex/cprojf.c +++ b/newlib/libm/complex/cprojf.c @@ -20,7 +20,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -45,9 +45,9 @@ * * z projects to z, except that all complex infinities (even those with one * infinite part and one NaN part) project to positive infinity on the real axis. - * If z has an infinite part, then cproj(z) shall be equivalent to: + * I_ff z has an infinite part, then cproj(z) shall be equivalent to: * - * INFINITY + I * copysign(0.0, cimag(z)) + * I_fNFINITY + I * copysign(0.0, cimag(z)) */ float complex @@ -55,7 +55,7 @@ cprojf(float complex z) { float_complex w = { .z = z }; - if (isinf(crealf(z)) || isinf(cimagf(z))) { + if (isinff(crealf(z)) || isinff(cimagf(z))) { #ifdef __INFINITY REAL_PART(w) = __INFINITY; #else diff --git a/newlib/libm/complex/csinf.c b/newlib/libm/complex/csinf.c index 68cefe4fa..b7db7b3a7 100644 --- a/newlib/libm/complex/csinf.c +++ b/newlib/libm/complex/csinf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -43,6 +43,6 @@ csinf(float complex z) float ch, sh; _cchshf(cimagf(z), &ch, &sh); - w = sinf(crealf(z)) * ch + (cosf(crealf(z)) * sh) * I; + w = sinf(crealf(z)) * ch + (cosf(crealf(z)) * sh) * I_f; return w; } diff --git a/newlib/libm/complex/csinhf.c b/newlib/libm/complex/csinhf.c index 3cd6ba7f9..7efa0be33 100644 --- a/newlib/libm/complex/csinhf.c +++ b/newlib/libm/complex/csinhf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -43,6 +43,6 @@ csinhf(float complex z) x = crealf(z); y = cimagf(z); - w = sinhf(x) * cosf(y) + (coshf(x) * sinf(y)) * I; + w = sinhf(x) * cosf(y) + (coshf(x) * sinf(y)) * I_f; return w; } diff --git a/newlib/libm/complex/csqrtf.c b/newlib/libm/complex/csqrtf.c index 13451fa5a..5f8a2624a 100644 --- a/newlib/libm/complex/csqrtf.c +++ b/newlib/libm/complex/csqrtf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -46,12 +46,12 @@ csqrtf(float complex z) if (y == 0.0f) { if (x < 0.0f) { - w = 0.0f + sqrtf(-x) * I; + w = 0.0f + sqrtf(-x) * I_f; return w; } else if (x == 0.0f) { - return (0.0f + y * I); + return (0.0f + y * I_f); } else { - w = sqrtf(x) + y * I; + w = sqrtf(x) + y * I_f; return w; } } @@ -60,9 +60,9 @@ csqrtf(float complex z) r = fabsf(y); r = sqrtf(0.5f * r); if (y > 0) - w = r + r * I; + w = r + r * I_f; else - w = r - r * I; + w = r - r * I_f; return w; } @@ -82,7 +82,7 @@ csqrtf(float complex z) scale = 0.5f; #endif } - w = x + y * I; + w = x + y * I_f; r = cabsf(w); if( x > 0 ) { t = sqrtf(0.5f * r + 0.5f * x); @@ -95,8 +95,8 @@ csqrtf(float complex z) } if (y < 0) - w = t - r * I; + w = t - r * I_f; else - w = t + r * I; + w = t + r * I_f; return w; } diff --git a/newlib/libm/complex/ctanf.c b/newlib/libm/complex/ctanf.c index a75ff1c66..63ca30731 100644 --- a/newlib/libm/complex/ctanf.c +++ b/newlib/libm/complex/ctanf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -49,10 +49,10 @@ ctanf(float complex z) if (d == 0.0f) { /* mtherr ("ctan", OVERFLOW); */ - w = HUGE_VALF + HUGE_VALF * I; + w = HUGE_VALF + HUGE_VALF * I_f; return w; } - w = sinf(2.0f * crealf(z)) / d + (sinhf(2.0f * cimagf(z)) / d) * I; + w = sinf(2.0f * crealf(z)) / d + (sinhf(2.0f * cimagf(z)) / d) * I_f; return w; } diff --git a/newlib/libm/complex/ctanhf.c b/newlib/libm/complex/ctanhf.c index 6aaf20f1d..35dfd981b 100644 --- a/newlib/libm/complex/ctanhf.c +++ b/newlib/libm/complex/ctanhf.c @@ -5,7 +5,7 @@ * All rights reserved. * * This code is derived from software written by Stephen L. Moshier. - * It is redistributed by the NetBSD Foundation by permission of the author. + * I_ft is redistributed by the NetBSD Foundation by permission of the author. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 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 + * I_fNTERRUPTION) 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. @@ -44,7 +44,7 @@ ctanhf(float complex z) x = crealf(z); y = cimagf(z); d = coshf(2.0f * x) + cosf(2.0f * y); - w = sinhf(2.0f * x) / d + (sinf(2.0f * y) / d) * I; + w = sinhf(2.0f * x) / d + (sinf(2.0f * y) / d) * I_f; return w; } diff --git a/newlib/libm/math/ef_scalb.c b/newlib/libm/math/ef_scalb.c index 8d973b1e7..ac8020bad 100644 --- a/newlib/libm/math/ef_scalb.c +++ b/newlib/libm/math/ef_scalb.c @@ -35,18 +35,18 @@ #ifdef _SCALB_INT return scalbnf(x,fn); #else - if (isnan(x)||isnan(fn)) return x*fn; + if (isnanf(x)||isnanf(fn)) return x*fn; if (!finitef(fn)) { if(fn>(float)0.0) return x*fn; else return x/(-fn); } if (rintf(fn)!=fn) return (fn-fn)/(fn-fn); #if INT_MAX > 65000 - if ( fn > (float)65000.0) return scalbnf(x, 65000); - if (-fn > (float)65000.0) return scalbnf(x,-65000); + if ( fn > 65000.0f) return scalbnf(x, 65000); + if (-fn > 65000.0f) return scalbnf(x,-65000); #else - if ( fn > (float)32000.0) return scalbnf(x, 32000); - if (-fn > (float)32000.0) return scalbnf(x,-32000); + if ( fn > 32000.0f) return scalbnf(x, 32000); + if (-fn > 32000.0f) return scalbnf(x,-32000); #endif return scalbnf(x,(int)fn); #endif diff --git a/newlib/libm/math/wf_acos.c b/newlib/libm/math/wf_acos.c index c24912de5..c0d832848 100644 --- a/newlib/libm/math/wf_acos.c +++ b/newlib/libm/math/wf_acos.c @@ -27,7 +27,7 @@ #else float z; z = __ieee754_acosf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(fabsf(x)>1.0f) { /* acosf(|x|>1) */ errno = EDOM; diff --git a/newlib/libm/math/wf_acosh.c b/newlib/libm/math/wf_acosh.c index 6a8000fee..b919b7464 100644 --- a/newlib/libm/math/wf_acosh.c +++ b/newlib/libm/math/wf_acosh.c @@ -33,7 +33,7 @@ #else float z; z = __ieee754_acoshf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(x<1.0f) { /* acoshf(x<1) */ errno = EDOM; diff --git a/newlib/libm/math/wf_asin.c b/newlib/libm/math/wf_asin.c index c9f15e352..c435f1725 100644 --- a/newlib/libm/math/wf_asin.c +++ b/newlib/libm/math/wf_asin.c @@ -34,7 +34,7 @@ #else float z; z = __ieee754_asinf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(fabsf(x)>1.0f) { /* asinf(|x|>1) */ errno = EDOM; diff --git a/newlib/libm/math/wf_atanh.c b/newlib/libm/math/wf_atanh.c index 31e049006..ccbf9452c 100644 --- a/newlib/libm/math/wf_atanh.c +++ b/newlib/libm/math/wf_atanh.c @@ -31,7 +31,7 @@ #else float z,y; z = __ieee754_atanhf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; y = fabsf(x); if(y>=1.0f) { if(y>1.0f) { diff --git a/newlib/libm/math/wf_cosh.c b/newlib/libm/math/wf_cosh.c index 976009914..b9cb4891a 100644 --- a/newlib/libm/math/wf_cosh.c +++ b/newlib/libm/math/wf_cosh.c @@ -32,7 +32,7 @@ #else float z; z = __ieee754_coshf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(fabsf(x)>8.9415985107e+01f) { /* coshf(finite) overflow */ errno = ERANGE; diff --git a/newlib/libm/math/wf_fmod.c b/newlib/libm/math/wf_fmod.c index 451318ea3..22ad50153 100644 --- a/newlib/libm/math/wf_fmod.c +++ b/newlib/libm/math/wf_fmod.c @@ -32,7 +32,7 @@ #else float z; z = __ieee754_fmodf(x,y); - if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ ||isnanf(y)||isnanf(x)) return z; if(y==0.0f) { /* fmodf(x,0) */ errno = EDOM; diff --git a/newlib/libm/math/wf_j0.c b/newlib/libm/math/wf_j0.c index ed21a01f5..2fc2db959 100644 --- a/newlib/libm/math/wf_j0.c +++ b/newlib/libm/math/wf_j0.c @@ -31,7 +31,7 @@ return __ieee754_j0f(x); #else float z = __ieee754_j0f(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(fabsf(x)>(float)X_TLOSS) { /* j0f(|x|>X_TLOSS) */ errno = ERANGE; @@ -52,7 +52,7 @@ #else float z; z = __ieee754_y0f(x); - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z; if(x < 0.0f){ /* y0f(x<0) = NaN */ errno = EDOM; diff --git a/newlib/libm/math/wf_j1.c b/newlib/libm/math/wf_j1.c index a4609ba28..5ce379660 100644 --- a/newlib/libm/math/wf_j1.c +++ b/newlib/libm/math/wf_j1.c @@ -33,7 +33,7 @@ #else float z; z = __ieee754_j1f(x); - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z; if(fabsf(x)>(float)X_TLOSS) { /* j1f(|x|>X_TLOSS) */ errno = ERANGE; @@ -55,7 +55,7 @@ #else float z; z = __ieee754_y1f(x); - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z; if(x < 0.0f){ /* y1f(x<0) = NaN */ errno = EDOM; diff --git a/newlib/libm/math/wf_jn.c b/newlib/libm/math/wf_jn.c index b82346d79..54712f86e 100644 --- a/newlib/libm/math/wf_jn.c +++ b/newlib/libm/math/wf_jn.c @@ -29,7 +29,7 @@ #else float z; z = __ieee754_jnf(n,x); - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z; if(fabsf(x)>(float)X_TLOSS) { /* jnf(|x|>X_TLOSS) */ errno = ERANGE; @@ -50,7 +50,7 @@ #else float z; z = __ieee754_ynf(n,x); - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z; if(x < 0.0f){ /* ynf(x<0) = NaN */ errno = EDOM; diff --git a/newlib/libm/math/wf_log.c b/newlib/libm/math/wf_log.c index 97f4a7f1a..f6b34159a 100644 --- a/newlib/libm/math/wf_log.c +++ b/newlib/libm/math/wf_log.c @@ -33,7 +33,7 @@ #else float z; z = __ieee754_logf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0f) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x) || x > 0.0f) return z; if(x==0.0f) { /* logf(0) */ errno = ERANGE; diff --git a/newlib/libm/math/wf_log10.c b/newlib/libm/math/wf_log10.c index 529ed6514..f37221d4a 100644 --- a/newlib/libm/math/wf_log10.c +++ b/newlib/libm/math/wf_log10.c @@ -32,7 +32,7 @@ #else float z; z = __ieee754_log10f(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(x<=0.0f) { if(x==0.0f) { /* log10f(0) */ diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c index e9babf67c..12586591c 100644 --- a/newlib/libm/math/wf_pow.c +++ b/newlib/libm/math/wf_pow.c @@ -33,7 +33,7 @@ #else float z; z=__ieee754_powf(x,y); - if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; + if(_LIB_VERSION == _IEEE_|| isnanf(y)) return z; if(x==0.0f){ if(y==0.0f) { /* powf(0.0,0.0) */ @@ -48,7 +48,7 @@ } if(!finitef(z)) { if(finitef(x)&&finitef(y)) { - if(isnan(z)) { + if(isnanf(z)) { /* neg**non-integral */ errno = EDOM; /* Use a float divide, to avoid a soft-float double diff --git a/newlib/libm/math/wf_remainder.c b/newlib/libm/math/wf_remainder.c index 463d1bc32..be6a2614d 100644 --- a/newlib/libm/math/wf_remainder.c +++ b/newlib/libm/math/wf_remainder.c @@ -32,7 +32,7 @@ #else float z; z = __ieee754_remainderf(x,y); - if(_LIB_VERSION == _IEEE_ || isnan(y)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(y)) return z; if(y==0.0f) { /* remainderf(x,0) */ errno = EDOM; diff --git a/newlib/libm/math/wf_scalb.c b/newlib/libm/math/wf_scalb.c index e87dc37dd..edb1a0f14 100644 --- a/newlib/libm/math/wf_scalb.c +++ b/newlib/libm/math/wf_scalb.c @@ -43,15 +43,15 @@ float z; z = __ieee754_scalbf(x,fn); if(_LIB_VERSION == _IEEE_) return z; - if(!(finitef(z)||isnan(z))&&finitef(x)) { + if(!(finitef(z)||isnanf(z))&&finitef(x)) { /* scalbf overflow; */ errno = ERANGE; - return (x > 0.0 ? HUGE_VALF : -HUGE_VALF); + return (x > 0.0f ? HUGE_VALF : -HUGE_VALF); } if(z==0.0f&&z!=x) { /* scalbf underflow */ errno = ERANGE; - return copysign(0.0,x); + return copysignf(0.0,x); } #ifndef _SCALB_INT if(!finitef(fn)) errno = ERANGE; diff --git a/newlib/libm/math/wf_sqrt.c b/newlib/libm/math/wf_sqrt.c index 4107511ae..62aca0858 100644 --- a/newlib/libm/math/wf_sqrt.c +++ b/newlib/libm/math/wf_sqrt.c @@ -32,7 +32,7 @@ #else float z; z = __ieee754_sqrtf(x); - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; if(x<0.0f) { /* sqrtf(negative) */ errno = EDOM; -- 2.28.0