Look carefully in math.h, there may be an #ifdef around the double
math functions. I "thought" that the telosb used doubles rather than
floats (the ATMEGA uses float math) but it sounds like I'm wrong...
MS


ys...@lifc.univ-fcomte.fr wrote:
> Hi Manjunath,
> 
> Yes it compiled, thanks a lot. And I'll check if the result is correct.
> Still don't know why sqrt function is declared in math.h but unusable.
> 
> Maybe it's declared but not implemented. Anyway I really appreciate your
> help.
> 
> Best regards.
> 
>> Hi,
>>
>>    Can you please try sqrtf() ?
>>
>> Manjunath D
>>
>> ################################################################################################################
>> ***************************************************************************************************************
>>
>> On Wed, 16 Nov 2011, ys...@lifc.univ-fcomte.fr wrote:
>>
>>> Hello,
>>>
>>> I'm working with telosb mote, and I need to use sqrt function in my
>>> program, but I can't compile it.
>>>
>>> ===========================================
>>> mkdir -p build/telosb
>>>    compiling TestMulAppC to a telosb binary
>>> ncc -o build/telosb/main.exe  -Os -O -mdisable-hwmul -Wall -Wshadow
>>> -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board=
>>> -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"TestMulAppC\"
>>> -DIDENT_USERNAME=\"xubuntos\" -DIDENT_HOSTNAME=\"xubuntos-tinyos\"
>>> -DIDENT_USERHASH=0x00f95284L -DIDENT_TIMESTAMP=0x4ec2f4a5L
>>> -DIDENT_UIDHASH=0xb186c6f2L  TestMulAppC.nc -lm <---- LM here
>>> !!!!!!!!!!!!
>>> TestMulC.nc: In function `TestMulC$Boot$booted':
>>> TestMulC.nc:22: warning: unused variable `m'
>>> /tmp/ccIJqAuN.o: In function `EllipticCurveP$mtIsPrime':
>>> app.c:(.text+0x6c0): undefined reference to `sqrt'
>>> make: *** [exe0] Error 1
>>> ===========================================
>>>
>>> I have included math.h in my program, and I've noticed that the -lm
>>> switch
>>> is turned on, and I have even found the function declaration at ligne 62
>>> in file /usr/msp430/include/math.h
>>>
>>> ===========================================
>>> extern double sqrt _PARAMS((double));
>>> ===========================================
>>>
>>> I don't understand why it cannot find sqrt function.
>>>
>>> So can anyone help me out?
>>>
>>> Best regards
>>>
>>> --
>>> Yanbo SHOU
>>> Ph.D student Cartoon Team
>>> Computer Science Laboratory of Franche-Comté
>>> Office 420C
>>> 16 route de Gray
>>> 25 000 Besançon, France
>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> Tinyos-help@millennium.berkeley.edu
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>
> 
> 
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to