Andes Workshop
http://forum.andestech.com/

如何計算開根號的數學運算
http://forum.andestech.com/viewtopic.php?f=23&t=177
Page 1 of 1

Author:  cindy [ Wed Oct 26, 2011 7:06 pm ]
Post subject:  如何計算開根號的數學運算

Q: 如何計算開根號的數學運算?我發現填常數可以,變數無法計算。
A:常數運算能work是因為compiler直接填結果在程式裡,並沒有帶進真正的function code。
除了程式裡要#include<math.h>之外,必須在linker裡加上-lm,
Andesight裡的參數是這樣子加:
Attachment:
p1.gif
p1.gif [ 17.07 KiB | Viewed 8250 times ]


Project上按右鍵-->Settings-->Andes C Linkers-->Libraries,右鍵按下Add…
Attachment:
p2.gif
p2.gif [ 6.58 KiB | Viewed 8250 times ]


然後打上m,按OK
Attachment:
p3.gif
p3.gif [ 5.33 KiB | Viewed 8250 times ]

就可以把-lm的參數加上去。

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/