From patchwork Mon Feb 3 12:43:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 861551 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp1998001wrr; Mon, 3 Feb 2025 04:43:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlbMSAZmRhiOwlJN89oTJ2yhatFz+Ei7XjMfIR43DljxYktyYE1R7CmxfLQobu67R6E/0eFA==@linaro.org X-Google-Smtp-Source: AGHT+IGmSQOBUfp4okZsod/IolTT8dToc7koCWwIYvEovL+UCYmZ+bTf4fxUaQbvtWkWlVtQwIvO X-Received: by 2002:a05:622a:15cf:b0:463:4bb6:bfe2 with SMTP id d75a77b69052e-46fd0bd3575mr294014061cf.50.1738586630250; Mon, 03 Feb 2025 04:43:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738586630; cv=pass; d=google.com; s=arc-20240605; b=Wj6odacOy3MgwENeuFkOD0rphOe0XB59e6mgB8MDwZ0E5fDeuPaj8heB5I/7LrHukS pC6FQUqxfBOqEms56r1uVRMrbmjCpMBx+cJU6AjBSLdy0RZOH9je+lhmu3Np2/KTUcpD uLMRU0SGSegnnClpv8R7aAb8jBhmCFA39SsZPKjhuixLeTzFNRX8usWGuemuOl/5zcWs 9gpHO/WG+XLS/Ha9IOpy7oh1WlRV/Bzl7l6TSvZGb8sDQa7g6Out5RMz4HbE4kzNtK9d SuCfe0nTaPC8hDlrj7LC+2b+E0NVA2k9Nkyebv7iEcE24tTL6Dp3GYGD/UMpwvyprlLu aIhw== 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:message-id:date:subject:to:from:dkim-signature :dkim-filter:arc-filter:dmarc-filter:delivered-to:dkim-filter; bh=Os81pRF8ngIWrk+iMAkg055p+ICAGYWjbpE5v5FcfRs=; fh=dHLBnA+MhGtNtN2B2JMAELi4oD+gmgMg7DL8H0jYbkI=; b=V7lM3iqNShO7Av3yi5H+OyphPw80EtY5WyoxgpFhCCICYhLHl1XKoA2LS+ImxaIovL NRNCp1XX+0xIYsdnSVikRnHgGn0C4ld05/Fzdrtp5AlF7U1HzSswEs820l4vKQTVR2vK tewh/9JR7HyNP98mS9/kRRYwJvUNf9iesPfPlxB2/YzzQPvrLYSCYS9T6+qz1D6Qwmab Z3R28+AdaNsx/x7qYqQWavAzNZYX9QMf0lBb3CK7yh/Z7StU5if3GCjBGEak6cF1OgqL sEmnkT6cP55VZGWNm5REMTrVZyIpmsmD2SakzBTSGnuZoW23/XLqljQQyzEUySM0egoe RW3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n6sZWlj2; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d75a77b69052e-47016ba12f2si399501cf.395.2025.02.03.04.43.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 04:43:50 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n6sZWlj2; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 D0F3B3858C33 for ; Mon, 3 Feb 2025 12:43:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0F3B3858C33 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n6sZWlj2 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id C001A3858D38 for ; Mon, 3 Feb 2025 12:43:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C001A3858D38 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 C001A3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738586613; cv=none; b=IQRN+P+SbySpG8P1M5FAz2GDKf0S0PnYv8laOst+HpGHMONx15vnBTG+B8Tn1bfyNxGHFmoef+86ORU9IakrjUuTJ8vM28kpcpukBk3jYCeqqGJmb1y4ImtJ6XFLg4BS+NhdEgq4t/DQc50SsCPsnYWTreJA8Fu+DijuWQ/GozU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738586613; c=relaxed/simple; bh=sR4mPOb/2d6YVHQQRA1LfFP2hLCBrIIDMvQxdnnJnPk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DgmU0HAf8xIxfjii/iycWZ/a0Vy82n2EHilv66qiUPO65DiROKV+LxYVMD6+/874pDS1fyue3yFdhD720thOLjJSQxld0Yjjh11eBL6LIuaj7+ONPHuCUH7fv9uiGEWGvwLoMOz9DfSZfUnuzbE7GUt1fOGPjh/wqHoQ4BUFBvE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C001A3858D38 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2163b0c09afso72647985ad.0 for ; Mon, 03 Feb 2025 04:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738586611; x=1739191411; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Os81pRF8ngIWrk+iMAkg055p+ICAGYWjbpE5v5FcfRs=; b=n6sZWlj2Viyppb2SKGPxlsKEQggAT+b9VC8x67N5GSxxmWQQoZOzv7HVj24DDmxCzr uf1CXs8QC4qJZiO+gVPpvrtSHwygKBtBFPIWgaR9VLtedAZ14DbbR3Dv/5HXqum7KU05 d+Y0k/3d9wkhLMjJgJdnFAZk2ukS4K+ZubyWbmFcsZC8OTpw6+ug78Pa1NPseZ+J9Q1E 4/5/a7Nd6qWGT2CgOCSc0P8j/1thXqkYbCMtcc28vxr7dLtWIANRZT3urWUuugC5iCZC VNIP7qR8HBgRn2aUbqkobW+GpwAhMzhN/M5ZYqD9dvpO5ipz6wacypK2mKfl2Ik4YQFg VTLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738586611; x=1739191411; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Os81pRF8ngIWrk+iMAkg055p+ICAGYWjbpE5v5FcfRs=; b=bNzyTdTn8QH5OJ96i4RNXz4D6XMlkAE5N54KjOzqRTldhilYDvzBk5SXq/c+KlgAAQ Z38NxCUa4iRQTdUcoNb7CGYfCWZ5eDGrTgwBBmLNU5/73jCJpFN/CkzMWySjLQS2GfOx Ehb36Dxz1BQgvHqWap3gE8srO128fsMCMx5Z+2wYP4MZ32oavHJMFkLKTs4ty9EESXgV xxgkUE5chhct5L9DANjEQ2+8f0WOt9ubnVfUUMqR/RI0B3Z/h2QbNHrfGHlcbVRqu4KB PNQuKxp0rIajYhHXhg9Y3ePQja20jRwqJmlux/l5+n2h4D6a8ffZuCdGEnM2PPoT/gye mBew== X-Gm-Message-State: AOJu0YwwaBfYjfvG0b7h5uZV57u2qKa1XaT8rH2mphNBk439pCZUFWF4 pqE2oqtLfU0xUoYzKC9ozMFwZ/XPdu39Knkmz+qNI371npFljGYU5rfd9yJ37jRKh/kb9GLohHl 6 X-Gm-Gg: ASbGnctzkNjNZY3fg0Dc/1UwUfTJ28YlaLKVrPnoVuFZlCgULLmwR4oYEn7tdaBiMZn hv3ZgGl4/6X3z4yOctm8s2aOhVcUdNwm5TT0Yj3iSQc39D5NdTFA9/nJlUZP9K+JgdECKQ44EVh Yc+G8cv2JJWxClI5YOQd9/CFUwqdijwkOZrkij60cGWB2vzVBTT4hqdLb7zyqj/zPH5+aE/31mj aMCJPPLWEbHe2VRxJCDVnBVHBhiSiyWEpah07v40tO1wpLimH8xAOztS71whhAkK/fLNHr4vnSN 9ewbPCWTvEXGD3FPGZxgvyZfuX9f X-Received: by 2002:a05:6a00:a89:b0:725:df1a:285 with SMTP id d2e1a72fcca58-72fd0c14ac6mr30786999b3a.12.1738586610744; Mon, 03 Feb 2025 04:43:30 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:c933:607e:86e7:ad01:7e9c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72fe6a1d212sm8475517b3a.179.2025.02.03.04.43.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 04:43:30 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [COMMITTED] math: Fix tanf for some inputs (BZ 32630) Date: Mon, 3 Feb 2025 09:43:23 -0300 Message-ID: <20250203124323.3497179-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 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 logic was copied wrong from CORE-MATH. --- math/auto-libm-test-in | 1 + math/auto-libm-test-out-tan | 25 +++++++++++++++++++++++++ sysdeps/ieee754/flt-32/s_tanf.c | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 5f465b31f1..4f194da19d 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -8664,6 +8664,7 @@ tan 0x1.1ad374p+0 tan -0x1.0d55b8p+0 tan 1.57079697 tan -1.57079697 +tan 0x1.ada6aap+27 tan 0x1p-5 tan 0x1p-10 tan 0x1p-15 diff --git a/math/auto-libm-test-out-tan b/math/auto-libm-test-out-tan index 7d00d03e1d..1d5999ab90 100644 --- a/math/auto-libm-test-out-tan +++ b/math/auto-libm-test-out-tan @@ -2532,6 +2532,31 @@ tan -1.57079697 = tan tonearest ibm128 -0x1.921fc00ece4f02f278ade6ad9fp+0 : 0x1.7b91a0851bbbafa14cf21c2b5c8p+20 : inexact-ok = tan towardzero ibm128 -0x1.921fc00ece4f02f278ade6ad9fp+0 : 0x1.7b91a0851bbbafa14cf21c2b5cp+20 : inexact-ok = tan upward ibm128 -0x1.921fc00ece4f02f278ade6ad9fp+0 : 0x1.7b91a0851bbbafa14cf21c2b5c8p+20 : inexact-ok +tan 0x1.ada6aap+27 += tan downward binary32 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan tonearest binary32 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan towardzero binary32 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan upward binary32 0xd.6d355p+24 : 0x3.d0060cp-4 : inexact-ok += tan downward binary64 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan tonearest binary64 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan towardzero binary64 0xd.6d355p+24 : 0x3.d00608p-4 : inexact-ok += tan upward binary64 0xd.6d355p+24 : 0x3.d006080000002p-4 : inexact-ok += tan downward intel96 0xd.6d355p+24 : 0x3.d006080000000504p-4 : inexact-ok += tan tonearest intel96 0xd.6d355p+24 : 0x3.d006080000000508p-4 : inexact-ok += tan towardzero intel96 0xd.6d355p+24 : 0x3.d006080000000504p-4 : inexact-ok += tan upward intel96 0xd.6d355p+24 : 0x3.d006080000000508p-4 : inexact-ok += tan downward m68k96 0xd.6d355p+24 : 0x3.d006080000000504p-4 : inexact-ok += tan tonearest m68k96 0xd.6d355p+24 : 0x3.d006080000000508p-4 : inexact-ok += tan towardzero m68k96 0xd.6d355p+24 : 0x3.d006080000000504p-4 : inexact-ok += tan upward m68k96 0xd.6d355p+24 : 0x3.d006080000000508p-4 : inexact-ok += tan downward binary128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c15ap-4 : inexact-ok += tan tonearest binary128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c15ap-4 : inexact-ok += tan towardzero binary128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c15ap-4 : inexact-ok += tan upward binary128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c15cp-4 : inexact-ok += tan downward ibm128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c1p-4 : inexact-ok += tan tonearest ibm128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c1p-4 : inexact-ok += tan towardzero ibm128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c1p-4 : inexact-ok += tan upward ibm128 0xd.6d355p+24 : 0x3.d0060800000005067d16c1c9c2p-4 : inexact-ok tan 0x1p-5 = tan downward binary32 0x8p-8 : 0x8.00aabp-8 : inexact-ok = tan tonearest binary32 0x8p-8 : 0x8.00aacp-8 : inexact-ok diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c index dfe56fc2a0..5ee1d6f35e 100644 --- a/sysdeps/ieee754/flt-32/s_tanf.c +++ b/sysdeps/ieee754/flt-32/s_tanf.c @@ -166,7 +166,7 @@ __tanf (float x) uint32_t sgn = t >> 31; for (int j = 0; j < array_length (st); j++) { - if (__glibc_unlikely (asfloat (st[j].arg) == ax)) + if (__glibc_unlikely (asuint (st[j].arg) == ax)) { if (sgn) return -st[j].rh - st[j].rl;