0 SiPexTBC 10 Years Ago I'm making a program that divides by 1000. It works fine until it divides by a number higher than itself. For example double asdf = (1000 / 3000); Math.Round(asdf); txtSpeed.Text = asdf.ToString(); When it divides by a number higher than 1000 it just gives me 0. Anyone know what's causing this? Thanks, SiPex thermalprint

0 ericstenson 5 10 Years Ago How about the fact that you are rounding the number! try specifing the number of rounding digits... Math.Round(asdf, 2) would give you 0.00 percision

0 OPDiscussion Starter SiPexTBC 10 Years Ago How about the fact that you are rounding the number! try specifing the number of rounding digits... Math.Round(asdf, 2) would give you 0.00 percision OK, i tried double asdf = (1000 / 3000); Math.Round(asdf, 2); Console.WriteLine(asdf); Console.ReadLine(); Still got 0 Any other suggestions? Thanks

1 Featured Reply Ramy Mahrous 401 10 Years Ago Developers just don't look at methods documentation!! Round method returns the rounded number that's your problem, friend! double d = 1000.0 / 3000.0; d = Math.Round(d, 2); Console.WriteLine(d); Votes + Comments SiPexTBC: Thanks.

0 OPDiscussion Starter SiPexTBC 10 Years Ago Developers just don't look at methods documentation!! Round method returns the rounded number that's your problem, friend! double d = 1000.0 / 3000.0; d = Math.Round(d, 2); Console.WriteLine(d); Thanks, it worked :)