From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id A1D583858C55 for ; Tue, 20 Sep 2022 12:51:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A1D583858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 604E21F747; Tue, 20 Sep 2022 12:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1663678264; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zjVJ4ApEO4gOdBXkmoZSYRXiLSQsRz24D3ey9+jZK3E=; b=fJVZkFQmTWBKqwMVCdINxxIRpLFojcgA/JAIYmEE6T9XpfBTn7BGbtxSE+9y5BxTh504Rf d8fJNOwQesFDFin7PZW3UEEmuDAPanCmgDEOZzJMmm2/x+Uuom158+nsNuYfeG3hR1goad ks4c28oISZh0cfKOJvGhyZ8ccLFfwhs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1663678264; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zjVJ4ApEO4gOdBXkmoZSYRXiLSQsRz24D3ey9+jZK3E=; b=aeNtm5QuK95FDxW3UWbDK3N3eFcEiBl2lMk+WLPuVBS/xvqpcR2v771bw6GunF+T6UpI8h bR9Aotymtn9okeCg== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 57FB32C141; Tue, 20 Sep 2022 12:51:04 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 3741F63A7; Tue, 20 Sep 2022 12:51:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id 35D2B632B; Tue, 20 Sep 2022 12:51:04 +0000 (UTC) Date: Tue, 20 Sep 2022 12:51:04 +0000 (UTC) From: Michael Matz To: Aldy Hernandez cc: Richard Biener , Jakub Jelinek , GCC patches Subject: Re: [PATCH] [PR68097] frange::set_nonnegative should not contain -NAN. In-Reply-To: Message-ID: References: <20220919075901.1798294-1-aldyh@redhat.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello, On Tue, 20 Sep 2022, Aldy Hernandez wrote: > > FWIW, in IEEE, 'abs' (like 'copy, 'copysign' and 'negate') are not > > arithmetic, they are quiet-computational. Hence they don't rise > > anything, not even for sNaNs; they copy the input bits and appropriately > > modify the bit pattern according to the specification (i.e. fiddle the > > sign bit). > > > > That also means that a predicate like negative_p(x) that would be > > implemented ala > > > > copysign(1.0, x) < 0.0 > > I suppose this means -0.0 is not considered negative, It would be considered negative if the predicate is implemented like above: copysign(1.0, -0.0) == -1.0 But really, that depends on what _our_ definition of negative_p is supposed to be. I think the most reasonable definition is indeed similar to above, which in turn is equivalent to simply looking at the sign bit (which is what copysign() does), i.e. ... > though it has > the signbit set? FWIW, on real_value's real_isneg() returns true for > -0.0 because it only looks at the sign. ... this seems the sensible thing. I just wanted to argue the case that set_negative (or the like) which "sets" the sign bit does not make the nan-ness go away. They are orthogonal. > > deal with NaNs just fine and is required to correctly capture the sign of > > 'x'. If frange::set_nonnegative is supposed to be used in such contexts > > (and I think it's a good idea if that were the case), then set_nonnegative > > does _not_ imply no-NaN. > > > > In particular I would assume that, given an VAYRING frange FR, that > > FR.set_nonnegative() would result in an frange {[+0.0,+inf],+nan} . > > That was my understanding as well, and what my original patch did. > But again, I'm just the messenger. Ah, I obviously haven't followed the thread carefully then. If that's what it was doing then IMO it was the right thing. Ciao, Michael.