PDA

View Full Version : force float




chris200x9
Feb 17, 2008, 08:40 PM
hi I was wondering if anyone could tell me what's wrong with this statement.

digit = (num/ pow( float base, numDigits - num);



kainjow
Feb 17, 2008, 08:52 PM
If you're trying to convert base to a float, your syntax is incorrect. And you're missing a matching parentheses. Try:

digit = (num/ pow( (float) base, numDigits - num));

gnasher729
Feb 18, 2008, 11:22 AM
hi I was wondering if anyone could tell me what's wrong with this statement.

digit = (num/ pow( float base, numDigits - num);

After fixing the bugs, can you explain why you are throwing away most of the available precision?