N Newbie Jan 15, 2004 #1 Why can I not get a decimal value from my double using: double test; test = 1/3; MessageBox.Show(test.ToString());
Why can I not get a decimal value from my double using: double test; test = 1/3; MessageBox.Show(test.ToString());
P Peter Jan 15, 2004 #2 Because 1 and 3 are both integers try this: double test; test = 1.00 / 3; MessageBox.Show(test.ToString());
Because 1 and 3 are both integers try this: double test; test = 1.00 / 3; MessageBox.Show(test.ToString());
G Gary Morris Jan 16, 2004 #3 Or this: double test; test = 1/3d; // Here you are specifying that the number be a double MessageBox.Show(test.ToString());
Or this: double test; test = 1/3d; // Here you are specifying that the number be a double MessageBox.Show(test.ToString());