I have trouble with the following code. It is not giving the same answer in excel as C# and I'm sure the excel answer is correct. I have already tried to change integer values to double by adding a decimal point. Please advise.
the excel version
the c# version
voltageVector[rows, 5] = ((1.0 + ki) * Rp * c * (ma * 1.0)) - (0.5 * ki * Rp * c * ((mb * 0.0 )+ (mc * 0.0)));
The constants ki, Rp, c and ma are all double precision values.
ki = 0.69999999999999907; Rp = 0.0469486290322602; c = 60.0 ma = 2.0; mb = 1.0; mc = 1.0;
The C# answer is
The excel answer is