------------10A1E010C1E6FD8D7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit What I found on the net was something about 'linear' and 'hyperbolic' rotations. Using this kind of rotations, functions like ln/exp/sqrt/... can be calculated. But hyperbolic stuff is above my understanding, especially rotations :) So I would be very glad if you find a simple explanation... Take a look at the magnitude routine in attachment. Correction is made outside the loop, so it's not the main problem. Most of the time in the loop is spent on register shifts. So vertical math may probably help. However, if a 16 bit register used vertically, it looks like it would take 16 8-bit registers. Can that be avoided? Enjoy :) Nikolai ---- Original Message ---- From: Dmitry Kiryashov Sent: Thursday, August 17, 2000 23:05:23 To: PICLIST@MITVMA.MIT.EDU Subj: [PIC]: Algorithm for 10^x > Hi Nikolai. ;) >> Dmitry, could you please explain how to apply CORDIC to exponential >> function? > I'm not promising alot but as only will have 20 free minutes to go other > office location I will search for those docs in backed up database of > file > server. I remember that there were many articles in the past how to > apply > CORDIC for non standart math functions and hopefully for exponential > too. > (There was a discussion somewhere that CORDIC can be applied for that > but > doubled iterations are required for some cases) >> I just recently started to learn about that algorithm and how to use >> it for magnitude, phase, sine and cosine calculations. But I would >> like to learn how to use CORDIC for other elementary math. Not much >> pointers on the net :( > Try altavista with: +CORDIC +"math*" +"exponent*" I guess it should > works. > I played with CORDIC together with vertical math to significantly reduce > code size and execution time for some correlation based signal > detection. > Because it is very easy to do number shifting in vertical math. Special > thanks to Scott Dattalo and John Payson. You guys opened a door for me > into such a upside down beautiful world ;) >> BTW, it doesn't look so good for magnitude calculation. It takes >> around 1500 cycles for PIC to find sqrt(x^2+y^2), where x, y are 16 >> bit signed numbers. Probably, using good square and square root >> routines would be faster in that case. > 1500 is sounding too long.. Probably you are doing correction on > every iteration not finally ? I'll be curious to look your code if > that is possible. Looks like a good candidate for optimization ;) > WBR Dmitry. > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu ------------10A1E010C1E6FD8D7 Content-Type: application/octet-stream; name="magnitude16.asm" Content-Transfer-Encoding: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cnJmCVRlbXAsIGYNCglycmYJUmVILCBmDQoJcnJmCVJlTCwg Zg0KCXJyZglUZW1wLCBmDQoJcnJmCVJlSCwgZg0KCXJyZglSZUwsIGYNCglybGYJUmVILCB3DQoJ cnJmCVJlSCwgZg0KCXJyZglSZUwsIGYNCgltb3ZmCVJla0wsIHcNCglhZGR3ZglSZUwsIGYNCglt b3ZmCVJla0gsIHcNCglza3BuYw0KCWluY2ZzeglSZWtILCB3DQoJYWRkd2YJUmVILCBmDQoJY2xy Yw0KCXJyZglSZUgsIGYNCglycmYJUmVMLCBmDQoJY2xyYw0KCXJyZglSZUgsIGYNCglycmYJUmVM LCBmDQoJbW92ZglSZWtMLCB3DQoJYWRkd2YJUmVMLCBmDQoJbW92ZglSZWtILCB3DQoJc2twbmMN CglpbmNmc3oJUmVrSCwgdw0KCWFkZHdmCVJlSCwgZg0KCXJyZglSZUgsIGYNCglycmYJUmVMLCBm DQoNCjtEb25lIQ0KCXJldHVybg0KOyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqDQoNCg0KDQoNCg0K ------------10A1E010C1E6FD8D7-- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics