diff --git a/arch/i386/unistd_ilp.h b/arch/i386/unistd_ilp.h index 63a266e..8f77714 100644 --- a/arch/i386/unistd_ilp.h +++ b/arch/i386/unistd_ilp.h @@ -1,9 +1,6 @@ #ifndef _ARCH_UNISTD_ILP_H #define _ARCH_UNISTD_ILP_H -/* - 32-bit ISA, 32-bit int, long, pointer, and offset_t -*/ #define _POSIX_V6_ILP32_OFF32 1 #define _POSIX_V7_ILP32_OFF32 1 diff --git a/math/cos.c b/math/cos.c index 9d660aa..4a7bf8f 100644 --- a/math/cos.c +++ b/math/cos.c @@ -10,13 +10,14 @@ The taylor poly is centered at pi, with a radius of convergence of no less than pi, making it roughly accurate - between 0 and 2 * pi. The polynomial is up to x^10, which I've - confirmed as being accurate being 0 and 2 * pi. + between 0 and 2 * pi. The polynomial is up to x^20, so it + should be pretty accurate within that range. */ double cos(double x) { double pi = M_PI; /* Really, me?! -Kat */ int temp; double deg_2, deg_4, deg_6, deg_8, deg_10; + double deg_12, deg_14, deg_16, deg_18, deg_20; double cosine; if(x < 0) x = -x; @@ -43,6 +44,11 @@ double cos(double x) { deg_6 = deg_4 * deg_2 * 2 / (6 * 5); deg_8 = deg_6 * deg_2 * 2 / (8 * 7); deg_10 = deg_8 * deg_2 * 2 / (10 * 9); + deg_12 = deg_10 * deg_2 * 2 / (12 * 11); + deg_14 = deg_12 * deg_2 * 2 / (14 * 13); + deg_16 = deg_14 * deg_2 * 2 / (16 * 15); + deg_18 = deg_16 * deg_2 * 2 / (18 * 17); + deg_20 = deg_18 * deg_2 * 2 / (20 * 19); /* In case you aren't familiar with the theory of a Taylor @@ -73,8 +79,13 @@ double cos(double x) { Plus, since we're taking advantage of cosine being an even function, we don't need any terms less than 0, so why *center* at zero and include negatives? + (Of course, I've not done the radius of convergence work + for this to find out how many degrees we need to get a + radius of convergence of pi, so I may have used too many + terms, anyways. Not that I can't reduce that...) */ cosine = -1 + deg_2 - deg_4 + deg_6 - deg_8 + deg_10; + cosine = cosine - deg_12 + deg_14 - deg_16 + deg_18 + deg_20; return cosine; }