pow math function

The “pow” function doesn’t seem to work for me. If I pass “pow(2,2)”, it returns 2 not 4. The ULP error given for this function in the programming guide didn’t make sense to me either.

pow(x, y)
16 (for x outside interval 0.75 … 1.195; larger for x inside)

what does this mean ?

Thanks,

-ST

Never mind… My mistake…

What was the mistake? I seem to be making it as well. Also, acos() seems to be giving me a negative number, which shouldn’t happen. I don’t think I’m doing anything stupid, but I probably am…

Brian

Hi Brian,

Now I am not sure. When I run in emuation mode, I still get pow(2.0,2)=2.0 Earlier, I thought the device mode was doing it right.

  • ST

Oops, never mind my post as well–just a config issue on my end. I guess we both jumped the gun posting to the forum .

Brian

About the problem with pow(float/double, int), please see http://forums.nvidia.com/index.php?showtop…ndpost&p=214431.

On a side note, it is recommended that you use powf() instead of pow(), or at least be careful to use 2.0f instead of 2, for the reasons invoked in 5.1.1.1 of the 1.0 programming guide.

Cyril