Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Dann Corbit Newsgroups: comp.programming Subject: Re: calculating the power of a fixed point Date: Tue, 20 Sep 2011 12:09:03 -0700 Organization: Aioe.org NNTP Server Lines: 44 Message-ID: References: <2d2836aa-2443-4e56-9fef-d38e12c60dcf@z41g2000yqb.googlegroups.com> NNTP-Posting-Host: hV1AxOvTemF4njFnFvAJqg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: MicroPlanet-Gravity/3.0.4 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.programming:833 In article <2d2836aa-2443-4e56-9fef- d38e12c60dcf@z41g2000yqb.googlegroups.com>, kerenpur@gmail.com says... > > Hello! > I want to represent x and y, both non-integers as a fixed point data > type > I am having trouble calculating x^y without using the float library > in C++ > because the standard library includes only a floating point > implementation of the power function http://focus.ti.com/general/docs/lit/getliterature.tsp? literatureNumber=spra619&fileType=pdf "General Guide to Implement Logarithmic and Exponential Operations on a Fixed-Point DSP" Also: http://www.velocityreviews.com/forums/t717009-fixed-point- implementation-of-c-exponent-function.html At the bottom of the page a post by thadula includes code for several fixed point math functions which may be useful. This thread may have something useful in it: http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2008- 03/msg01843.html This link: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.92.5605 &rep=rep1&type=pdf looks like it might be useful. I did not try it, but this seems interesting (though it seems that a lot of iterations were necessary): http://www.ehow.co.uk/how_6563047_use-fixed-point-calculate- exponentiation.html And, of course, cordic calculations are a classic: http://www.dcs.gla.ac.uk/~jhw/cordic/index.html http://people.sc.fsu.edu/~jburkardt/m_src/cordic/cordic.html http://www.quinapalus.com/efunc.html