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 48ACD3858D38 for ; Thu, 22 Sep 2022 21:04:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48ACD3858D38 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=1663880672; h=from:from:reply-to: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=cWNxyYHHwqj+KxZzRG/519+b688RojK2FQjBYRMGb5A=; b=HtM4RgJfKXbsIlLZcv2vv3slhySiBjUCDXDIGcn8DWvZNLtDFLYoB594ZIfBikbXvdalmg 9jIRJ7xI04yTd8KUHRXXfQFVDVy2bVzisWak77srbVpZe3B+yGXdme4VrgIKtkfOEHShsc gWooQauoY2sH8+EjOo3Ca03ENpzkZWo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-364-DD86_lliNcmUncFXytnE8g-1; Thu, 22 Sep 2022 17:04:29 -0400 X-MC-Unique: DD86_lliNcmUncFXytnE8g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7F8980029D; Thu, 22 Sep 2022 21:04:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.194]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 646FA140EBF4; Thu, 22 Sep 2022 21:04:29 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 28ML4Q6Q2784602 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 23:04:27 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 28ML4QTV2784548; Thu, 22 Sep 2022 23:04:26 +0200 Date: Thu, 22 Sep 2022 23:04:25 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches , Richard Biener , Andrew MacLeod Subject: Re: [PATCH] frange: dump hex values when dumping FP numbers. Message-ID: Reply-To: Jakub Jelinek References: <20220922164911.2566143-1-aldyh@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220922164911.2566143-1-aldyh@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 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 Thu, Sep 22, 2022 at 06:49:10PM +0200, Aldy Hernandez wrote: > It has been suggested that if we start bumping numbers by an ULP when > calculating open ranges (for example the numbers less than 3.0) that > dumping these will become increasingly harder to read, and instead we > should opt for the hex representation. I still find the floating > point representation easier to read for most numbers, but perhaps we > could have both? > > With this patch this is the representation for [15.0, 20.0]: > > [frange] float [1.5e+1 (0x0.fp+4), 2.0e+1 (0x0.ap+5)] > > Would you find this useful, or should we stick to the hex > representation only (or something altogether different)? I think dumping both is the way to go, but real_to_hexadecimal doesn't do anything useful with decimal floats, so that part should be guarded on !DECIMAL_FLOAT_TYPE_P (type). Why do you build a tree + dump_generic_node for decimal instead of real_to_decimal_for_mode ? The former I think calls: char string[100]; real_to_decimal (string, &d, sizeof (string), 0, 1); so perhaps: char s[100]; real_to_decimal_for_mode (s, &r, sizeof (string), 0, 1, TYPE_MODE (type)); pp_string (pp, "%s", s); if (!DECIMAL_FLOAT_TYPE_P (type)) { real_to_hexadecimal (s, &r, sizeof (s), 0, 1); pp_printf (pp, " (%s)", s); } ? Jakub