From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-04.nifty.com (conssluserg-04.nifty.com [210.131.2.83]) by sourceware.org (Postfix) with ESMTPS id D9167385782A for ; Thu, 25 Nov 2021 12:02:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D9167385782A Received: from Express5800-S70 (z221123.dynamic.ppp.asahi-net.or.jp [110.4.221.123]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 1APC20I1010198 for ; Thu, 25 Nov 2021 21:02:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 1APC20I1010198 X-Nifty-SrcIP: [110.4.221.123] Date: Thu, 25 Nov 2021 21:02:01 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: possible snprintf() regression in 3.3.2 Message-Id: <20211125210201.7627ca1c2cac69e5f1833516@nifty.ne.jp> In-Reply-To: References: <7545bb24-43de-cd7d-0764-55c85f1af957@gmx.com> <20211121001613.GH10332@venus.tony.develop-help.com> <20211122232302.GI10332@venus.tony.develop-help.com> <20211123173409.0db4d5ccd94501ce1b8f69ea@nifty.ne.jp> <20211124124055.a90e254858b66d42aca6ecef@nifty.ne.jp> <20211124175204.ff0751fd1536dde626826dd5@nifty.ne.jp> <20211124181456.d4bfca4c5ba33dfe4e701fa4@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2021 12:02:19 -0000 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