From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 366433954411 for ; Tue, 22 Jun 2021 20:31:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 366433954411 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: uLYI8OyvwiHXtSJwW+RfoHXTeEcZM5aCYrrQGwY4jfJjUuQ8X3yRIiRSXqd6rJKdTa2ImHMBTy +C+VqM2eYj/AOspW7yLFVis5UxQSvnBm0MLY3lxFthUG1fIYq7SMCWnCjAL6ThQb8az8Vv2teX 3hfH9D0oyTLFa/CcHRQlpUb57s0pZicfbu57nMIUj3ljEdx5e/F+JqqFRYZNAsGIBFTP9eE3Aj UznRZK4C7FWaOokLs0FKyJ/NYCTEtq7KM/Tg0TVUsmQm1H4ZONufnbmIwl72ZUW0lODN1XWxcD UDY= X-IronPort-AV: E=Sophos;i="5.83,292,1616486400"; d="scan'208";a="65123213" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 22 Jun 2021 12:31:18 -0800 IronPort-SDR: 22nyWbPmbuNTsmo9A/3Z/wm1NzEUBS4tr89/2usTLOYhsdEQvesj5/M7Cw7vlrmNDBDT88B1sd CFH9o5w3EAbdCbzgRvqDUnEdhbU9tKwaw1QTfrb2t0a0MWrcEX33vqe9VNEZ7AqDp53wpHlgj1 dJsYlLLi0Uyq6OhNLIiWFy40qOY1Qekz3Ylp8bX5kyLeQ8eU1cFw1Kuw6KxFQInOJ2aAz4rDoD wj4RA56no2EWuYTl8dizbLuMOWRX3Zq9vms+FaXN+Ql5REoJBpFzeo6ipYCCpPBeh3CDE3cVmx COE= Date: Tue, 22 Jun 2021 20:31:12 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Keith Packard CC: Subject: Re: [PATCH] stdlib: Make strtod/strtof set ERANGE consistently for underflow. In-Reply-To: <878s31pz7i.fsf@keithp.com> Message-ID: References: <878s31pz7i.fsf@keithp.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3120.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2021 20:31:20 -0000 On Tue, 22 Jun 2021, Keith Packard wrote: > This patch attempts to consistently set errno to ERANGE for all > 'underflow' conditions, which is to say all values which are not > exactly zero and which cannot be represented in normalized form. > > This matches glibc behavior, as well as the Linux, Mac OS X, OpenBSD, > FreeBSD and SunOS strtod man pages. What glibc does is set it when the IEEE underflow exception flag is raised. That is, when the result is tiny and inexact, where "tiny" follows each architecture's choice of before-rounding or after-rounding tininess detection (neither of which means "the rounded result is subnormal"; for both definitions of tiny results, there are values that round to the least-magnitude normal value of their sign but are still considered tiny, because after-rounding actually means "the result would have a subnormal exponent if rounded to the same precision as for normal values but with a wider exponent range"). -- Joseph S. Myers joseph@codesourcery.com