Convert Double to String without precision loss in javascript
- by holger
I would like to convert a floating point variable to a string without losing any precision.
I.e. I would like the string to have the same information as my floating point variable contains, since I use the output for further processing (even if it means that the string will be very long and readable).
To put this more clearly, I would like to have functions for cyclic conversion
var dA = 323423.23423423e4;
var sA = toString(dA);
var dnA = toDouble(sA);
and I would like dnA and dA to be equal
Thanks
PS: Sources on the internet usually talk about how to round strings but I have not found information on exact representation. Also I am not interested in Arbitrary Precision calculations, I just need double precision floating point arithmetic.