In general, you cannot do this: the user can enter, say 123 , in many ways:
123123.001.23e212.3E1123.0e+001230e-1
etc .. When you convert user input to double , you lose the original format:
string userInput = ...
If you want to reset the exponent, if possible, you can
double value = 11111111111111111111; string result = value.ToString("#######################");
And please note that double has 64 bits to store the value, so distortion is inevitable for large numbers:
// possible double, which will be rounded up double big = 123456789123456789123456789.0; // 1.2345678912345679E+26 Console.WriteLine(big.ToString("R")); // 123456789123457000000000000 Console.WriteLine(big.ToString("###########################"));
Maybe you want BigInteger instead of double :
using System.Numerics; ... BigInteger value = BigInteger.Parse("111111111111111111111111111111111");
source share