libm: sync with upstream.
There's potential here to maybe lose some/all of builtins.cpp, but I'll
look at that separately later.
Test: treehugger
Change-Id: I2c2bc1d0753affdd214daeb09fa1ac7cd73db347
diff --git a/libm/upstream-freebsd/lib/msun/src/s_ctanh.c b/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
index 88afeb5..e5840a1 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
@@ -111,11 +111,13 @@
}
/*
- * ctanh(x + I NaN) = d(NaN) + I d(NaN)
- * ctanh(x +- I Inf) = dNaN + I dNaN
+ * ctanh(+-0 + i NAN) = +-0 + i NaN
+ * ctanh(+-0 +- i Inf) = +-0 + i NaN
+ * ctanh(x + i NAN) = NaN + i NaN
+ * ctanh(x +- i Inf) = NaN + i NaN
*/
if (!isfinite(y))
- return (CMPLX(y - y, y - y));
+ return (CMPLX(x ? y - y : x, y - y));
/*
* ctanh(+-huge +- I y) ~= +-1 +- I 2sin(2y)/exp(2x), using the