I was trying to convert this excel code to c#
IF(D5=F5,ROUND(((SQRT(F5) +0.0833) ^2),0)
and the output for the excel file i'm getting is 19423
but when i use the same code for c#
D5 = 19400.25
F5 = 19400.25
string s = Math.Round(Convert.ToDecimal(Convert.ToInt32((Math.Sqrt(F5) + 0.0833)) ^ 2)).ToString();
I'm getting the output as 137. I don't know where I'm going wrong I tried each and everything and got stuck to this thing.Can anyone please help me ? Thanks is advance.
The ^ symbol doesn't resemble the power function, as in Excel. You can't just translate this one-on-one. The C# ^ symbol does a bitwise exclusive-OR.
The actual C# code you should use to translate this function:
result = Math.Pow(Math.Sqrt(F5) + 0.0833, 2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With