From nobody Fri Apr 12 22:17:26 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VGWCB2nM3z5GFPY; Fri, 12 Apr 2024 22:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VGWCB26DVz4pv4; Fri, 12 Apr 2024 22:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712960246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oNPUo56cQSeBk8Emzgf/9TyCgdeCOt319gS4/UBYqfU=; b=qKcSbRHtjX/O/ZO4ys634WKbsyl5kFLWfrxtNudUD/1MR68hdWDclLTMTiJJak34cF4N2i Zc7MnVYFzaY46D+ZS6lBV44G5sg4toPovnaU2tpwfdLzffwHot0Y3c2dfRUcyzE16xqIp8 MhUzUP0nSRIVfxIO/cbIEj45rQK2YkH/IEIIjAjBcLuWTbMFmhKqOZt+7dujSpSQz8JZ9k S8iPzhF5XTFcoUyKoXyrOcJtBbIIW9Z6BNyg8X+0+I1m6hVmu7wScb9hxIgMy4hDJF7bO0 fElvnwE1H0VgDKyGLlg2syZNlN8KcW2tHxVLkP1Hdoa3tcKfq0NCK+hHpdzawQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712960246; a=rsa-sha256; cv=none; b=hqenwTUji9libe8Uby38bcTQecHvznvlm75EJFHbGOKaT2iGQiqjWJj0lHiOyXclRSrQIs qMFFbVzhbF9/roC6RDpnWOPVasCXWPQUh1/cVNGrVg0LhbPg6al6i9G8d4vIyfJd8ZcFzI xzB6Kq/FRzgZNtfhqX6vMPb5qup6HfEZ9joBEMVyXTzdq+jJAK0D0hR7jBzHR2q0KkNF3R GeDP5NOziJIKEyWChT5P6aHFMttB5H+mvZAzkpd1t1vwSuB6WMtbUDfNSvXkSNhuACSjaW /14EHKV3xinv3g5+UMkpwqolqBDv+ZAjisUhL4jMMrW1gR4ULX/tAwp/KJc85g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712960246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oNPUo56cQSeBk8Emzgf/9TyCgdeCOt319gS4/UBYqfU=; b=g+ezMSL7r+w5R49lmb6ZX7Bc7NSLCTymkUtiG6E5FTMdr7nVZH2MYpcnKV05UYoizxlFYh tpKBbkvT3aVjL936rjapb2qG1EMXKaSR9+htlhCGPQHAIJGBTYz6b3O+T1R/tGPRcgAe43 Ygl/3awej4WGg1BXvX52TXdGY2TsYhd2shOothto1mY6c3h8fN1BdMHqzAvyNjdHBpdlkR mMJlpPRf76JUjgA1CgLt0592HMIO89ANrLizvhnMD2z6eKa6RnzLhgR0qJRCAhyHw8KDKw Wj+L6I/DJUK8WQacoU40CkgpK/KwQ1cihoATPCwQ2TBA2paz/+3mi0xMQI6RiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VGWCB1bZKz16dQ; Fri, 12 Apr 2024 22:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43CMHQLZ084188; Fri, 12 Apr 2024 22:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43CMHQ5f084185; Fri, 12 Apr 2024 22:17:26 GMT (envelope-from git) Date: Fri, 12 Apr 2024 22:17:26 GMT Message-Id: <202404122217.43CMHQ5f084185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2b2cd97844b8 - main - msun: Fix math error in comment explaining y reduction List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b2cd97844b81e4a45504c90a791c3c3509898ad Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2cd97844b81e4a45504c90a791c3c3509898ad commit 2b2cd97844b81e4a45504c90a791c3c3509898ad Author: Henri Chataing AuthorDate: 2024-04-12 22:08:01 +0000 Commit: Warner Losh CommitDate: 2024-04-12 22:15:04 +0000 msun: Fix math error in comment explaining y reduction x = k + y for some integer k and |y| < 1/2 exp2(x) = exp2(k + y) = exp2(k) * exp2(y) which can be written as 2**k * exp2(y) The original had x = 2**k + y, which is has an extra 2** in it which isn't correct. Confirmed by forumula 2 in Gal and Bachelis referenced in the comments for the source of this method https://dl.acm.org/doi/pdf/10.1145/103147.103151 The actual code is correct. Reviewed by: imp (who added s_exp2.c and wrote the commit message) Pull Request: https://github.com/freebsd/freebsd-src/pull/1127 --- lib/msun/src/s_exp2.c | 2 +- lib/msun/src/s_exp2f.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msun/src/s_exp2.c b/lib/msun/src/s_exp2.c index 338312f0de97..2064d22f44f3 100644 --- a/lib/msun/src/s_exp2.c +++ b/lib/msun/src/s_exp2.c @@ -314,7 +314,7 @@ static const double tbl[TBLSIZE * 2] = { * Method: (accurate tables) * * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. + * x = k + y, for integer k and |y| <= 1/2. * Thus we have exp2(x) = 2**k * exp2(y). * * Reduce y: diff --git a/lib/msun/src/s_exp2f.c b/lib/msun/src/s_exp2f.c index 85edd611944e..c863b7512194 100644 --- a/lib/msun/src/s_exp2f.c +++ b/lib/msun/src/s_exp2f.c @@ -72,7 +72,7 @@ static const double exp2ft[TBLSIZE] = { * Method: (equally-spaced tables) * * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. + * x = k + y, for integer k and |y| <= 1/2. * Thus we have exp2f(x) = 2**k * exp2(y). * * Reduce y: