From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99504 invoked by alias); 26 Mar 2016 19:41:00 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 99493 invoked by uid 89); 26 Mar 2016 19:40:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-96.6 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=U*stromeko, Stromeko@nexgo.de, Stromekonexgode, Hx-languages-length:1811 X-HELO: calimero.vinschen.de Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 Mar 2016 19:40:49 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 09487A80643; Sat, 26 Mar 2016 20:40:47 +0100 (CET) Date: Tue, 29 Mar 2016 16:09:00 -0000 From: Corinna Vinschen To: cygwin-apps@cygwin.com Subject: Re: Dodgy functions (finitel, strold) Message-ID: <20160326194047.GD8327@calimero.vinschen.de> Reply-To: cygwin-apps@cygwin.com Mail-Followup-To: cygwin-apps@cygwin.com References: <56EC6BDA.7050505@cornell.edu> <20160318214509.GD11113@calimero.vinschen.de> <8760whmn3a.fsf@Rainer.invalid> <20160320152540.GG11113@calimero.vinschen.de> <87wpoxkm28.fsf@Rainer.invalid> <56EF0583.5030302@cygwin.com> <87lh58xav0.fsf_-_@Rainer.invalid> <87h9fvygky.fsf@Rainer.invalid> <87r3ezrkz9.fsf_-_@Rainer.invalid> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Km1U/tdNT/EmXiR1" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-03/txt/msg00156.txt.bz2 --Km1U/tdNT/EmXiR1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1833 On Mar 25 18:16, Doug Henderson wrote: > On 25 March 2016 at 02:59, Achim Gratz wrote: > > > > Achim Gratz writes: > > > Achim Gratz writes: > > >> Long story short, they seem to report a finite value on at least some > > >> NaN constructs and then the %a format for the Perl sprintf outputs t= hose > > >> bits as a hex FP number rather than just printing "NaN". On 64bit t= he > > >> culprit is actually finitel, of course, since Perl gets compiled with > > >> long doubles. > > > > > > And looking into newlib this seems to be a compile bug, because the > > > function just uses an intrinsic. > > > > But the compiler is innocent, because newlib uses the wrong intrinsic or > > an incomplete implementation. If it must be using that intrinsic for > > compatibility reasons, it would need to implement > > > > > > > > Regards, > > Achim. > > >=20 >=20 > I modified your program to display the actual hex value of the a, b, > and c variables. The b and c variables have different bit patterns. It > appears that the %a format conversion is (correctly) detecting =C2=B1inf > and NaN according to IEEE 754, and ignoring the value of all other > bits in the variables. >=20 > It appears that strtold and the implicit conversion from double to > long double are setting some of the bits which are not used to > represent NaN or =C2=B1Inf to different values. strtold actually forgot to set one bit. I now fixed finitel, the return value of strtold for +/-infinity, and I improved math.h by using GCC builtins for the C99 macros which makes them type agnostic and thus lon double aware. Building a snaphot right now. Please give it a try. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Km1U/tdNT/EmXiR1 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW9uW+AAoJEPU2Bp2uRE+g5aIP/i5i2UBYfFyAIyzY3Pfln51l OWh5aDJ+zHlQcUqOPmlpqHmwK6ZZX6yhLL2vS9tGBcAds7Yi1kO4xdaxUGmWsWEI r6TrTSvpSDXEqRsHpFn7V+rlv9tOUSA2DS/TLEa7/8wYfzi/UjnymO3xQnIBXbec Ug3XiwHwm/yLSAINqdiSO+RjSZGAUFFQ/T18y8aGr0oo4DsdbO/K6BKIpZXkRjNK oznJ4t/uPE7Hx5D+nRB26ulEDKr9NVYuh2rMt1aRPZLqRuFEPpfMvrsQWPiUxzJa nOdpPC/F2RQTa0AOYRB8qDnyDXn1jLZVZQfi3SivxyGv9CrbgzKPrvefdkKu7cLz ib6RYL0O5ssqSSKasYVEQQP+SGudjt0EFFNbPzxNvAIkPPiyZMU4m/7EMazxowNC tx+JlCrJZSe81OFic3t7x9U2qOn6iR+geyxbI0syDBJ2ZoxvaoPuCvSF60PoXUgJ 0ALDt27Le71px1G46nzALM99ZaK29PJ7NlqaysLwNqBtW0hKO0FaiC8fDFkOXhSW 9LQnCDQX85XNKhIJBNmsFHPeG2HVuN8ArDTxZdDZNOmAkDhXHzS3AXHNeTmuuu9S l6Qf2s7tTN6Bl4z+BhJ/pb413u8you0EUk6l+pyNdd24m1DMTd6wbBVZ4MULLvm1 eMfdaT7WMYJQob3U/J6M =B2PC -----END PGP SIGNATURE----- --Km1U/tdNT/EmXiR1--