From: guenther Date: Sun, 18 Jul 2010 18:42:26 +0000 (+0000) Subject: Use crealf() and cimagf() instead of creal() and cimag() when the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=60d908e137a0315099596747e9403ad9e8c76849;p=openbsd Use crealf() and cimagf() instead of creal() and cimag() when the argument is a float. Eliminate a cast rendered superfluous as a result. ok kettenis@, millert@ --- diff --git a/lib/libm/src/s_casinf.c b/lib/libm/src/s_casinf.c index 84b2096a4fc..2a964a73763 100644 --- a/lib/libm/src/s_casinf.c +++ b/lib/libm/src/s_casinf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_casinf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_casinf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -62,8 +62,8 @@ casinf(float complex z) static cmplxf sum; */ - x = creal(z); - y = cimag(z); + x = crealf(z); + y = cimagf(z); if(y == 0.0f) { if(fabsf(x) > 1.0f) { @@ -121,7 +121,7 @@ casinf(float complex z) /* cmul( &ca, &ca, &zz ) */ /*x * x - y * y */ zz = (x - y) * (x + y) + (2.0f * x * y) * I; - zz = 1.0f - creal(zz) - cimag(zz) * I; + zz = 1.0f - crealf(zz) - cimagf(zz) * I; z2 = csqrtf (zz); zz = ct + z2; diff --git a/lib/libm/src/s_catanf.c b/lib/libm/src/s_catanf.c index e112e7f090a..efd9096af64 100644 --- a/lib/libm/src/s_catanf.c +++ b/lib/libm/src/s_catanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_catanf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_catanf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -93,8 +93,8 @@ catanf(float complex z) float complex w; float a, t, x, x2, y; - x = creal (z); - y = cimag (z); + x = crealf(z); + y = cimagf(z); if((x == 0.0f) && (y > 1.0f)) goto ovrf; diff --git a/lib/libm/src/s_ccosf.c b/lib/libm/src/s_ccosf.c index 299e06b1276..1b83a575bf4 100644 --- a/lib/libm/src/s_ccosf.c +++ b/lib/libm/src/s_ccosf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_ccosf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_ccosf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -78,7 +78,7 @@ ccosf(float complex z) float complex w; float ch, sh; - _cchshf( cimag(z), &ch, &sh ); - w = cosf( creal(z) ) * ch + ( -sinf( creal(z) ) * sh) * I; + _cchshf( cimagf(z), &ch, &sh ); + w = cosf( crealf(z) ) * ch + ( -sinf( crealf(z) ) * sh) * I; return (w); } diff --git a/lib/libm/src/s_ccoshf.c b/lib/libm/src/s_ccoshf.c index 527a47afb98..db2840da6fe 100644 --- a/lib/libm/src/s_ccoshf.c +++ b/lib/libm/src/s_ccoshf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_ccoshf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_ccoshf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -51,8 +51,8 @@ ccoshf(float complex z) float complex w; float x, y; - x = creal(z); - y = cimag(z); + x = crealf(z); + y = cimagf(z); w = coshf (x) * cosf (y) + (sinhf (x) * sinf (y)) * I; return (w); } diff --git a/lib/libm/src/s_cexpf.c b/lib/libm/src/s_cexpf.c index 041bf84318d..d14fb79c0ff 100644 --- a/lib/libm/src/s_cexpf.c +++ b/lib/libm/src/s_cexpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_cexpf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_cexpf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -61,7 +61,7 @@ cexpf(float complex z) float complex w; float r; - r = expf( creal(z) ); - w = r * cosf( cimag(z) ) + r * sinf( cimag(z) ) * I; + r = expf( crealf(z) ); + w = r * cosf( cimagf(z) ) + r * sinf( cimagf(z) ) * I; return (w); } diff --git a/lib/libm/src/s_clogf.c b/lib/libm/src/s_clogf.c index 2cea0f218be..75969272155 100644 --- a/lib/libm/src/s_clogf.c +++ b/lib/libm/src/s_clogf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_clogf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_clogf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -62,8 +62,8 @@ clogf(float complex z) float complex w; float p, rr, x, y; - x = creal(z); - y = cimag(z); + x = crealf(z); + y = cimagf(z); rr = atan2f(y, x); p = cabsf(z); p = logf(p); diff --git a/lib/libm/src/s_cpowf.c b/lib/libm/src/s_cpowf.c index 8a24596d338..785f946b03f 100644 --- a/lib/libm/src/s_cpowf.c +++ b/lib/libm/src/s_cpowf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_cpowf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_cpowf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -53,8 +53,8 @@ cpowf(float complex a, float complex z) float complex w; float x, y, r, theta, absa, arga; - x = creal (z); - y = cimag (z); + x = crealf(z); + y = cimagf(z); absa = cabsf (a); if (absa == 0.0f) { return (0.0f + 0.0f * I); diff --git a/lib/libm/src/s_csinf.c b/lib/libm/src/s_csinf.c index aacc59f9dc6..2e38c8e4e39 100644 --- a/lib/libm/src/s_csinf.c +++ b/lib/libm/src/s_csinf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_csinf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_csinf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -79,7 +79,7 @@ csinf(float complex z) float complex w; float ch, sh; - cchshf((float) cimag(z), &ch, &sh); - w = sinf(creal(z)) * ch + (cosf(creal(z)) * sh) * I; + cchshf(cimagf(z), &ch, &sh); + w = sinf(crealf(z)) * ch + (cosf(crealf(z)) * sh) * I; return (w); } diff --git a/lib/libm/src/s_csinhf.c b/lib/libm/src/s_csinhf.c index 170b4405640..1a9f3cc3dfc 100644 --- a/lib/libm/src/s_csinhf.c +++ b/lib/libm/src/s_csinhf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_csinhf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_csinhf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -50,8 +50,8 @@ csinhf(float complex z) float complex w; float x, y; - x = creal(z); - y = cimag(z); + x = crealf(z); + y = cimagf(z); w = sinhf (x) * cosf (y) + (coshf (x) * sinf (y)) * I; return (w); } diff --git a/lib/libm/src/s_csqrtf.c b/lib/libm/src/s_csqrtf.c index 9f9e8982b0e..3a11aae30a7 100644 --- a/lib/libm/src/s_csqrtf.c +++ b/lib/libm/src/s_csqrtf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_csqrtf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_csqrtf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -67,8 +67,8 @@ csqrtf(float complex z) float complex w; float x, y, r, t, scale; - x = creal(z); - y = cimag(z); + x = crealf(z); + y = cimagf(z); if(y == 0.0f) { if (x < 0.0f) { diff --git a/lib/libm/src/s_ctanhf.c b/lib/libm/src/s_ctanhf.c index a0f61614452..97e66acc7b0 100644 --- a/lib/libm/src/s_ctanhf.c +++ b/lib/libm/src/s_ctanhf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_ctanhf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_ctanhf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier * @@ -51,8 +51,8 @@ ctanhf(float complex z) float complex w; float x, y, d; - x = creal(z); - y = cimag(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; return (w);