> 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
sin and cos in C
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: sin and cos in C
It works out of thumb mode, so I'm just going to use that for now.
Thank you...
Thank you...
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: sin and cos in C
#include <math> and add "-lm" to the compiler/linker options should do it.
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: sin and cos in C
What does the assembly listing show? Try compiling with the option
"-msoft-float" or "-mhard-float".
John
On Thu, Jan 8, 2009 at 3:31 PM, warrenmachen06 <warrenmachen06@yahoo.com> wrote:
> I have copied a few lines of C code from Csample.c. The
> line are as following :
>
> i = 100*sinf(00.01);
> printf("sin %d\n",i);
>
> The C function sinf appears not to return.
>
> I also tried cosf it does the some thing ( No return ).
>
>
"-msoft-float" or "-mhard-float".
John
On Thu, Jan 8, 2009 at 3:31 PM, warrenmachen06 <warrenmachen06@yahoo.com> wrote:
> I have copied a few lines of C code from Csample.c. The
> line are as following :
>
> i = 100*sinf(00.01);
> printf("sin %d\n",i);
>
> The C function sinf appears not to return.
>
> I also tried cosf it does the some thing ( No return ).
>
>