From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 949303858C74 for ; Tue, 20 Sep 2022 14:58:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 949303858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663685932; h=from:from:reply-to:subject:subject: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=GjQcrLjTjTzkMVyGB/zooi/PMGYeFboXcqI3b86KtLc=; b=gFt9ACXQFN6o32rl1hzqdnNA315OUSqggj3zVnYWcBFa7KNxF1RH/girFOwf1XAVBlenjQ YpB7SzxaYchaVp1PnUDjjt0ra5bo2eRTEfEDY9cg1cH5UNfqsjndBNfNCaoFKISkZ2nyMW eGvKoUNW2DtLpIjqiUaf9c+uzskwa3g= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-466-Q4BAJ4cINm2zPq5SR4CShg-1; Tue, 20 Sep 2022 10:58:51 -0400 X-MC-Unique: Q4BAJ4cINm2zPq5SR4CShg-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-12777f2df6aso1757921fac.14 for ; Tue, 20 Sep 2022 07:58:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=GjQcrLjTjTzkMVyGB/zooi/PMGYeFboXcqI3b86KtLc=; b=a11pu7ZeEYrWddqeVSDAU/835vbuqIl8IA6SXSjHmJmc31PlL3HhiBn41JfVv1r5wb Nh1+wpN91oN+eacgaAKyAtLmcu/ZwZVCVQF26/pexbyqcpXULT3ouolZlDkg3Wipf/fY hDEfzbm7vAVZHjJTfX+zIH7ysVcHpDLIwyp+lXrw1tTEPJrHql2xza3KE7/ykOjTdH5D BpUb0gy/eZ7+hNeNUqKz5a3Idq6sIqVYmM5gXyamnL6zmi4s3VP5Ry1K9XfYJoMO63x7 5rp6FD9ITEgIrpVV1ELgUDYbhZU1ZqjkvGcbHSUA/fmlsdwEgthtiJoNNtdy7LXytopv TSJQ== X-Gm-Message-State: ACrzQf24TO58vxF554uXAdqmZgeCmIHGSYGBBpxTaUdM44UD/VawvaEh KGWVMHBVir+t26NFZlkJCh2y8yJGIqtHIVEiHL/3KKBW10fJzwHdQURYa24JQlf3feG3zBpZKXQ RDWu38Er46NlsIB4sX+dtwfbfnkOGnlZ9jQ== X-Received: by 2002:a05:6808:650:b0:34f:b81f:960 with SMTP id z16-20020a056808065000b0034fb81f0960mr1803982oih.36.1663685930161; Tue, 20 Sep 2022 07:58:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DIIwQfem31Is85CpwNwS9z0onwHwNGL2basZplzZ5qFUAeMGGXK4RpT+fqr1eFtTNF6M3NH22bZgzX2599bY= X-Received: by 2002:a05:6808:650:b0:34f:b81f:960 with SMTP id z16-20020a056808065000b0034fb81f0960mr1803968oih.36.1663685929887; Tue, 20 Sep 2022 07:58:49 -0700 (PDT) MIME-Version: 1.0 References: <20220919075901.1798294-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Tue, 20 Sep 2022 16:58:38 +0200 Message-ID: Subject: Re: [PATCH] [PR68097] frange::set_nonnegative should not contain -NAN. To: Michael Matz Cc: Richard Biener , Jakub Jelinek , GCC patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: On Tue, Sep 20, 2022 at 2:51 PM Michael Matz wrote: > > 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. This brings me back to my original patch :). Richard, do you agree nonnegative should be [0.0, +INF] U +NAN. Thanks. Aldy