Double.parseDouble(String) : Problem to parse large String
807605Jul 5 2007 — edited Jul 16 2007Hello,
I need to convert A String to a Double in my application without rounding of digits.
I have used the Double.parseDouble(String) method.
The maximum string length can be 17 including dot(.)
So if my String is (of length 17)
Eg.
S= �9999999999.999999� then I am getting the double value as
d= 9999999999.999998(compare the last digit)
If s = �9999999999.111111� then d = 9999999999.111110
If s = �9999999999.555555� then d = 9999999999.555555 (result that I want)
If s = �9999999999.666666� then d = 9999999999.666666 (result that I want)
If s = �9999999999.777777� then d = 9999999999.777777 (result that I want)
If s = �9999999999.888888� then d = 9999999999.888887
If s = �9999999999.999999� then d = 9999999999.999998
If s = �9123456789.123456� then d = 9123456789.123456
But string length up to 16 is giving me the accurate result
So any body can explain me that why it is happening? And how can i get the accurate result.
Thanks in advanced.