Is there any function of calculate fractional power in dsp_lib Topic is solved

 Member++
 Posts: 26
 Joined: Tue Jul 02, 2019 8:38 am
Is there any function of calculate fractional power in dsp_lib
Hi I want to calculate the integer to the fraction power about fixed point number, like (10^0.1), but I don't find any function about this in dsp_lip. Anyone know?
View Solution

 Experienced Member
 Posts: 96
 Joined: Mon Mar 22, 2010 8:55 pm
Would exp(log(10)*0.1) work for you?

 XCore Addict
 Posts: 251
 Joined: Wed May 31, 2017 6:55 pm
AFAIK the dsp_lib doesn't have a function to do this directly. You can use dsp_math_exp and dsp_math_log if the errors are low enough to suit you and speed and input range are OK, using the identity a^b = e^(b ln(a)).
Oops sorry ahenshaw  didn't see your reply.
Oops sorry ahenshaw  didn't see your reply.

 XCore Addict
 Posts: 185
 Joined: Tue Mar 26, 2013 12:10 pm
ahenshaw and CousinItt are correct however I would caution against using floating point maths because the xcore is a fixed point architecture.
This means that floating point maths is calculated using a software library and hence is very slow.
I would recommend using QFormat for your realtime code.
lib_dsp supports QFormat by default.
Best regards,
John
This means that floating point maths is calculated using a software library and hence is very slow.
I would recommend using QFormat for your realtime code.
lib_dsp supports QFormat by default.
Best regards,
John

 Member++
 Posts: 26
 Joined: Tue Jul 02, 2019 8:38 am
Thanks very much for all