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 ESMTP id 672253858D3C for ; Mon, 28 Jun 2021 20:38:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 672253858D3C 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=1624912734; 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=cbXhDE99n2Q84geiPs60Q6KNgKdCVuRneDovwRmCK7g=; b=BjoS3lbUJ5cNBksAunDJVb9S7pNlUNMKei82M0Qwl0OZ7es8vMujPr69d4oHsN31fXy3cf PTKhPNg1dn25+WOtFQDaiHXP4gLnSqR+Wg4SsOyrZ4a4ekoe6s3CUQfTp6ElMPP5Ydo7BJ W7IdJl1tPuZRz6C9UIEtjW9MEbIaSCs= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-B7oyzBQyN9yK2ndoZwPdxA-1; Mon, 28 Jun 2021 16:38:52 -0400 X-MC-Unique: B7oyzBQyN9yK2ndoZwPdxA-1 Received: by mail-pg1-f199.google.com with SMTP id j17-20020a63cf110000b0290226eb0c27acso12385788pgg.23 for ; Mon, 28 Jun 2021 13:38:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cbXhDE99n2Q84geiPs60Q6KNgKdCVuRneDovwRmCK7g=; b=RPMux40pslznBeEO2UP27FAC8e2/kNgfFeP4zlkCRBw6SvoYiG/xuMtI7VnIXns9sZ yww/+5Opc3LN3/k4rHRLr3qIMadIcZLCRzpBX+Vb3U9O8Yb9xqCAShF2jAGmDFKBIt5S 13qqC2JGg47KCMt9WeqIKdIJXcxQmPUrbbPdaaQHknI5iV3s+uk9dT2Cyx85eSdNAGb8 VJJFVwTAI4fpwiePxIbI9YZICFqvwbJVsFnREqgcl02DbfPyzsarXajzS9YhIJsEiBJ5 ZLdKfMJCpSP77fRUJqD0ZvJWZICMjvoDRqPdnyOUIVXDuR9sH1wQTah1G2XSJSrdBBS0 llzQ== X-Gm-Message-State: AOAM532tIkFGuj4AS8kUEx625pi4vvVddrhWPXmT/YUlH+v1ukYSCNO5 nc3VvYieO24PGNTM9spFI+u7BKVQSstovkrtvIziT2KVgQqR5oLUhnCw1RnuPhikOZ8/muui6ZB V5O+rJI5WFHvM+h5YyZVRpPXFKmj1haE= X-Received: by 2002:a17:902:b113:b029:128:cec4:e01e with SMTP id q19-20020a170902b113b0290128cec4e01emr8953555plr.78.1624912731089; Mon, 28 Jun 2021 13:38:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSdiNgJm+SpbukAUl2EfBdttlaPi+BzsE8RAKOwF+aHqyEmOfvFe1L5SMvtyTDI7oP5k+TRMcRrRVICvQuJbQ= X-Received: by 2002:a17:902:b113:b029:128:cec4:e01e with SMTP id q19-20020a170902b113b0290128cec4e01emr8953536plr.78.1624912730762; Mon, 28 Jun 2021 13:38:50 -0700 (PDT) MIME-Version: 1.0 References: <878s31pz7i.fsf@keithp.com> <874kdppp5w.fsf@keithp.com> In-Reply-To: <874kdppp5w.fsf@keithp.com> From: Jeff Johnston Date: Mon, 28 Jun 2021 16:38:39 -0400 Message-ID: Subject: Re: [PATCH] stdlib: Make strtod/strtof set ERANGE consistently for underflow. To: Keith Packard Cc: Joseph Myers , Newlib Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jjohnstn@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Mon, 28 Jun 2021 20:38:57 -0000 Hi Joseph, While I realize that glibc does things differently and there are cases still not handled, do you object to merging Keith's patch as-is? If not, I'll push it. -- Jeff J. On Tue, Jun 22, 2021 at 5:26 PM Keith Packard wrote: > Joseph Myers writes: > > >> This matches glibc behavior, as well as the Linux, Mac OS X, OpenBSD, > >> FreeBSD and SunOS strtod man pages. > > (I should have said 'matches glibc in all of my tests, which are not > exhaustive' :-) > > > 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"). > > Thanks for this clarification; I didn't realize that underflow had this > additional subtly. It sounds like this means that there are additional > cases where errno should be set to ERANGE in the code. I'm afraid I > don't understand the workings of this function well enough to know how > to detect this particular case. Could we somehow detect this using > exceptions? Or are there places in the code which could add some direct > checks? > > -- > -keith >