I am having a hard time figuring out why my program is kicking back odd numbers. I found the cos function is not returning values that make sense. Below is a small test program I stepped through with the results ... any ideas on why ...
/****************************************************************************/
#define PI 3.14159
temp = cos(0); // 1 1
temp = cos(PI/2); // -1 0
temp = cos(PI); // 1 -1
temp = cos(3*PI/2); // 0 0
temp = cos(2*PI); // 1 1
/****************************************************************************/
the second column of numbers is the results I should see ... the first column is the actual results.
I also stepped through the following code:
/****************************************************************************/
double temp = 0;
float i;
for (i = 0; i < 2*PI; i+=0.1)
temp = cos(i);
/****************************************************************************/
RESULTS:
i temp
0 1.0
0.1 -1.0
0.2 up to 1.6 -1.0
1.7 1.0
I DON'T UNDERSTAND THESE RESULTS ............ PLEASE HELP