From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 1C1851F5AE for ; Thu, 30 Jul 2020 07:20:23 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 372F03857C41; Thu, 30 Jul 2020 07:20:21 +0000 (GMT) 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 498E03858D35 for ; Thu, 30 Jul 2020 07:20:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 498E03858D35 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,413,1589234400"; d="scan'208";a="355605934" 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; 30 Jul 2020 09:20:16 +0200 Date: Thu, 30 Jul 2020 09:20:16 +0200 Message-Id: From: Paul Zimmermann To: Adhemerval Zanella In-reply-to: (message from Adhemerval Zanella on Wed, 29 Jul 2020 17:25:24 -0300) Subject: Re: fix inaccuracy of j0f for x >= 2^127 when sin(x)+cos(x) is tiny (v3) References: <87wo2oxahr.fsf@igel.home> 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 again for your useful comments. > Does it require any ULP adjustment (at least on the architecture you > tested it)? I reset to 0 the j0/float values in sysdeps/x86_64/fpu/libm-test-ulps, then ran "make regen-ulps", and got: $ diff ../sysdeps/x86_64/fpu/libm-test-ulps /localdisk/zimmerma/glibc/build/math/NewUlps 1315c1315 < float: 0 --- > float: 8 1321c1321 < float: 0 --- > float: 4 1327c1327 < float: 0 --- > float: 5 1333c1333 < float: 0 --- > float: 5 which were the original values except for j0_towardzero (it was 6). However the same applies to "master", so this is independent from my change. Anyway, I decreased the value from 6 to 5. Below is a v3. Paul >From 34d336cf2e8495bba21254157be13e02f52d934a Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Thu, 30 Jul 2020 09:16:36 +0200 Subject: [PATCH] fix inaccuracy of j0f for x >= 2^127 when sin(x)+cos(x) is tiny (v3) --- math/auto-libm-test-in | 2 ++ sysdeps/ieee754/flt-32/e_j0f.c | 17 ++++++++++++++++- sysdeps/x86_64/fpu/libm-test-ulps | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) 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..91e8de8fe3 100644 --- a/sysdeps/ieee754/flt-32/e_j0f.c +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -55,7 +55,22 @@ __ieee754_j0f(float x) z = -__cosf(x+x); if ((s*c)