From patchwork Wed Mar 27 16:45:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 783146 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2301740wrt; Wed, 27 Mar 2024 09:51:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHbipckZ7hizj4yKycy/ivGUQ5yQSXHJFDi4pcbsmt2YCsn9cLwD1i61De4KKdzJubVIjCgcrmXuWdjsz4+24F X-Google-Smtp-Source: AGHT+IGRcjXqACK2WU5r7ng6BaH+xjRk6VGrEqWIr1nizNSp2FUbEU9l1TT7OoymCEyEOxqQxhl7 X-Received: by 2002:a05:622a:245:b0:431:4983:885d with SMTP id c5-20020a05622a024500b004314983885dmr195661qtx.33.1711558264883; Wed, 27 Mar 2024 09:51:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711558264; cv=pass; d=google.com; s=arc-20160816; b=P1cD/LacAU/ETe9i2dLGdUqadd6ocph7GFo3jfE77tWhScd6KX+rJuWdQikEFzgiy7 w1OPtwoZ3AnubzQFJLxHLArejR1sX6lGIuUAnVtF60fMHB/kHX9J7LIf52PFyF+BzuET 8fHeCvPJ0BGPl8d6PqZAQhB604D/zvSi/TS4oTUE9G7AEb4KdWyley/MiCVg6UKmvzcC GvxZXyCCb6bNZBt6BNznlvc21dtIBhKqBeCfs5doilIEklx71YjxRjfsC59cAJgBf+DQ fVChjAj1FiwS6nkMayF8UDnQSvjdLqUFLBoBYZZ3j/Mp85is3+wj10+a/B/RJ893Lph4 EjKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oNW9JRi+n1bRpdFaZUcEXP6xRQd7PQT+ja4l492NHQU=; fh=WtLnUd2EuDKv+EP3BSdEI8hdivapDDAq3MY9+WgWrlk=; b=CW+5/FEXlEe1tAth/KcPYbJpmCwVR8Vt2HtT+xCOYVByYj6LkfVWcAK3adxcpO8k3t afe7Ni1PLeBxNTl9yrfO2kzWCMYP7cOp333ZCdG18wrjUfopGck9G8ph+wiAzbxUn/Cz z7oXv994pOYnbAL7h6OGJvQH50812iXPpxmfJXSO7YM8Uw8RyO9NrofAn6Yguc1DusPf w+aDIbqI9yz5sKC8GE273pE+E7RXF7N8agCHAhPAF4vZ77Ep1NVmUOGCL6yLkt8WVwLF qpTio38PBRbs8KrM1aDlJABKwpHt41F3OGuz1skqRmfY+szNl4JvZB1c8n6iLo85Kxky hOrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4oggJMa; 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 hg1-20020a05622a610100b00430d4cdebc4si9708436qtb.289.2024.03.27.09.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:51:04 -0700 (PDT) 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=S4oggJMa; 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 7F2C63858C55 for ; Wed, 27 Mar 2024 16:51:04 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 73975385E446 for ; Wed, 27 Mar 2024 16:45:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73975385E446 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 73975385E446 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711557962; cv=none; b=vBk9MmfcfrvjZRa4dUYJuzaMF/qiVGKIeVj93H0qjyStFi89+phBE3U3m37ntVf6ZXo1tGAEaYfdWCr1+m8KGQ8upWxWEJNIe4w4kRPAw1t0zx0Qw2lZC0ad9gW5hCPn32yaJUC0sV5jZBCe538l7yxQdHmlhyijvhoa65lT+BQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711557962; c=relaxed/simple; bh=RjHRhGP/pIRZOxjZfNvDZ1XPORsgV8/EYTiLPgAY00U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=bqwKe6QWTc2g5o6wdqRp7z0uObT5eK6gDuAhyE0CsHMnnGLzTJGVN7c4hepggGLKnYg3Swq/ABeIIrNXjgyl9euXWvR2Ko83cARqDY6f+u3wBvVDqvbiDQMWFrY2hiwDJMbOnZh9E8ZNcni4tRv9a9WnHBY59ikdSUaDW0/3ero= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1df01161b39so187385ad.3 for ; Wed, 27 Mar 2024 09:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711557958; x=1712162758; 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=oNW9JRi+n1bRpdFaZUcEXP6xRQd7PQT+ja4l492NHQU=; b=S4oggJMa+wsqsmuZL9aybAE3janMVYHFJGX9pIRY4JXMVOMW7TJ4/bx3Y6RCPVixPD d6fmPTfgXd/0qvTebxQOZR2ggJwQ2DtaE4eIaKPpR7SFmdaAXaq8UmCgXnlBwByh8PDW rkS96OU8ezPOz8LYq5xidXBNAzbpZ9C/9qDiCy27Pxy6I/OYKbm3sgOwn98P+SbwAK4N N4vLyCV/SK0jc9ZfLue9PDgAOLsSC2kTsJVxxU6wh4l9J94+P6FuIUtV85AnITqjeTBA 0JI+MiBov7IwmDw6DIUNoocpTHYIxPOL0SKJKkNEJ59sL2BukgcKbWI8xkW7qgY/etNn +oqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711557958; x=1712162758; 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=oNW9JRi+n1bRpdFaZUcEXP6xRQd7PQT+ja4l492NHQU=; b=dxdyV5uQtUR9cWKoxpm1yzFx0ulCgCjInpnyszGhIL+R6Ycj8v7/aHYsdJsLYe/et5 nGcAnreo++iOqqD/2RiRuNeSJ8neuXUaUdeTfwXHviKT6v0jNoj1RwOkFA+vC4mLwLzj axH49FhwacjSZ1lEuxCGWxchbD0jPb+N9j1NYNFUijio29NcyTzCjH4qVoUqVYOEjpqV BzxtU8ENwS5gmRX4pAVQVhxGTuAWkFm+v9a9wtwBy6fSIxhOTq9071qimcosCYit3mqD 7RFh0pFgVHDcaTRJz3L44lxlDecCzXLEXDXegO3T14mCwW8P2fa5NImlGbEUPO6R16mW 8K4w== X-Gm-Message-State: AOJu0Yz31e2AnQ4jOF9ADIrtdnlDr+qcdyOwwDFOx8mi8sEl3wwOTJgX zTvp5Zwr6ntbUSTRsfuWUpZaI7u17A+3eOVmUEVqQgZV0Mwe0nu3USHx+//OvADWMPoxY9dEFiB w X-Received: by 2002:a17:902:7248:b0:1e0:afbb:7a89 with SMTP id c8-20020a170902724800b001e0afbb7a89mr209266pll.22.1711557958094; Wed, 27 Mar 2024 09:45:58 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:b18e:67c4:6248:3d8a:f386]) by smtp.gmail.com with ESMTPSA id c4-20020a170903234400b001e20578b524sm858593plh.252.2024.03.27.09.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:45:57 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Joseph Myers , Florian Weimer , "H . J . Lu" Subject: [PATCH 12/15] math: Fix log10 template for inputs less than 0 Date: Wed, 27 Mar 2024 13:45:24 -0300 Message-Id: <20240327164527.3717523-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240327164527.3717523-1-adhemerval.zanella@linaro.org> References: <20240327164527.3717523-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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 template is used by some ABIs for the static build, and it fails to correct set the floating exceptions if the argument is less than 0. Checked on x86_64-linux-gnu. --- math/Makefile | 1 + math/w_log10_template.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/math/Makefile b/math/Makefile index 2b2683a9fa..aa57171f77 100644 --- a/math/Makefile +++ b/math/Makefile @@ -370,6 +370,7 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ libm-test-funcs-auto-static = \ acos \ exp10 \ + log10 \ # libm-test-funcs-auto-static libm-test-funcs-noauto-static = \ copysign \ diff --git a/math/w_log10_template.c b/math/w_log10_template.c index aca38d4e1e..cc7b503f01 100644 --- a/math/w_log10_template.c +++ b/math/w_log10_template.c @@ -32,11 +32,19 @@ M_DECL_FUNC (__log10) (FLOAT x) if (__glibc_unlikely (islessequal (x, M_LIT (0.0)))) { if (x == 0) - /* Pole error: log10(0). */ - __set_errno (ERANGE); + { + /* Pole error: log10(0). */ + __feraiseexcept (FE_DIVBYZERO); + __set_errno (ERANGE); + return -INFINITY; + } else - /* Domain error: log10(<0). */ - __set_errno (EDOM); + { + /* Domain error: log10(<0). */ + __feraiseexcept (FE_INVALID); + __set_errno (EDOM); + return NAN; + } } return M_SUF (__ieee754_log10) (x); }