[RFC]: Migrate `math/base/special` packages from relative tolerance testing to ULP difference testing (tracking issue)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript
- 領域
- testing-qa
調査の方向性
まずコミット 121f2c0 と @stdlib/assert/is-almost-same-value のドキュメントを調べ、次に math/base/special 配下の test/ フォルダーを検索して、相対許容値のケースを使用しているパッケージを探します。1つのパッケージだけのテストを移行し、動作を維持して、最小の ULP 値を使用します。make test TESTS_FILTER="./math/base/special//." を実行し、すべてのケースがパスすることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Instructions
- Read the issue description below.
- Read the issue comment which follows the description.
- Search for a package in
math/base/specialhaving relative tolerance tests which needs updating according to the description below. - Follow any additional guidance specified in this issue.
Description
This RFC proposes migrating from Relative Tolerance testing to ULP Difference testing for math/base/special functions.
In short, this RFC seeks to refactor testing from, for example
var abs = require( '@stdlib/math/base/special/abs' );
var delta = abs( y - expected[ i ] );
var tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y );
to
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
The migration is demonstrated in commit 121f2c0
In particular, notice three things:
- We add the import
@stdlib/assert/is-almost-same-value. See the documentation for@stdlib/assert/is-almost-same-valuefor supported parameters. - We remove
var delta = abs( y - expected[ i ] );andvar tol = EPS * abs( expected[ i ] ); - We replace
t.ok( ... );witht.strictEqual( isAlmostSameValue( v, expected[ i ], 1 ), true, 'returns expected value' );with the returned output, expected value and the minimum required ulp value. Also, make sure the message is'returns expected value'for every test case.
By performing this refactoring, we facilitate
- Measuring error in units of the representable gap at that magnitude, which is the natural accuracy unit for floating-point.
- Enables a uniform accuracy budget
- Easier to test both real and complex functions, across single-precision and double-precision, with consistent and trustworthy rules.
Note: In certain functions, we may encounter different return values in the JavaScript and C implementation for the same implementation. In that case, refer to this commit 69e1068. This was discussed here in detail FAQ.
Steps
Given the relatively widespread practice of using relative tolerance in testing, this RFC aims to be an open call for any contributor wanting to contribute to the project to do the following:
- Study the changes made in commit 121f2c0, as this commit contains the sorts of changes that we are looking for.
- Ensure you have setup your local development environment by following the contributing guide, including
make install-node-modulesandmake init. - Study the documentation for
@stdlib/assert/is-almost-same-value. - Find a package containing relative tolerance test cases.
- Update the test cases for that package, and only that package, to migrate to use ULP difference testing. Make sure that you put the minimum required ULP value possible. Tests can be found in the
test/folder of a package (if it exists). - Run tests locally using the command
make test TESTS_FILTER=".*/math/base/special/<package-name>/.*". For example,make test TESTS_FILTER=".*/math/base/special/hyp2f1/.*". - Verify that the updated ULP values pass all the test cases.
- Commit your changes.
- Submit a PR updating the test for that package (and only that package).
- For the PR title, use the following template "test: migrate
<package-name>to ULP-based testing" where<package_name>is the name of the package you updated (e.g.,math/base/special/hyp2f1). - In the PR body/description, use the phrase "Resolves a part of ", and not "Resolves " or "Closes ", this issue, as this is a tracking issue and your PR only addresses one package of many needing updating.
Related Issues
None
Questions
None.
Other
- If you are interested in working on this RFC, for each pull request, please only update the tests for a single package.
- As mentioned above, please do NOT make extraneous changes to test cases. We are not interested in changing tests wholesale. Nor are we interested in new "creative" changes. We are only interested in migrating from relative tolerance testing to ULP diff based testing Failure to match the behavior of the existing tests and to respect this guidance will result in your PRs being automatically closed without review.
- As this is a "Good First Issue", you are strongly encouraged to avoid using AI when authoring your contribution. One of the primary intents of Good First Issues is to help introduce you to stdlib, its development environment, and the contribution process, as documented in the contributing guide. Most new contributors are unfamiliar with stdlib and its conventions, and thus fail to appropriately use LLMs and AI when authoring contributions, most often generating AI slop and leading to wasted time. Don't be one of those people. :) Take the time to manually author your first several PRs, and, once you are intimately familiar with project conventions, you can consider leveraging AI to augment your dev tasks.
Checklist
- I have read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- The issue name begins with
RFC:.
- 主要言語
- JavaScript
- スター
- 6k
- フォーク
- 1.3k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 586
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stdlib-js/stdlib のほかの issue
-
Fix JavaScript lint errors対応中かも @lb1192176991-lab が 2 日前に担当しました。 オープンGood First Issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
stdlib-js/stdlib#15831 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`@stdlib/string/base/percent-encode` produces malformed encoding and silently drops characters対応中かも @barbierajput378-pixel が 7 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
stdlib-js/stdlib#15595 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: kumaraswamy/kurtosis returns non-excess kurtosis (missing −3)対応中かも @Planeshifter が 7 日前に担当しました。 オープンBug Statistics
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stdlib-js/stdlib#15461 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: rayleigh/mgf returns wrong values due to misplaced parenthesis対応中かも @anandkaranubc が 9 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stdlib-js/stdlib#15456 · コメント 6 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
@stdlib/array/fixed-endian-factory allows misaligned byte offsets and fractional lengths対応中かも @kanikasharma-18 が 22 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
stdlib-js/stdlib#15193 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
stdlib-js/stdlib の issue をすべて見る
似ている issue
-
[quality] useFocusTrap's Shift+Tab wrap and non-Tab/non-Escape key arms are never driven end to end対応中かも @hivecommons-hive が今日担当しました。 オープンagent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
githubnext/gh-aw-workshop#4220 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
JuliusBrussee/caveman#1189 ·
メンテナーはふだん 1 日以内に返信
-
priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenHands/extensions#738 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
invoiceninja/invoiceninja#13320 ·
メンテナーはふだん 1 日以内に返信