From patchwork Fri Jan 31 19:17:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 861002 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp891726wrr; Fri, 31 Jan 2025 11:23:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMChYPh0Wip+J7DxCBc7LE0thiwkkJa5STE5m+HkxVw27YZUHgQw6Z0v72EQuMGBLauHTLKA==@linaro.org X-Google-Smtp-Source: AGHT+IF3tmlbWCSIT5MTckwIxDqlcYq0/N0CrXwx6NKT15F02GgiWs6Kz5C2SBxK6Ik8Uwg5MHXD X-Received: by 2002:a05:6214:3007:b0:6dd:d3b:de38 with SMTP id 6a1803df08f44-6e243bb8914mr203170276d6.16.1738351383810; Fri, 31 Jan 2025 11:23:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738351383; cv=pass; d=google.com; s=arc-20240605; b=R1NA/TZ22c6WcWmUyKiwDIghXPvnfpz1laROucjM82T43WSKCd2JJaPP22ICxfZwPw S0kNPaNs//Se+bS0Bo5zvtZ/Ofsl2nQUTlE3NojTC3DOK6xmBeRWxFQzgpJgPLyiF+NO WTJ+NRhp8feMakG45g314TjwQ45sxNjI1SKRHDMG+omL1XbyjVidhybkjNptaCPlcGCV pkrLSiBy6d40yrGTzvTLJfQ5KKq36g2rQ68ETnn9FQjqghlgF2d0Up9W3H4v+cCAaube 25ckn/FEPJA17VD90TwhKaUCESrfeuFKXxX4TBHUSVSfyOCu8BeKD45rVIFlKe4/Pdpl XbGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=3v9sR2kB1D6j4BH5r/7exVjXnC0eQGX5HBXBCBEijq4=; fh=T3r0zdCptMfvhfOunKrfbObcLBcSXv7WNDNor/iY12Y=; b=QthxNFOufrhjMZWE85qY7XmOscFWZZsQH3/2F4BQhUPJ04xN1VYwrQgRvufy5piHCM n5WneLs9ceTO4f7Sqh/ExhepYqpHE1Hp6lyJS6YoTxIPDeW7i2F1sWDPHyOoNoS7AcG0 qFyo8xMFPZc93IAZq/my7FHCCUCIvFfy7WrZfS5nbOBQPJzdioGQlDV/RtuvdK7PapxF /uG8hanub4zmxKSKKz5Mx12/1kNbRV2ikBXqDYNTz/iYHLVW7m3b2mIIyUNgfbYC+g2i zMmSEnel1z5Cr56IEmdxtio5NAPdHpzr7YJJyLXiUnAaSr6M/UvNZk07srZRqSPOlllh 2IgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kwtZT701; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6e2549c6ae0si43285416d6.401.2025.01.31.11.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 11:23:03 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kwtZT701; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7688D3857727 for ; Fri, 31 Jan 2025 19:23:03 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 6E8DF3858406 for ; Fri, 31 Jan 2025 19:19:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E8DF3858406 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6E8DF3858406 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738351187; cv=none; b=glGmVtW97Ys3gtKr6RMxSbJoErZXbdfI1T1YPi8X78MoZoJd4AupFlFzZp92cUSsXDgxM3DxB3GPrJJHucc03iojxHTHWavozIoJo2W64p9ir/ZJBrBTptvAvHvok5JVOOWBUxVKrMNlng2vhifwbCn9UZa4TN2iDQJfQMmghXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738351187; c=relaxed/simple; bh=d51jZwiwrfdQdZEdtuL4EBeFc7SxVGWwDuBRCtFbz68=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BD+Jk5kehf9xcG1IUU7uGgV4MwmF3Z7XDVcQkANHfwwb1rCcCT9l6l4YB/Z0XsfxzecUglqBcdUGEBLkZ7DTphz9LbxLqWPSbU0u3982DLFa34xg/cfzq0QbXU6yMtLZ/dudMHpVUTFD16WdLCb00rWHxj5uRW/gqcXfGvgDhR4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2ef28f07dbaso3230356a91.2 for ; Fri, 31 Jan 2025 11:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738351159; x=1738955959; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3v9sR2kB1D6j4BH5r/7exVjXnC0eQGX5HBXBCBEijq4=; b=kwtZT701iuUoN0+KUpudibsbsIw9tlVfpt7m20bdI+h/jac8Fc1IHkcLgT9WgBPCfW jT0Oa4uey0TFG4WBGKpEyTlXtZ2Yt54UPdCrORZ3vRkG0FVdhJ4II4pp0LB32DWOKhC/ /fQX0ch6vhQXflpbjyZsfhEvEv7DQ6vNn3s6Gr+mh2R1ZxJ/hPs8n3lxh21jpU/0mdpj VGPZzBElr4JGL5BsTQ8GMgVM/IFlsZ0nKTZC1LPZfK/dKGiCEjak7yZ6Rf6rYuXs5gKi w3dpqBmYSypx9wHMaO7B16IXMX4UKjPpgnuyRDU8pwxJ/H6UOqiC3J0ZMPKkc+Xp+iWB 2gyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738351159; x=1738955959; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3v9sR2kB1D6j4BH5r/7exVjXnC0eQGX5HBXBCBEijq4=; b=JjZ4UNW5NcntbaOHgyOHuhAj6r8JZ0KQ8o9HJLhF+jQDdGLsDGEmBHib6qCRb1ZYc/ W7x2zNG+OCaVpeqIzlvYoguWzVps8a0q+EjcVdqmit7EGAGXhV7yZy/erXUxA+JHG82i ixbCAwSMAMwK9a2x2Qpba2FgPpC9108yNLtX6DgavEDT3f3XKL0KGe/mZzaqZZejoM9m 5aDF1It3Rc7wArLySOzGfviP22HqWZkbDZ4Ho4R5SAouL0jWastmVmZyqrMGsYwv9tAe hqC+sFCQGDerTgh4OxOfp5npep/jCH54RfPjHOrwJTBJWGr/3+N+s6PjKN/ptkCKXm2i q40Q== X-Gm-Message-State: AOJu0YzQgaJLsUa18LRy3m0KqVOdarA8QThQwOnc5U+i79B606zvYkNw vauEWs1g7Ywgm1fJSUptdaQyrvi2uTTY8NLNw2izzg6IRf0RkR7ArbPzsFr/5vrAQ94yIsP4XGm 5 X-Gm-Gg: ASbGncsl9Aaq+pDtO8LWcCGvstQgU93Bn4CF+PLG8ARq3uQ6dOkny2nSK/R4pbAmb+h 1ttttyRBGESaiMuHjWi4uTR+QLBMKUtpcBf1Ll/9JU7Kf3+hy44nrd7C4Hrhrsd+tTpx7brU6dX QLf6wdRP0hJkz2uteBM0t6s91d4/j5MaplKW5ziqCwqSqa2yIv8PhyswDL6ar1AHskhHRIpK3+C TQGtxYkTdd979URIva/IzNBvJfy+RlC1Y/pNvL9cYBt6dNrbeJt2z7SqEV+TTXT5D4/QQSvM+vz Npm3tbIrOPoFmHgbWx5ZXkIU6PrO8w== X-Received: by 2002:a17:90a:c887:b0:2ee:c2df:5d30 with SMTP id 98e67ed59e1d1-2f83ac5e574mr15900405a91.26.1738351158712; Fri, 31 Jan 2025 11:19:18 -0800 (PST) Received: from ubuntu-vm.. ([177.103.113.118]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f830a3d74esm2530475a91.2.2025.01.31.11.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 11:19:18 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: DJ Delorie , Joseph Myers , Paul Zimmermann , Alexei Sibidanov Subject: [PATCH 11/15] math: Use atanpif from CORE-MATH Date: Fri, 31 Jan 2025 16:17:15 -0300 Message-ID: <20250131191844.2582716-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250131191844.2582716-1-adhemerval.zanella@linaro.org> References: <20250131191844.2582716-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org The CORE-MATH implementation is correctly rounded (for any rounding mode) and shows better performance to the generic atanpif. The code was adapted to glibc style and to use the definition of math_config.h (to handle errno, overflow, and underflow). Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1, gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1): latency master patched improvement x86_64 66.3296 52.7558 20.46% x86_64v2 66.0429 51.4007 22.17% x86_64v3 60.6294 48.7876 19.53% aarch64 (Neoverse) 24.3163 20.9110 14.00% power8 16.5766 13.3620 19.39% power10 16.5115 13.4072 18.80% reciprocal-throughput master patched improvement x86_64 30.8599 16.0866 47.87% x86_64v2 29.2286 15.4688 47.08% x86_64v3 23.0960 12.8510 44.36% aarch64 (Neoverse) 15.4619 10.6752 30.96% power8 7.9200 5.2483 33.73% power10 6.8539 4.6262 32.50% --- SHARED-FILES | 4 + sysdeps/aarch64/libm-test-ulps | 4 - sysdeps/arc/fpu/libm-test-ulps | 4 - sysdeps/arc/nofpu/libm-test-ulps | 1 - sysdeps/arm/libm-test-ulps | 4 - sysdeps/hppa/fpu/libm-test-ulps | 4 - sysdeps/i386/fpu/libm-test-ulps | 4 - .../i386/i686/fpu/multiarch/libm-test-ulps | 4 - sysdeps/ieee754/flt-32/s_atanpif.c | 109 ++++++++++++++++++ sysdeps/loongarch/lp64/libm-test-ulps | 4 - sysdeps/mips/mips64/libm-test-ulps | 4 - sysdeps/or1k/fpu/libm-test-ulps | 4 - sysdeps/or1k/nofpu/libm-test-ulps | 1 - sysdeps/powerpc/fpu/libm-test-ulps | 4 - sysdeps/riscv/nofpu/libm-test-ulps | 1 - sysdeps/riscv/rvd/libm-test-ulps | 4 - sysdeps/s390/fpu/libm-test-ulps | 4 - sysdeps/sparc/fpu/libm-test-ulps | 4 - sysdeps/x86_64/fpu/libm-test-ulps | 4 - 19 files changed, 113 insertions(+), 59 deletions(-) create mode 100644 sysdeps/ieee754/flt-32/s_atanpif.c diff --git a/SHARED-FILES b/SHARED-FILES index b403a2a6f0..5702a2d1c3 100644 --- a/SHARED-FILES +++ b/SHARED-FILES @@ -346,3 +346,7 @@ sysdeps/ieee754/flt-32/s_atan2pif.c: (src/binary32/atan2pi/atan2pif.c in CORE-MATH) - the code was adapted to use glibc code style and internal functions to handle errno, overflow, and underflow. +sysdeps/ieee754/flt-32/s_atanpif.c: + (src/binary32/atanpi/atanpif.c in CORE-MATH) + - the code was adapted to use glibc code style and internal + functions to handle errno, overflow, and underflow. diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps index be29b37721..10f182a211 100644 --- a/sysdeps/aarch64/libm-test-ulps +++ b/sysdeps/aarch64/libm-test-ulps @@ -218,22 +218,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps index 1383c88b95..7fb407cecd 100644 --- a/sysdeps/arc/fpu/libm-test-ulps +++ b/sysdeps/arc/fpu/libm-test-ulps @@ -123,19 +123,15 @@ double: 3 Function: "atanpi": double: 2 -float: 1 Function: "atanpi_downward": double: 1 -float: 2 Function: "atanpi_towardzero": double: 1 -float: 2 Function: "atanpi_upward": double: 1 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps index 9028f5cbe7..1859c2bd4f 100644 --- a/sysdeps/arc/nofpu/libm-test-ulps +++ b/sysdeps/arc/nofpu/libm-test-ulps @@ -30,7 +30,6 @@ double: 2 Function: "atanpi": double: 2 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps index e1c538f79f..fa9864adee 100644 --- a/sysdeps/arm/libm-test-ulps +++ b/sysdeps/arm/libm-test-ulps @@ -120,19 +120,15 @@ double: 3 Function: "atanpi": double: 2 -float: 1 Function: "atanpi_downward": double: 1 -float: 2 Function: "atanpi_towardzero": double: 1 -float: 2 Function: "atanpi_upward": double: 1 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps index 796da7b5ab..a59f61fc4e 100644 --- a/sysdeps/hppa/fpu/libm-test-ulps +++ b/sysdeps/hppa/fpu/libm-test-ulps @@ -120,19 +120,15 @@ double: 3 Function: "atanpi": double: 2 -float: 1 Function: "atanpi_downward": double: 1 -float: 2 Function: "atanpi_towardzero": double: 1 -float: 2 Function: "atanpi_upward": double: 1 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 4f687c762b..8aa52f4600 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -201,25 +201,21 @@ ldouble: 5 Function: "atanpi": double: 1 -float: 1 float128: 2 ldouble: 1 Function: "atanpi_downward": double: 2 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_towardzero": double: 1 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_upward": double: 2 -float: 1 float128: 2 ldouble: 1 diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps index f24c87b302..8032636808 100644 --- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps +++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps @@ -201,25 +201,21 @@ ldouble: 5 Function: "atanpi": double: 1 -float: 1 float128: 2 ldouble: 2 Function: "atanpi_downward": double: 2 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_towardzero": double: 1 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_upward": double: 2 -float: 1 float128: 2 ldouble: 1 diff --git a/sysdeps/ieee754/flt-32/s_atanpif.c b/sysdeps/ieee754/flt-32/s_atanpif.c new file mode 100644 index 0000000000..40ca9f5053 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_atanpif.c @@ -0,0 +1,109 @@ +/* Correctly-rounded half-revolution arc-tangent of binary32 value. + +Copyright (c) 2022-2025 Alexei Sibidanov. + +The original version of this file was copied from the CORE-MATH +project (file src/binary32/atanpi/atanpif.c, revision e02000e). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +#include +#include +#include +#include +#include "math_config.h" + +float +__atanpif (float x) +{ + uint32_t t = asuint (x); + int32_t e = (t >> 23) & 0xff; + bool gt = e >= 127; + if (__glibc_unlikely (e > 127 + 24)) + { + float f = copysignf (0.5f, x); + if (__glibc_unlikely (e == 0xff)) + { + if (t << 9) + return x + x; /* nan */ + return f; /* inf */ + } + /* Warning: 0x1.45f306p-2f / x underflows for |x| >= 0x1.45f306p+124 */ + if (fabsf (x) >= 0x1.45f306p+124f) + return f - 4.0f / x; + else + return f - 0x1.45f306p-2f / x; + } + double z = x; + if (__glibc_unlikely (e < 127 - 13)) + { + double sx = z * 0x1.45f306dc9c883p-2; + if (__glibc_unlikely (e < 127 - 25)) + { + float rsx = sx; + if (x != 0 && rsx == 0) + __set_errno (ERANGE); + return rsx; + } + return sx - (0x1.5555555555555p-2 * sx) * (x * x); + } + uint32_t ax = t & (~0u >> 1); + if (__glibc_unlikely (ax == 0x3fa267ddu)) + return copysignf (0x1.267004p-2f, x) - copysignf (0x1p-55f, x); + if (__glibc_unlikely (ax == 0x3f693531u)) + return copysignf (0x1.e1a662p-3f, x) + copysignf (0x1p-28f, x); + if (__glibc_unlikely (ax == 0x3f800000u)) + return copysignf (0x1p-2f, x); + if (gt) + z = 1 / z; + double z2 = z * z; + double z4 = z2 * z2; + double z8 = z4 * z4; + static const double cn[] = + { + 0x1.45f306dc9c882p-2, 0x1.733b561bc23d5p-1, 0x1.28d9805bdfbf2p-1, + 0x1.8c3ba966ae287p-3, 0x1.94a7f81ee634bp-6, 0x1.a6bbf6127a6dfp-11 + }; + static const double cd[] = + { + 0x1p+0, 0x1.4e3b3ecc2518fp+1, 0x1.3ef4a360ff063p+1, + 0x1.0f1dc55bad551p+0, 0x1.8da0fecc018a4p-3, 0x1.8fa87803776bfp-7, + 0x1.dadf2ca0acb43p-14 + }; + double cn0 = cn[0] + z2 * cn[1]; + double cn2 = cn[2] + z2 * cn[3]; + double cn4 = cn[4] + z2 * cn[5]; + cn0 += z4 * cn2; + cn0 += z8 * cn4; + cn0 *= z; + double cd0 = cd[0] + z2 * cd[1]; + double cd2 = cd[2] + z2 * cd[3]; + double cd4 = cd[4] + z2 * cd[5]; + double cd6 = cd[6]; + cd0 += z4 * cd2; + cd4 += z4 * cd6; + cd0 += z8 * cd4; + double r = cn0 / cd0; + if (gt) + r = copysign (0.5, z) - r; + return r; +} +libm_alias_float (__atanpi, atanpi) diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps index d5adc119cf..0cac55cbe4 100644 --- a/sysdeps/loongarch/lp64/libm-test-ulps +++ b/sysdeps/loongarch/lp64/libm-test-ulps @@ -162,22 +162,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps index c901b00f20..1b5bcff11e 100644 --- a/sysdeps/mips/mips64/libm-test-ulps +++ b/sysdeps/mips/mips64/libm-test-ulps @@ -162,22 +162,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps index 9934382bde..a608e3c949 100644 --- a/sysdeps/or1k/fpu/libm-test-ulps +++ b/sysdeps/or1k/fpu/libm-test-ulps @@ -120,19 +120,15 @@ double: 3 Function: "atanpi": double: 2 -float: 1 Function: "atanpi_downward": double: 1 -float: 2 Function: "atanpi_towardzero": double: 1 -float: 2 Function: "atanpi_upward": double: 1 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps index 7ff5ee4425..56986f0be0 100644 --- a/sysdeps/or1k/nofpu/libm-test-ulps +++ b/sysdeps/or1k/nofpu/libm-test-ulps @@ -93,7 +93,6 @@ double: 3 Function: "atanpi": double: 2 -float: 1 Function: "cabs": double: 1 diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps index b1c01b4d94..630111e6c4 100644 --- a/sysdeps/powerpc/fpu/libm-test-ulps +++ b/sysdeps/powerpc/fpu/libm-test-ulps @@ -206,25 +206,21 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 float128: 2 ldouble: 1 Function: "atanpi_downward": double: 1 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_towardzero": double: 1 -float: 2 float128: 1 ldouble: 3 Function: "atanpi_upward": double: 1 -float: 1 float128: 2 ldouble: 5 diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps index f55df65c6a..087dcd79fc 100644 --- a/sysdeps/riscv/nofpu/libm-test-ulps +++ b/sysdeps/riscv/nofpu/libm-test-ulps @@ -126,7 +126,6 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps index 879f5c5669..efd83affa4 100644 --- a/sysdeps/riscv/rvd/libm-test-ulps +++ b/sysdeps/riscv/rvd/libm-test-ulps @@ -166,22 +166,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps index c4a27b96ad..709debb205 100644 --- a/sysdeps/s390/fpu/libm-test-ulps +++ b/sysdeps/s390/fpu/libm-test-ulps @@ -162,22 +162,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps index fbf1507bd9..becf5da3d6 100644 --- a/sysdeps/sparc/fpu/libm-test-ulps +++ b/sysdeps/sparc/fpu/libm-test-ulps @@ -162,22 +162,18 @@ ldouble: 4 Function: "atanpi": double: 2 -float: 1 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 ldouble: 1 Function: "atanpi_towardzero": double: 1 -float: 2 ldouble: 1 Function: "atanpi_upward": double: 1 -float: 1 ldouble: 2 Function: "cabs": diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index a340df6243..8c5d4fd471 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -339,25 +339,21 @@ float: 1 Function: "atanpi": double: 2 -float: 1 float128: 2 ldouble: 2 Function: "atanpi_downward": double: 1 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_towardzero": double: 1 -float: 2 float128: 1 ldouble: 2 Function: "atanpi_upward": double: 1 -float: 1 float128: 2 ldouble: 1