Problem with calculation result greater than Int64

Asked

Viewed 115 times

3

I am doing the exponent of a number and I need the result to come out in a specific format, however I do not know how to do, follow the code:

double num1 = 290287121823;
double num2 = 538783;
double resultado = Math.Pow(num1, 2) + num2;

My code is bringing 8.42666130962812E+22 but what I need is 84266613096281243382112. How do I do this? I tried formats with .ToString() and force conversion to BigInteger of System.Numerics but it didn’t work out.

1 answer

4


  • Hello bigow, I did a test but it’s like he just added the zeros at the end and missed something in that conversion. Biginteger had generated something similar to me, too, but I haven’t got the right point yet. When the number is smaller than Int64 works well but when it extrapolates and I have to use Double ai something gets lost.

  • I will test other possibilities by the link you sent. vlw

  • Opa, then I will test the previous section already doing with Biginteger, was using it only at the end after the calculation. Return now

  • It worked mustache!! You’re the man! The problem is also that I did not consider using Biginteger.Pow ai was using Biginteger only after the result of Math.Pow, I saw your code there and solved the problem.Thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.