Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

My application is getting data from the XML and then adding the specified two rows. Then it displaying in the screen.Now there is an issue,From the xml file like "-6.355410929135618578000000000000000000000e+83"

How i can work with this numbers ?
Anybody know how to convert Exponential values in to double format.

eg: how i can convert this number to double or some number format to do the calculation "-6.355410929135618578000000000000000000000e+83"

please give me an any clue on this.

Thanks
Vijay r
Posted

1 solution

Hi,

read here:

http://msdn.microsoft.com/en-us/library/7yd1h1be.aspx[^]

The code should be something like:
string strd = "-6.355410929135618578000000000000000000000e+83";
NumberStyles styles;
styles = NumberStyles.AllowExponent | NumberStyles.Number;
double dbl = Double.Parse(strd, styles);
 
Share this answer
 
Comments
vijayr 4-Jan-11 0:58am    
hi,
Thanks so much,
i have tried with below example as per your idea but i am still getting the result with E+83. how i can resolve this and how i remove the E values

string strd = "-6.355410929135618578000000000000000000000e+83";
NumberStyles styles;
styles = NumberStyles.AllowExponent | NumberStyles.Number;
double dbl1 = Double.Parse(strd, styles);
double dbl2 = Double.parse("149.0922279000",styles);
double Total = dbl1 + dbl2;

Thanks
Vijay r
JF2015 4-Jan-11 1:05am    
What do you mean by: "remove the E values"? - Has the value you are reading from the xml file the wrong value, or has it just not the format you want it to be?
vijayr 4-Jan-11 1:31am    
yes, i am reading the two values from the XML file.
First value is "-6.355410929135618578000000000000000000000e+83" in string format.
Second value is "149.0922279000" in string format.
I have to add these two values first.This is my first step from the logic what I have.
While adding this two values,I am getting the result is "-6.3554109291356186E+83".
Here i need some value like "-x.xxxxxxxxx" and not like "-x.xxxxxxxE+18".
How i can convert.
Is My Question is clear ? please advice me
JF2015 4-Jan-11 1:38am    
No, your question is not clear. If you add both of these values, it is pretty clear, that the result you get is: xxxE+xxx. You could only format the xxxE+xxx value when displaying to the user to be displayed as xxxxxxxxx.xxxxx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900