Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
0
Need to calcultae nth power of a number (EDK).
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-27-2008 06:17 AM
Hi,
I am using EDK. For a microblaze, while doing program I need to take nth power of a number.
But when I do (n^m) then it gives me X-OR operation result.
How can I overcome this problem?
Please help me...!
~Sandeep
0
Re: Need to calcultae nth power of a number (EDK).
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-27-2008 10:32 AM
In the C language, the caret (^) is the bitwise XOR operator and double-asterisk (**) is the power function. So you need to write x**n to raise x to the nth power.
-- Gabor
0
Re: Need to calcultae nth power of a number (EDK).
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-28-2008 11:48 AM
Hi Sandeep,
You could also use the pow(x, y) (double precision) or the powf(x, y) (single precision) functions.
You could also use the pow(x, y) (double precision) or the powf(x, y) (single precision) functions.
0
Re: Need to calcultae nth power of a number (EDK).
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-29-2008 11:25 AM
Uh, that would be Fortran. There is now power operator in C, only the floating point functions mentioned before.
gszakacs wrote:
In the C language,... double-asterisk (**) is the power function.
0
Re: Need to calcultae nth power of a number (EDK).
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-29-2008 08:55 PM
Hey thanks all.
I am able to solve the problem by using powf function and not (**).
As well increasing the onchip BRAM size from 16KB to 32KB.
Floating point powf function need some more memory space and hence was giving an error for Data2MEM execution.
Thanks to all ..!!
~Sandeep











