Compare commits

..

No commits in common. "a51c11701fb9da88c29a38fdbe1baaa952970b64" and "8458c74ee119047f51854d43ce922dc29bcfdba1" have entirely different histories.

2 changed files with 13 additions and 5 deletions

View File

@ -1,9 +1,6 @@
#ifndef _ARCH_UNISTD_ILP_H #ifndef _ARCH_UNISTD_ILP_H
#define _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_V6_ILP32_OFF32 1
#define _POSIX_V7_ILP32_OFF32 1 #define _POSIX_V7_ILP32_OFF32 1

View File

@ -10,13 +10,14 @@
The taylor poly is centered at pi, with a radius of The taylor poly is centered at pi, with a radius of
convergence of no less than pi, making it roughly accurate 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 between 0 and 2 * pi. The polynomial is up to x^20, so it
confirmed as being accurate being 0 and 2 * pi. should be pretty accurate within that range.
*/ */
double cos(double x) { double cos(double x) {
double pi = M_PI; /* Really, me?! -Kat */ double pi = M_PI; /* Really, me?! -Kat */
int temp; int temp;
double deg_2, deg_4, deg_6, deg_8, deg_10; double deg_2, deg_4, deg_6, deg_8, deg_10;
double deg_12, deg_14, deg_16, deg_18, deg_20;
double cosine; double cosine;
if(x < 0) x = -x; if(x < 0) x = -x;
@ -43,6 +44,11 @@ double cos(double x) {
deg_6 = deg_4 * deg_2 * 2 / (6 * 5); deg_6 = deg_4 * deg_2 * 2 / (6 * 5);
deg_8 = deg_6 * deg_2 * 2 / (8 * 7); deg_8 = deg_6 * deg_2 * 2 / (8 * 7);
deg_10 = deg_8 * deg_2 * 2 / (10 * 9); 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 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 Plus, since we're taking advantage of cosine being an
even function, we don't need any terms less than 0, so even function, we don't need any terms less than 0, so
why *center* at zero and include negatives? 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 = -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; return cosine;
} }