I would like to represent a double as a string, without any extra 0s or without any rounding losing any its significant digits. Ignoring minor errors due to the nature of floating point.. e.g. when it might have a bunch of 0s after the last really useful digit with a 3 tacked on the end.. e.g. 56.825000000003
(not sure if I got the number of 0s correct, just illustrating a point here...
The problem is I don't know how many digits after the decimal point are significant. I mean I know within reason.. for example 12.230000000005
, with that many strings of 0s you know the 5 is is not going to be part of the "valid" number"
Examples of #s that I would like to acehived as a string but could have an extraneous digit at the end, being a double, could be 12
, 12.25
, 6.125
What would be a nice concise way of doing this?