Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: Jeff Vader on June 08, 2010, 07:46:44 am

Title: Alternative for pow in C
Post by: Jeff Vader on June 08, 2010, 07:46:44 am
So yeah, I'm an idiot when it comes to programming. But at the moment we're (or I'm) supposed to create a face detection algorithm, that works on an EIR (http://www.ethernut.de/nutwiki/Elektor_Internet_Radio_1.0). And the method we chose included some a ^ n calculations, where n < 1. And so far I haven't been able to find any equivalent for math.h in Nut/OS. pow(a, n) would be so cool, but no can do.

So, how to do a ^ n calculations (n < 1) in C without pow? Any ideas? I've been banging my head on the wall for some days now. And yes, I've googl'd for a solution as well.

General ideas? Example code? Everything is welcome. I'll be most grateful for any help.
Title: Re: Alternative for pow in C
Post by: Spicious on June 08, 2010, 09:25:49 am
Google pointed to stack overflow (http://stackoverflow.com/questions/2664445/the-most-efficient-way-of-implementing-pow-function-in-floating-point), which pointed to fdlibm (http://www.netlib.org/fdlibm/).
Title: Re: Alternative for pow in C
Post by: Jeff Vader on June 08, 2010, 12:20:42 pm
Gotta try it out tomorrow when (or if) I'm able to go and fondle my EIR.

Edit: nvrmnd, we found a native math.h for the device and were able to use its pow. Now if we could get the blasted thing to point at faces instead of walls...

Thanks for the help, though.