From patchwork Wed Apr 9 13:24:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 337844 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 89C7314014D for ; Wed, 9 Apr 2014 23:24:45 +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:to:from:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=Rofm2uINx51VxeNa9C8cEPmATjOcf yomkP8S/hznK/klUeo8jFJcGBKR52ZWzwFyzN2WqI0hJ7gWokNszIc651VJAhQaW RjEVGg+udvRnegLCahRn6WtjFchOatsWqdG2UkHtYEVU4nVDBdidt821okqQ9VzC GI07iM4yHKuw/Y= 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:to:from:subject:date:message-id:mime-version :content-type; s=default; bh=uw2zcHdZtBBdzBKMuvD8p6RMGAw=; b=aM4 NZNXGg79RPIFlCmMrXYSC3vfH7GK2mbLN4S+7tzcTFtNkBqs0VBGz2SNISGnlqky 1+UZQ2sfv38RM9oA3MWEU9JWpoNS3NuhDpdy6BI64aBfNXNKQfdOKUFMoPP+X+rs SJ++gLsiFfAPtBpMv9lL8vkxoFlomTXt9ZUNNxvM= Received: (qmail 23224 invoked by alias); 9 Apr 2014 13:24:40 -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 23206 invoked by uid 89); 9 Apr 2014 13:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: [PATCH][BZ #16823] S390: Fix log1pl returning wrong infinity sign Date: Wed, 09 Apr 2014 15:24:21 +0200 Lines: 52 Message-ID: Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 Hi, on S390 test-double fails for log1pl(-1) with infinity has wrong sign in rounding mode FE_DOWNWARD. See Bug 16823. In this rounding mode, (x-x) = -0. In all other rounding modes, (x-x) = +0. A division with divisor -0 leads to +inf, while +0 results in -inf as expected. This patch changes the divisor to a const +0. Tested on s390/s390x. Is this okay? Bye --- 2014-04-09 Stefan Liebler [BZ #16823] * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Use const positive zero instead of (x-x). --- diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index d991e8a..6c1970b 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -150,9 +150,9 @@ __log1pl (long double xm1) if (x <= 0.0L) { if (x == 0.0L) - return (-1.0L / (x - x)); + return (-1.0L / zero); else - return (zero / (x - x)); + return (zero / zero); } /* Separate mantissa from exponent. */