From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id 8AD14385AC33 for ; Tue, 25 Jan 2022 19:59:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8AD14385AC33 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 20PJxSlJ069906 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 25 Jan 2022 11:59:28 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 20PJxSwN069905; Tue, 25 Jan 2022 11:59:28 -0800 (PST) (envelope-from sgk) Date: Tue, 25 Jan 2022 11:59:28 -0800 From: Steve Kargl To: FX Cc: fortran@gcc.gnu.org Subject: Re: New signaling NaN causes 12 testsuite failures Message-ID: <20220125195928.GB69322@troutmask.apl.washington.edu> References: <20220125004453.GA16729@troutmask.apl.washington.edu> <20220125024811.GA19308@troutmask.apl.washington.edu> <93B4F458-9AD2-44DA-9F21-37B16C4A0CE8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93B4F458-9AD2-44DA-9F21-37B16C4A0CE8@gmail.com> X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2022 19:59:31 -0000 On Tue, Jan 25, 2022 at 09:05:55AM +0100, FX wrote: > > > Got the following in testsuite/gfortran/gfortran.log > > > > NaN 7FFFA000000000000000 > > NaN 7FFFC000000000000000 > > NaN 7FFFA000000000000000 > > Could be a problem with __builtin_nansl(). #include #include int main(void) { union { float x; uint32_t i; } f; union { double x; uint64_t i; } d; union { long double x; uint64_t i[2]; } l; printf("Quiet NaN\n"); f.x = __builtin_nanf(""); printf("%f %x\n", f.x, f.i); d.x = __builtin_nan(""); printf("%lf %lx\n", d.x, d.i); l.x = __builtin_nanl(""); printf("%Lf %lx%lx\n", l.x, l.i[1], l.i[0]); printf("Signaling NaN\n"); f.x = __builtin_nansf(""); printf("%f %x\n", f.x, f.i); d.x = __builtin_nans(""); printf("%lf %lx\n", d.x, d.i); l.x = __builtin_nansl(""); printf("%Lf %lx%lx\n", l.x, l.i[1], l.i[0]); return 0; } % ~/work/x/bin/gcc -o z a.c && ./z Quiet NaN nan 7fc00000 nan 7ff8000000000000 nan 7fffc000000000000000 Signaling NaN nan 7fa00000 nan 7ff4000000000000 nan 7fffa000000000000000 s bit is 0, so the 7 is correct. The width of the exponet is w = 8, 11, and 15 bits for float, double, and long double. The first significant bit, d, is then 9, 12, and 16. s|----w---|d 7fc --> 0111 1111 1100 7fa --> 0111 1111 1010 s|-----w-----| d 7ff8 --> 0111 1111 1111 1000 7ff4 --> 0111 1111 1111 0100 s|-------w--------| d 7fffc -> 0111 1111 1111 1111 1100 <-- should be 7fff8? 7fffa -> 0111 1111 1111 1111 1010 <-- should be 7fff4? What does linux/darwin show? -- Steve