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

Postby link0513 » Tue Oct 15, 2019 8:24 am

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

Postby ahenshaw » Sun Oct 20, 2019 4:21 pm

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

Postby CousinItt » Sun Oct 20, 2019 4:42 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.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Mon Oct 21, 2019 1:09 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 real-time code.
lib_dsp supports QFormat by default.

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

Postby link0513 » Mon Oct 28, 2019 2:29 am

Thanks very much for all

Who is online

Users browsing this forum: No registered users and 0 guests