possible snprintf() regression in 3.3.2
Takashi Yano
takashi.yano@nifty.ne.jp
Thu Nov 25 12:02:01 GMT 2021
On Wed, 24 Nov 2021 10:28:13 +0100
Corinna Vinschen wrote:
> On Nov 24 18:14, Takashi Yano via Cygwin wrote:
> > On Wed, 24 Nov 2021 17:52:04 +0900
> > Takashi Yano wrote:
> > > The printed value is still something wrong...
> > > sqrt(2)*1e70 should be an integer value.
> >
> > I mean...
> >
> > sqrt(2)*1e70 is actually not an integer, however, double has mantissa
> > of only 52 bit. So, (double value)*(5^70*2^70) should be an integer.
>
> The conversion is a bit inexact, I guess, but that's another problem
> of this old ldto, right?
I looked into this problem and found that:
This problem is in principle unavoidable with current algorithms.
This is because the current algorithm uses a value of 10^n for
the conversion. When n>62, the value does not fit into the 144
bits of the mantissa part of the internal representation in ldtoa.
This degrades the precision.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin
mailing list