From: guenther Date: Mon, 19 Jul 2010 00:04:07 +0000 (+0000) Subject: Fix the cproj family to not return garbage on finite arguments. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d20eac9f637e56bdcb8eda4846734731c365bae1;p=openbsd Fix the cproj family to not return garbage on finite arguments. ok millert@ --- diff --git a/lib/libm/noieee_src/n_cproj.c b/lib/libm/noieee_src/n_cproj.c index 373cef865fb..b177b35ae89 100644 --- a/lib/libm/noieee_src/n_cproj.c +++ b/lib/libm/noieee_src/n_cproj.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_cproj.c,v 1.1 2008/10/07 22:25:53 martynas Exp $ */ +/* $OpenBSD: n_cproj.c,v 1.2 2010/07/19 00:04:07 guenther Exp $ */ /* * Copyright (c) 2008 Martynas Venckus * @@ -26,6 +26,8 @@ cproj(double complex z) if (isinf(__real__ z) || isinf(__imag__ z)) { __real__ res = INFINITY; __imag__ res = copysign(0.0, __imag__ z); + } else { + res = z; } return res; diff --git a/lib/libm/noieee_src/n_cprojf.c b/lib/libm/noieee_src/n_cprojf.c index 978d36f9395..3b948e821f1 100644 --- a/lib/libm/noieee_src/n_cprojf.c +++ b/lib/libm/noieee_src/n_cprojf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_cprojf.c,v 1.1 2008/10/07 22:25:53 martynas Exp $ */ +/* $OpenBSD: n_cprojf.c,v 1.2 2010/07/19 00:04:07 guenther Exp $ */ /* * Copyright (c) 2008 Martynas Venckus * @@ -26,6 +26,8 @@ cprojf(float complex z) if (isinf(__real__ z) || isinf(__imag__ z)) { __real__ res = INFINITY; __imag__ res = copysign(0.0, __imag__ z); + } else { + res = z; } return res; diff --git a/lib/libm/src/s_cproj.c b/lib/libm/src/s_cproj.c index 7064e9285c3..e4fc50f8b57 100644 --- a/lib/libm/src/s_cproj.c +++ b/lib/libm/src/s_cproj.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_cproj.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_cproj.c,v 1.2 2010/07/19 00:04:07 guenther Exp $ */ /* * Copyright (c) 2008 Martynas Venckus * @@ -26,6 +26,8 @@ cproj(double complex z) if (isinf(__real__ z) || isinf(__imag__ z)) { __real__ res = INFINITY; __imag__ res = copysign(0.0, __imag__ z); + } else { + res = z; } return res; diff --git a/lib/libm/src/s_cprojf.c b/lib/libm/src/s_cprojf.c index af754ed3d70..74df084220a 100644 --- a/lib/libm/src/s_cprojf.c +++ b/lib/libm/src/s_cprojf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_cprojf.c,v 1.1 2008/09/07 20:36:09 martynas Exp $ */ +/* $OpenBSD: s_cprojf.c,v 1.2 2010/07/19 00:04:07 guenther Exp $ */ /* * Copyright (c) 2008 Martynas Venckus * @@ -26,6 +26,8 @@ cprojf(float complex z) if (isinf(__real__ z) || isinf(__imag__ z)) { __real__ res = INFINITY; __imag__ res = copysign(0.0, __imag__ z); + } else { + res = z; } return res;