Thread: Reciprocal
View Single Post
  #1 (permalink)  
Old 11-12-2006, 02:01 PM
Q0paz Q0paz is offline
Junior Member
 
Join Date: Sep 2006
Posts: 9
Q0paz is on a distinguished road
Reciprocal

I am not the greatest mathematician but I have some functions I am converting from easy language that use the reciprocal of a number to provide a multiplyer in another function.

double method (int pwr)
{
double frac=0;

frac=1/pwr;

dootherstuffwith frac
}

However when I Print this the expression 1/pwr comes out as zero. I am doing binary progression stuff so all the numbers are of the series 1, 2, 4, 8, 16 etc. I can't see what I am doing wrong. I can't see a math.reciprocal function. Short of doing a pseudo lookup function ;

if(pwr = 2)
return(.5);
if(pwr = 4)
return(.25);
etc etc

any ideas ????

Thanks

Paz

Last edited by Q0paz; 11-13-2006 at 10:30 AM.
Reply With Quote