summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/msun/src/s_cbrtf.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/msun/src/s_cbrtf.c b/lib/msun/src/s_cbrtf.c
index 3506943..5fcd795 100644
--- a/lib/msun/src/s_cbrtf.c
+++ b/lib/msun/src/s_cbrtf.c
@@ -53,16 +53,21 @@ cbrtf(float x)
} else
SET_FLOAT_WORD(t,sign|(hx/3+B1));
- /* first step Newton iteration (solving t*t-x/t == 0) to 16 bits */
- /* in double precision to avoid problems with denormals */
+ /*
+ * First step Newton iteration (solving t*t-x/t == 0) to 16 bits. In
+ * double precision so that its terms can be arranged for efficiency
+ * without causing overflow or underflow.
+ */
T=t;
r=T*T*T;
- T=T*(x+x+r)/(x+r+r);
+ T=T*((double)x+x+r)/(x+r+r);
- /* second step Newton iteration to 47 bits */
- /* in double precision for accuracy */
+ /*
+ * Second step Newton iteration to 47 bits. In double precision for
+ * efficiency and accuracy.
+ */
r=T*T*T;
- T=T*(x+x+r)/(x+r+r);
+ T=T*((double)x+x+r)/(x+r+r);
/* rounding to 24 bits is perfect in round-to-nearest mode */
return(T);
OpenPOWER on IntegriCloud