From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D2C4E3858D28 for ; Mon, 19 Sep 2022 13:58:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D2C4E3858D28 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 A86951F91B; Mon, 19 Sep 2022 13:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1663595909; 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=jchLzRYfFofoQWP4srle3QGNciIYngShOxFuMlW81Xs=; b=FlzMplD7WBXNo0dkIHpMUlRL/BSGxnl8TITYW18jZz5udiLM5ELUfZL3vu//UeJjKBp3LJ BvMELiFmLSpxJIveqh8BEiNSd22P2ZJlEUm+Ub0XHuNX752Gomwn4EONXZkfYabioFRRgD HdAaDaAb1Qp5atyqe7V7++ag6Lv0Djc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1663595909; 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=jchLzRYfFofoQWP4srle3QGNciIYngShOxFuMlW81Xs=; b=e5k49h74BpIerJDc/0tK4hktw1JgkWuSSnu8A6vu+LS/N+dMorjJMM+KI9Q0flBFXXH91s 07cBZwNYoK8GbYCA== 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 95C9A2C141; Mon, 19 Sep 2022 13:58:29 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 5F8C763DF; Mon, 19 Sep 2022 13:58:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id 5E2696339; Mon, 19 Sep 2022 13:58:29 +0000 (UTC) Date: Mon, 19 Sep 2022 13:58:29 +0000 (UTC) From: Michael Matz To: Richard Biener cc: Aldy Hernandez , 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,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 Mon, 19 Sep 2022, Richard Biener via Gcc-patches wrote: > > but I guess it's good we do the right thing for correctness sake, and > > if it ever gets used by someone else. > > > > > > > > That said, 'set_nonnegative' could be interpreted to be without > > > NaNs? > > > > Sounds good to me. How's this? > > Hmm, I merely had lots of questions above so I think to answer them > we at least should document what 'set_nonnegative' implies in the > abstract vrange class. > > It's probably safer to keep NaN in. For example unfolded copysign (x, 1.) > will return true for x == -NaN but the result will be a NaN. 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 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} . Ciao, Michael.