Problem with calculation result greater than Int64

3

I'm 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 it, it follows 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 forced conversion to BigInteger of System.Numerics but did not work.

    
asked by anonymous 01.07.2016 / 14:47

1 answer

4

The solution really is to use BigInteger . I used it and it worked, but I did the whole process with it. If the data source was double , immediately convert each part before doing the operations. I did not even need formatting.

See running on dotNetFiddle . With formatting options, although this is not the problem.

Other formatting options . More information .

    
01.07.2016 / 14:53