Fix cacos bug introduced last November (was: ICE in compiling complex/cacos.c for arm/thumb)
Corinna Vinschen
vinschen@redhat.com
Tue Jul 12 19:50:00 GMT 2011
On Jul 11 14:12, Hans-Peter Nilsson wrote:
> Ok to commit?
>
> * libm/complex/cacos.c: Use temporaries and correct sequencing
> error in previous reordering change.
>
> Index: newlib/libm/complex/cacos.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libm/complex/cacos.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 cacos.c
> --- newlib/libm/complex/cacos.c 4 Nov 2010 18:27:13 -0000 1.3
> +++ newlib/libm/complex/cacos.c 11 Jul 2011 08:28:39 -0000
> @@ -80,10 +80,10 @@ QUICKREF
> double complex
> cacos(double complex z)
> {
> - double complex w;
> + double complex w, tmp0, tmp1;
>
> - w = casin(z);
> - w = M_PI_2 - creal(w);
> - w -= (cimag(w) * I);
> + tmp0 = casin(z);
> + tmp1 = M_PI_2 - creal(tmp0);
> + w = tmp1 - (cimag(tmp0) * I);
> return w;
> }
What about using the upstream NetBSD fix instead, which looks much
better to me:
Index: libm/complex/cacos.c
===================================================================
RCS file: /cvs/src/src/newlib/libm/complex/cacos.c,v
retrieving revision 1.3
diff -u -p -r1.3 cacos.c
--- libm/complex/cacos.c 4 Nov 2010 18:27:13 -0000 1.3
+++ libm/complex/cacos.c 11 Jul 2011 19:23:37 -0000
@@ -83,7 +83,6 @@ cacos(double complex z)
double complex w;
w = casin(z);
- w = M_PI_2 - creal(w);
- w -= (cimag(w) * I);
+ w = (M_PI_2 - creal(w)) - cimag(w) * I;
return w;
}
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list