I’m struggling a bit with an excel calculation that needs to be written in C#.
The calculation in excel looks like this:
=(-0,7333 * (1) ^ 2 + 3,3167 * 1 + 1,625) * 1.821 * 16/1000 * 1,125
In C# I have this:
Math.Pow(-0.7333 * (1.0), 2) + 3.3167 * 1.0 + 1.625) * 1821.3125 * 16.0 / 1000 * 1.125
The excel calculation gives me the result of 138
The C# calculation gives me the result of 179.63554194392623
Of course, the C# calculation should match the result of the Excel calculation and while I’m certainly not a genious when it comes to math, I fail to spot the difference in this calculation :-/
Can anyone point this math-blind being here in the right direction? 🙂
Any help/input is greatly appreciated!
Thanks in advance.
All the best,
Bo
Edit:
Thanks for all your answers! 🙂 I just learned something new right there.
Change format of the cell in EXcel and it will show you the
exactresult.Also
-0,7333 * (1) ^ 2in Excel is-0.7333 * Math.Pow((1.0), 2)and not as you wrote.