0

I have a complete strange problem with my friend's code. Here is the code:

double Wampr = Convert.ToDouble(textBoxWampr.Text); //39437
double Vmax = Convert.ToDouble(textBoxVmax.Text); // 295
double Nrdte = Convert.ToDouble(textBoxNrdte.Text); //5
double Nstatic = Convert.ToDouble(textBoxNstatic.Text); //2
double CEF = Convert.ToDouble(textBoxCEF.Text); //3.1
double Fdiff = Convert.ToDouble(textBoxFdiff.Text); //1.8
double Fobs = Convert.ToDouble(textBoxFobs.Text); //1


double output = 0.001244 * Math.Pow(Wampr, 1.160) * Math.Pow(Vmax, 1.371) * Math.Pow(Nrdte - Nstatic, 1.281)* CEF * Fdiff * Fobs;

textbox1.Text = output.ToString();

It supposed to calculate and the result is 14791812.0609327

Unfortunately, in his lappy, the outcome become 1479181206.09327

See the difference? the decimal places.

I have tested it in a few laptops and the result is good (right answer, the first one) but not in his laptop, the result is the second one (1479181206.09327)

I've try to run a few test to run in his Visual Studio, for example:

double output = 14791812.060932;
textbox1.Text = output.ToString();

and it run smoothly without any error/strange result.

So I think its because of Math.Pow. What do you think about this problem?

Thanks in advance.

I update the code with the value that supposed to be filled inside the text box at the end of the code.

~I try to put the value directly to the equation and the result is correct. So its not Math.Pow problem.

0 Answers0