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 9DCB43858D32 for ; Tue, 20 Sep 2022 05:25:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9DCB43858D32 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=1663651539; 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=KV8HpIUH5hG8B24QJmsSkPThZLy4UwkEtejoJFVZuXI=; b=b6dUSMOcKnVJogjlkz9Wq9s+okfP2Tc0L8UBnHxoK8a34PhU/SkAlvn8q/QZYKC/kpqel1 C8yjy3NU/qwwhI8QLlrGxMyb0aW39KRW+DPP6QbjBu2NwS1F3Y7HNHsI2nd0bYlwHi7GHK akbhs65KXKo3nD6Om8ZxH3NlDW6eTfY= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-454-2PygLYKsPHyfkB6Ui_VjDQ-1; Tue, 20 Sep 2022 01:25:38 -0400 X-MC-Unique: 2PygLYKsPHyfkB6Ui_VjDQ-1 Received: by mail-oi1-f197.google.com with SMTP id q11-20020a0568080a8b00b0034fbbc585f3so891518oij.4 for ; Mon, 19 Sep 2022 22:25:37 -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=KV8HpIUH5hG8B24QJmsSkPThZLy4UwkEtejoJFVZuXI=; b=cu6PO7IdCm/gmTM62OYcs7s4cDoiPL5NECeLCCNoW6N4Lj27hIAeQ3v/N2uqJSXArG T6RFhrH64tQ1Y5O4PGFTtXQyE14xBIycPHHWPxhq4yo14GKfyo+ZMHO8g/kqR4Ckagcw skPmyLXrwPUh/QIaxJRM6taop1LbiMkADdGA+mEoUsyLifJjWpXBfFDeuk1y4bEKSPEn /4z1LLo78SuI9OVG28NykNZ990I8QZZTy8Bger2waNnBlDGvRrN7HkMMC2FOjF2XkHMN mqjtEPYAqklNevshZzQA0qpSN9rE4Kke9gC2Dq2H1rB/3uOy6ZUmvDf7eLFWBpXdKCPH q+RQ== X-Gm-Message-State: ACrzQf32APJnZXBZl7NmQtXVpdA9MR90nbOGdZDTqcS4ACZKRTb4hfmQ ZEuBdxGRiwKpX5Kd7+oBy0jgK07sJysv3gM0OZRk6Hr5cRy1H7rLxNh8T/wfH2MvaQUC1zjjuJH EaTOnrpWmRQpuy5idHBDJp8Hico8C5wYsug== X-Received: by 2002:a05:6830:4492:b0:65a:116c:63e4 with SMTP id r18-20020a056830449200b0065a116c63e4mr3096673otv.335.1663651537368; Mon, 19 Sep 2022 22:25:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UvNFhmnphsTapuwhHxy003//JgumsipbisvRWizu7X6H/HYsmq8q9sR8TRUjlw8GvShd8R6OzQ6VEZV3MFaQ= X-Received: by 2002:a05:6830:4492:b0:65a:116c:63e4 with SMTP id r18-20020a056830449200b0065a116c63e4mr3096665otv.335.1663651537148; Mon, 19 Sep 2022 22:25:37 -0700 (PDT) MIME-Version: 1.0 References: <20220919075901.1798294-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Tue, 20 Sep 2022 07:25:26 +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=-6.2 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 Mon, Sep 19, 2022 at 4:04 PM Michael Matz wrote: > > 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 I suppose this means -0.0 is not considered negative, 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. > > 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. Aldy