ISSUE :
 
Profile photo
Submitted by Cs Ss
on January 29th, 2013 at 03:45:36 EST

power operation

v = Convert.ToDouble (txtencrypt.Text);
t = Math.Pow(v, d);

MessageBox.Show(Convert.ToString(t));
MessageBox.Show(""+t.ToString());
MessageBox.Show("" + Convert.ToDecimal(n));
msg = Convert.ToInt16(Math.Pow(v,d) % Convert.ToDouble(n));
txtdecrypt.Text = Convert.ToString(msg);
Here i'm facing the problem is whenever i'm doing power operation i'm getting slightly deviated result from my actual result.
please help me to solve the problem.


Profile photo
Replied by SBajra
on January 30th, 2013 at 19:01:15 EST
whats your expected value and what are you getting?

Profile photo
Replied by Cs Ss
on February 17th, 2013 at 05:28:34 EST
v=11 d=23
when i performing power operation (i.e)t=Math.Pow(v,d) i got the wrong value(895430243255237000000000) instead of getting the value 895430243255237372246531
pls give the solution for this problem.
Edited on February 17th, 2013 at 05:30:00 EST