From patchwork Wed Jul 29 07:03:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Zimmermann X-Patchwork-Id: 1338170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inria.fr Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGkzV5T9wz9sRW for ; Wed, 29 Jul 2020 17:03:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DEC73385C8B1; Wed, 29 Jul 2020 07:03:43 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sourceware.org (Postfix) with ESMTPS id C9C55385C8B1 for ; Wed, 29 Jul 2020 07:03:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C9C55385C8B1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Paul.Zimmermann@inria.fr X-IronPort-AV: E=Sophos;i="5.75,409,1589234400"; d="scan'208";a="355531631" Received: from tomate.loria.fr (HELO tomate) ([152.81.10.51]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 09:03:06 +0200 Date: Wed, 29 Jul 2020 09:03:06 +0200 Message-Id: From: Paul Zimmermann To: Adhemerval Zanella In-reply-to: (message from Adhemerval Zanella via Libc-alpha on Tue, 28 Jul 2020 15:09:31 -0300) Subject: fix inaccuracy of j0f for x >= 2^127 when sin(x)+cos(x) is tiny (v2) References: <87wo2oxahr.fsf@igel.home> X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Dear Adhemerval, thank you for your review. Here is a v2 with all fixes. I did fix the indentation issue, but did not see the "open brackets on next line" issue: in other places of this file, we have "else {" with the open brackets on the same line. I also did add an entry in math/auto-libm-test-in that corresponds to the larger error for the new code path. No adjustment is needed however, since the new code is more accurate. Best regards, Paul From a4fe8c3e6c172c7eea198f3225efb05b6afe0f65 Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Wed, 29 Jul 2020 08:59:12 +0200 Subject: [PATCH] fix inaccuracy of j0f for x >= 2^127 when sin(x)+cos(x) is tiny (v2) --- math/auto-libm-test-in | 2 ++ sysdeps/ieee754/flt-32/e_j0f.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 4414e54d93..5d488a8711 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -5748,6 +5748,8 @@ j0 0x1p16382 j0 0x1p16383 # the next value generates larger error bounds on x86_64 (binary32) j0 0x2.602774p+0 xfail-rounding:ibm128-libgcc +# the next value exercises the flt-32 code path for x >= 2^127 +j0 0x8.2f4ecp+124 j1 -1.0 j1 0.0 diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c index c89b9f2688..8540d00b7b 100644 --- a/sysdeps/ieee754/flt-32/e_j0f.c +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -56,6 +56,22 @@ __ieee754_j0f(float x) if ((s*c)