From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21537 invoked by alias); 1 Apr 2016 19:04:57 -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 21516 invoked by uid 89); 1 Apr 2016 19:04:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=sound, nan, Henderson, henderson X-HELO: mail-in-13.arcor-online.net Received: from mail-in-13.arcor-online.net (HELO mail-in-13.arcor-online.net) (151.189.21.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 01 Apr 2016 19:04:46 +0000 Received: from mail-in-13-z2.arcor-online.net (mail-in-13-z2.arcor-online.net [151.189.8.30]) by mx.arcor.de (Postfix) with ESMTP id 3qc9mW2px9z31jH for ; Fri, 1 Apr 2016 21:04:43 +0200 (CEST) Received: from mail-in-09.arcor-online.net (mail-in-09.arcor-online.net [151.189.21.49]) by mail-in-13-z2.arcor-online.net (Postfix) with ESMTP id 5E7973C81D8 for ; Fri, 1 Apr 2016 21:04:43 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-09.arcor-online.net 3qc9mW1p7lzB32H Received: from Gertrud (p54B46F42.dip0.t-ipconnect.de [84.180.111.66]) (Authenticated sender: stromeko@arcor.de) by mail-in-09.arcor-online.net (Postfix) with ESMTPSA id 3qc9mW1p7lzB32H for ; Fri, 1 Apr 2016 21:04:43 +0200 (CEST) From: Achim Gratz To: cygwin-apps@cygwin.com Subject: Re: Dodgy functions (finitel, strold) 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> Date: Fri, 01 Apr 2016 19:04:00 -0000 In-Reply-To: (Doug Henderson's message of "Fri, 25 Mar 2016 18:16:13 -0600") Message-ID: <87mvpdw3p1.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-04/txt/msg00000.txt.bz2 Doug Henderson writes: > 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. I wasn't concerned about the bit patterns, but the fact that +-Inf was recognized as valid input, but then converted to NaN. > 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. > > It appears that some of the different functions that get used to > detect finiteness and validity are sensitive to the setting of other > bits in the values, or are expecting particular values for these bits. That would be a bug. The standard defines all the valid bit patterns for each case, so if in doubt you could exhaustively test them. > The standard supports two representations of NaN: a signalling NaN and > a non-signalling NaN. From what I could see, the C language does not > distinguish between the two NaN representations, but I did not look at > the standards docs. You can mostly ignore that distinction unless the runtime exposes it to you. In a nutshell, the difference is between silently producing and then using the NaN in further computation or raising an exception. In the latter case, the runtime would need to give you a way to catch and handle the exception. Regards, Achim. --=20 +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds