Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: fusl/src/math/__tandf.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fusl/src/math/__tandf.c
diff --git a/fusl/src/math/__tandf.c b/fusl/src/math/__tandf.c
index 25047eeee9c098894010a3984372ba63cb698656..ccad354312b8a8a835b2f4ee9302a545c0b6d089 100644
--- a/fusl/src/math/__tandf.c
+++ b/fusl/src/math/__tandf.c
@@ -17,38 +17,37 @@
/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */
static const double T[] = {
- 0x15554d3418c99f.0p-54, /* 0.333331395030791399758 */
- 0x1112fd38999f72.0p-55, /* 0.133392002712976742718 */
- 0x1b54c91d865afe.0p-57, /* 0.0533812378445670393523 */
- 0x191df3908c33ce.0p-58, /* 0.0245283181166547278873 */
- 0x185dadfcecf44e.0p-61, /* 0.00297435743359967304927 */
- 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */
+ 0x15554d3418c99f.0p-54, /* 0.333331395030791399758 */
+ 0x1112fd38999f72.0p-55, /* 0.133392002712976742718 */
+ 0x1b54c91d865afe.0p-57, /* 0.0533812378445670393523 */
+ 0x191df3908c33ce.0p-58, /* 0.0245283181166547278873 */
+ 0x185dadfcecf44e.0p-61, /* 0.00297435743359967304927 */
+ 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */
};
-float __tandf(double x, int odd)
-{
- double_t z,r,w,s,t,u;
+float __tandf(double x, int odd) {
+ double_t z, r, w, s, t, u;
- z = x*x;
- /*
- * Split up the polynomial into small independent terms to give
- * opportunities for parallel evaluation. The chosen splitting is
- * micro-optimized for Athlons (XP, X64). It costs 2 multiplications
- * relative to Horner's method on sequential machines.
- *
- * We add the small terms from lowest degree up for efficiency on
- * non-sequential machines (the lowest degree terms tend to be ready
- * earlier). Apart from this, we don't care about order of
- * operations, and don't need to to care since we have precision to
- * spare. However, the chosen splitting is good for accuracy too,
- * and would give results as accurate as Horner's method if the
- * small terms were added from highest degree down.
- */
- r = T[4] + z*T[5];
- t = T[2] + z*T[3];
- w = z*z;
- s = z*x;
- u = T[0] + z*T[1];
- r = (x + s*u) + (s*w)*(t + w*r);
- return odd ? -1.0/r : r;
+ z = x * x;
+ /*
+ * Split up the polynomial into small independent terms to give
+ * opportunities for parallel evaluation. The chosen splitting is
+ * micro-optimized for Athlons (XP, X64). It costs 2 multiplications
+ * relative to Horner's method on sequential machines.
+ *
+ * We add the small terms from lowest degree up for efficiency on
+ * non-sequential machines (the lowest degree terms tend to be ready
+ * earlier). Apart from this, we don't care about order of
+ * operations, and don't need to to care since we have precision to
+ * spare. However, the chosen splitting is good for accuracy too,
+ * and would give results as accurate as Horner's method if the
+ * small terms were added from highest degree down.
+ */
+ r = T[4] + z * T[5];
+ t = T[2] + z * T[3];
+ w = z * z;
+ s = z * x;
+ u = T[0] + z * T[1];
+ r = (x + s * u) + (s * w) * (t + w * r);
+ return odd ? -1.0 / r : r;
}

Powered by Google App Engine
This is Rietveld 408576698