I have an old VBA application that has generates values like 1.123456789123456789123456789E-28. When I googled to find the equivalent data type in C#, I found this article in SO Difference between decimal, float and double in .NET?. As per what this post suggests, decimal data type has the largest size in C#. So I used decimal data type but I found that decimal seems to be limited in representing large values that VBA represents in exponential form. So I googled again and found this article https://msdn.microsoft.com/en-us/library/ae55hdtk.aspx. As stated in this article,
Nonintegral number values can be expressed as mmmEeee, in which mmm is the mantissa (the significant digits) and eee is the exponent (a power of 10). The highest positive values of the nonintegral types are 7.9228162514264337593543950335E+28 for Decimal, 3.4028235E+38 for Single, and 1.79769313486231570E+308 for Double.
This means Double data type has the largest range of values. So now I am confused between decimal and double.
Then I did a little experiment with code like below
double dbl = 1.123456789123456789123456789E-28;
decimal dcl = 1.123456789123456789123456789E-28M;
MessageBox.Show(dbl.ToString());
MessageBox.Show(dcl.ToString());
The dbl prints the value as it is 1.123456789123456789123456789E-28 while the dcl value changes to 0.0000000000000000000000000001; Can someone explain what is happening here ? What is the equivalent data type in C# to represent large exponential values like in VBA with same precision?