sin and cos in C
Posted: Tue Dec 04, 2012 4:15 am
> Has anyone every used ARMmite MakeItC sinf( ) or cosf( ) in their C
> code and was successful and if so
> can you give an example of your code?
>
Have you got the init_coridium() in there?
Csample showed an example and I just compiled and ran this--
#include "coridium.h"
#include "printf.h"
#include <math.h>
int main(void)
{
int i,j;
init_coridium(); // REQUIRED OPERATION
for (i=0; i<100; i= i+10) {
j = 100*sinf(00.01 * i);
printf("sin(%d/100) = %d/100\n",i,j);
}
while (1);
}
------------------ output ------------------
sin(0/100) = 0/100
sin(10/100) = 9/100
sin(20/100) = 19/100
sin(30/100) = 29/100
sin(40/100) = 38/100
sin(50/100) = 47/100
sin(60/100) = 56/100
sin(70/100) = 64/100
sin(80/100) = 71/100
sin(90/100) = 78/100
> code and was successful and if so
> can you give an example of your code?
>
Have you got the init_coridium() in there?
Csample showed an example and I just compiled and ran this--
#include "coridium.h"
#include "printf.h"
#include <math.h>
int main(void)
{
int i,j;
init_coridium(); // REQUIRED OPERATION
for (i=0; i<100; i= i+10) {
j = 100*sinf(00.01 * i);
printf("sin(%d/100) = %d/100\n",i,j);
}
while (1);
}
------------------ output ------------------
sin(0/100) = 0/100
sin(10/100) = 9/100
sin(20/100) = 19/100
sin(30/100) = 29/100
sin(40/100) = 38/100
sin(50/100) = 47/100
sin(60/100) = 56/100
sin(70/100) = 64/100
sin(80/100) = 71/100
sin(90/100) = 78/100