From patchwork Fri Sep 1 15:18:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 22496 Received: (qmail 40038 invoked by alias); 1 Sep 2017 15:18:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 40024 invoked by uid 89); 1 Sep 2017 15:18:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=10, 000 X-HELO: mailbackend.panix.com X-Gm-Message-State: AHPjjUjWDSiQWlD97TeO7DrpHzZlyi6Ftv5terZq6fD/NFd5GqKHUKfq aukYqicuJjeMN9c8xex7mTUZBz3MFw== X-Google-Smtp-Source: ADKCNb46NT9s3lv3KxrHcKaqo7W6gtsmKK0RKSEnYwZzMXAHC9qZ072/QawegrUa6l1V6DJZlXu+BixWn76FXnTo+OA= X-Received: by 10.107.4.77 with SMTP id 74mr1934061ioe.167.1504279118002; Fri, 01 Sep 2017 08:18:38 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <0a429628-dfbc-9eaf-4e19-26d9cfa22bde@panix.com> <68de3d6e-7900-96a4-bc13-c5eff05fda7f@panix.com> From: Zack Weinberg Date: Fri, 1 Sep 2017 11:18:35 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Simplify HUGE_VAL definitions [committed] To: Joseph Myers Cc: GNU C Library On Fri, Sep 1, 2017 at 10:59 AM, Joseph Myers wrote: > On Fri, 1 Sep 2017, Zack Weinberg wrote: > >> One more problem, which I should have thought to check earlier: 1e10000L >> isn't big enough if long double is 128 bits wide (which it actually >> appears to be on this computer): > > 1e10000L is big enough. For both x86 extended and binary128, the largest > finite value is just below 2^16384 (about 1.2e4932). Oh, right, I forgot *_MAX_EXP are binary. I'm checking this in instead, then. zw * math/math.h (HUGE_VAL): Improve commentary. diff --git a/math/math.h b/math/math.h index bbc1ab9bfa..547b36d10e 100644 --- a/math/math.h +++ b/math/math.h @@ -37,11 +37,16 @@ __BEGIN_DECLS /* Gather machine dependent type support. */ #include -/* Value returned on overflow. On all IEEE754 machines, this is - +Infinity. */ +/* Value returned on overflow. With IEEE 754 floating point, this is + +Infinity, otherwise the largest representable positive value. */ #if __GNUC_PREREQ (3, 3) # define HUGE_VAL (__builtin_huge_val ()) #else +/* This may provoke compiler warnings, and may not be rounded to + +Infinity in all IEEE 754 rounding modes, but is the best that can + be done in ISO C while remaining a constant expression. 10,000 is + greater than the maximum (decimal) exponent for all supported + floating-point formats and widths. */ # define HUGE_VAL 1e10000 #endif #ifdef __USE_ISOC99