From patchwork Tue Oct 6 17:38:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 526855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DD479140D72 for ; Wed, 7 Oct 2015 04:38:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=KPzI0n/l; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=m+Hd2okwlG1iRRgOQPja2/24xTeZw Subu/IzZEZ5gVaBRL1HY3Fv+hoQgl72zkuGxnX9Go1mb42EhZhKAdfbTB+njO+5r B2hr51YSWUkkpqYGKJ0xKn8zDIMskPanNMtYQZQ4JxPIsk0G5DdhBhlpQuslv+MK pmDdnJrxsdWCoY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=v349oVTlsMwHIdZARfbsh1UmxQw=; b=KPz I0n/lxA8sAwtMSCNE7AUHwNInbDuuNI1kmc0fZ2VG2bNaU9ba74F9s3/4rI4YBsM AAaJcfP8MIPYNBUsEBl/o+1xsRgR+u/Bo3sXJf8z187kFImiFXRmI6HzG0zd17Rk Orm52lum/FZkMoUcmwSg/dbBpyLUfqc7EHSDOo6A= Received: (qmail 95644 invoked by alias); 6 Oct 2015 17:38:39 -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 95635 invoked by uid 89); 6 Oct 2015 17:38:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Tue, 6 Oct 2015 17:38:32 +0000 From: Joseph Myers To: Subject: Fix ldbl-128ibm expl overflow in non-default rounding modes (bug 19078) [committed] Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 The ldbl-128ibm expl wrapper checks the argument to determine when to call __kernel_standard_l, thereby overriding overflowing results from __ieee754_expl that could otherwise (given appropriately patched libgcc) be correct for the rounding mode. This patch changes it to check the result of __ieee754_expl instead, as other versions of this wrapper do. Tested for powerpc. Committed. 2015-10-06 Joseph Myers [BZ #19078] * sysdeps/ieee754/ldbl-128ibm/w_expl.c (o_thres): Remove variable. (u_thres): Likewise. (__expl): Determine whether to call __kernel_standard_l based on value of result, not argument. diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl.c b/sysdeps/ieee754/ldbl-128ibm/w_expl.c index fb5c8d3..c9d44b6 100644 --- a/sysdeps/ieee754/ldbl-128ibm/w_expl.c +++ b/sysdeps/ieee754/ldbl-128ibm/w_expl.c @@ -2,9 +2,6 @@ #include #include -static const long double o_thres = 709.78271289338399678773454114191496482L; -static const long double u_thres = -744.44007192138126231410729844608163411L; - long double __expl(long double x) /* wrapper exp */ { long double z; @@ -13,9 +10,9 @@ long double __expl(long double x) /* wrapper exp */ return z; if (isfinite(x)) { - if (x >= o_thres) + if (!isfinite (z)) return __kernel_standard_l(x,x,206); /* exp overflow */ - else if (x <= u_thres) + else if (z == 0.0L) return __kernel_standard_l(x,x,207); /* exp underflow */ } return z;