calculate sinf()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

calculate sinf()

2,530 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by volter on Sat Jul 09 09:41:48 MST 2011
I want to use sinf(); function.
I am receiving :
Quote:
undefined reference to `sinf'

Do I need to changed MCU linker from redlib(nohost)?
How to fix that?
0 Kudos
Reply
10 Replies

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Jul 11 03:55:46 MST 2011

Quote: CodeRedSupport

However we have added a few C99 library functions in "Redlib_v2" included in LPCXpresso 4, which IIRC includes sinf(). I'll look into getting the details of the extra functionality added to one of our FAQs in the next few days.


Details now added to

http://support.code-red-tech.com/CodeRedWiki/redlib_v2_notes

In summary, "Redlib_v2" now provides single precision math functions, such as sinf(), plus an implementation of stdbool.h. It also provides an implementation of the (non-standard) itoa() function, which has been asked about on several occasions in the past on this forum.

Regards,
CodeRedSupport
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jul 09 12:30:40 MST 2011
Yes :)
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by volter on Sat Jul 09 12:29:05 MST 2011
Can I install LPCXpresso4 without deleting LPCXpresso3?
I'm using OpenSUSE 11.3:cool:
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by volter on Sat Jul 09 10:58:32 MST 2011

Quote: Zero
Creating a new LPCXpresso4 project (Redlib:nohost) and adding <math.h> was enough to get sin / sinf working :):eek::mad::confused:



sin, Yes
sinf, No
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jul 09 10:36:20 MST 2011
Creating a new LPCXpresso4 project (Redlib:nohost) and adding <math.h> was enough to get sin / sinf working :):eek::mad::confused:
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Sat Jul 09 10:32:27 MST 2011
Sinf  (single precision version of sin) is not supported in redlib. Redlib is based on c89 whereas sinf was defined in c99.

You can either cast sin to float or use newlib (which is c99, but also quite a bit larger)
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Sat Jul 09 10:30:27 MST 2011
http://support.code-red-tech.com/CodeRedWiki/RedlibAndNewlib

Redlib was written as a C90 compliant C library - sinf() is a C99 addition. If you want access to full C99 library support, you will need to switch to Newlib.

However we have added a few C99 library functions in "Redlib_v2" included in LPCXpresso 4, which IIRC includes sinf(). I'll look into getting the details of the extra functionality added to one of our FAQs in the next few days.

Regards,
CodeRedSupport
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jul 09 10:29:52 MST 2011
Are we talking about LPC1343 and LPCXpresso4 ?
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by volter on Sat Jul 09 10:06:15 MST 2011

Quote: Zero
Include math.h ?

http://knowledgebase.nxp.com/showthread.php?p=955



I did that. I get errors only on
sinf(),cosf(),asinf(),acosf()
but not on :
sin(),cos()
As I now from C those functions defined like :
double sin(double angle);
float sinf(float angle);

In eclipce I just added a Linker flag -lm

So how to fix this in this case?
0 Kudos
Reply

2,478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jul 09 09:54:04 MST 2011
Include math.h ?

http://knowledgebase.nxp.com/showthread.php?p=955
0 Kudos
Reply