View Single Post
Old 09-22-2006, 01:09 PM   #2 (permalink)
jaeusm
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

What language are you using? Try 1.0 instead of just 1 to force the result of the division to be a floating point number. For instance, in C#
Code:
int x = 8;  // find the cube root of x, which should be 2

// This returns the wrong result because it uses integer division
Math.Pow(x, 1/3);

// This returns the correct result because it uses floating point division
Math.Pow(x, 1.0/3);

jaeusm is offline