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

Voice related projects and technical discussions
link0513
Member++
Posts: 26
Joined: Tue Jul 02, 2019 8:38 am

Is there any function of calculate fractional power in dsp_lib

Post by link0513 »

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
User avatar
ahenshaw
Experienced Member
Posts: 96
Joined: Mon Mar 22, 2010 8:55 pm

Post by ahenshaw »

Would exp(log(10)*0.1) work for you?
User avatar
CousinItt
Respected Member
Posts: 265
Joined: Wed May 31, 2017 6:55 pm

Post by CousinItt »

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.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Post by johned »

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 real-time code.
lib_dsp supports QFormat by default.

Best regards,
John
link0513
Member++
Posts: 26
Joined: Tue Jul 02, 2019 8:38 am

Post by link0513 »

Thanks very much for all