From patchwork Mon Jun 30 16:42:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 365692 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 4BBCB14010E for ; Tue, 1 Jul 2014 02:42:44 +1000 (EST) 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=FN96SDHovxUlTeWSA/MEdSDw4FpVX 7RDH1wdMOj/jNh5ShOepUKh8JUOSZ4mvMsAR7j7BmQHLaTrJ3fxBx6o9tWke/Hkd gVg7U5bgfJqjeK1UPf92DDE/xGfJ41d6mosKqFfmVkeIM3hSmu7a8U5ki3no//DN lCgzCr+MoG3r70= 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=H8n1VRhUewqf7+jU02XlP6//g4A=; b=Z4r +XNKg0h4kXLZRL38vxTH+c3JtmzK1fCYZ8I1+o5+aEeZ2wUBtTXg+JY8pY7x4KYG grB8oN0NNPGlTuMgdEwIlPMkx4uHmx9RPecPh8/gYW7mZJ77ENAhraNDl1lnL1OZ ekXUUuySJ3edmA4NP6Z3BVc10GcpS+MPSm6SXFww= Received: (qmail 11059 invoked by alias); 30 Jun 2014 16:42:38 -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 11040 invoked by uid 89); 30 Jun 2014 16:42:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Mon, 30 Jun 2014 16:42:28 +0000 From: "Joseph S. Myers" To: Subject: Fix ldbl-128 expm1l spurious underflow (bug 16539) Message-ID: MIME-Version: 1.0 This patch fixes spurious underflows from ldbl-128 expm1l, as reported in and exposed by the tests added for such a bug in the x86 / x86-64 version. The bug and fix are essentially the same, so no separate bug is filed in Bugzilla. Tested for mips64. 2014-06-30 Joseph Myers [BZ #16539] * sysdeps/ieee754/ldbl-128/s_expm1l.c: Include . (__expm1l): Return argument unchanged when small but not subnormal. diff --git a/sysdeps/ieee754/ldbl-128/s_expm1l.c b/sysdeps/ieee754/ldbl-128/s_expm1l.c index 1c12109..f708af5 100644 --- a/sysdeps/ieee754/ldbl-128/s_expm1l.c +++ b/sysdeps/ieee754/ldbl-128/s_expm1l.c @@ -54,6 +54,7 @@ #include +#include #include #include @@ -136,6 +137,10 @@ __expm1l (long double x) if (x < minarg) return (4.0/big - 1.0L); + /* Avoid internal underflow when result does not underflow. */ + if (fabsl (x) < 0x1p-113L && fabsl (x) >= LDBL_MIN) + return x; + /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */ xx = C1 + C2; /* ln 2. */ px = __floorl (0.5 + x / xx);