math.h pow function isn't working!

Started by
5 comments, last by iMalc 19 years, 3 months ago
I need a pow function that takes two inputs, double,double, and returns the answer. The <math.h> one can't do decimal or negative powers, which is what I am looking for. Can someone help me out? I would especially like optimized versions.
Advertisement
C++ reference: cmath: pow

Looks like it takes two doubles. It should do decimals and negative powers.
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Sagar_Indurkhya: Could you please post a sample where pow() fails? It would help us to find an explanation for the unexpected behaviour.
Never mind. It works. I had to officially cast everything as double, since it was otherwise using the int function. I am gonna delete this thread after an hour or so. BTW: Does anyone know where I can find the actual code for pow?
You could look in the libc source
On my windows box with vs.net 2003 its under the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\crt\src dir or optionally the intel sub dir is where you can find "optimized" versions of some of the more popular methods.

Cheers
Chris
CheersChris
Just don't try and do negative numbers to a fractional power eh!
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

This topic is closed to new replies.

Advertisement