about summary refs log tree commit diff
path: root/src/complex/csqrt.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2012-11-13 01:31:49 +0100
committerSzabolcs Nagy <nsz@port70.net>2012-11-13 01:31:49 +0100
commitcfbaba79a2dd380e580a247b8fd36af60c878e8f (patch)
treea002987af1ea7652985973f8db98d2d4f8b6064a /src/complex/csqrt.c
parente2fe959fe2a450f74271d4d3c4b0d9456f889125 (diff)
downloadmusl-cfbaba79a2dd380e580a247b8fd36af60c878e8f.tar.gz
musl-cfbaba79a2dd380e580a247b8fd36af60c878e8f.tar.xz
musl-cfbaba79a2dd380e580a247b8fd36af60c878e8f.zip
complex: add C11 CMPLX macros and replace cpack with them
Diffstat (limited to 'src/complex/csqrt.c')
-rw-r--r--src/complex/csqrt.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/complex/csqrt.c b/src/complex/csqrt.c
index 21fb879d..8a2ba608 100644
--- a/src/complex/csqrt.c
+++ b/src/complex/csqrt.c
@@ -51,12 +51,12 @@ double complex csqrt(double complex z)
 
 	/* Handle special cases. */
 	if (z == 0)
-		return cpack(0, b);
+		return CMPLX(0, b);
 	if (isinf(b))
-		return cpack(INFINITY, b);
+		return CMPLX(INFINITY, b);
 	if (isnan(a)) {
 		t = (b - b) / (b - b);  /* raise invalid if b is not a NaN */
-		return cpack(a, t);   /* return NaN + NaN i */
+		return CMPLX(a, t);   /* return NaN + NaN i */
 	}
 	if (isinf(a)) {
 		/*
@@ -66,9 +66,9 @@ double complex csqrt(double complex z)
 		 * csqrt(-inf + y i)   = 0   +  inf i
 		 */
 		if (signbit(a))
-			return cpack(fabs(b - b), copysign(a, b));
+			return CMPLX(fabs(b - b), copysign(a, b));
 		else
-			return cpack(a, copysign(b - b, b));
+			return CMPLX(a, copysign(b - b, b));
 	}
 	/*
 	 * The remaining special case (b is NaN) is handled just fine by
@@ -87,10 +87,10 @@ double complex csqrt(double complex z)
 	/* Algorithm 312, CACM vol 10, Oct 1967. */
 	if (a >= 0) {
 		t = sqrt((a + hypot(a, b)) * 0.5);
-		result = cpack(t, b / (2 * t));
+		result = CMPLX(t, b / (2 * t));
 	} else {
 		t = sqrt((-a + hypot(a, b)) * 0.5);
-		result = cpack(fabs(b) / (2 * t), copysign(t, b));
+		result = CMPLX(fabs(b) / (2 * t), copysign(t, b));
 	}
 
 	/* Rescale. */