On Mar 10, 5:49*pm, Öö Tiib <oot...@hot.ee> wrote:
> On Mar 10, 10:59*pm, James Kanze <james.ka...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 10, 8:08 am, Juha Nieminen <nos...@thanks.invalid> wrote:
>
> > > rjsteele <raymondste...@gmail.com> wrote:
> > > > How do I retain the value (precision) of the double as a string?
> > > In general, you can't. Most floating point values have an infinite
> > > decimal representation.
>
> > No. *All can be represented exactly: ten is a multiple of 2, so for n
> > bits precision in machine format, you are guaranteed an exact
> > representation with at most n decimal digits.
>
> > Of course, n is typically 52, and only a very small subset of 52 digit
> > numbers correspond exactly to a double. *And since in most cases, it's
> > highly unlikely that the double corresponded to the exact value to
> > begin
> > with, you don't use 52 digits.
>
> 52 decimal digits? That means your float types have over 180 bits?
Thanks for all the responses.
|