Repository navigation
test: migrate math/base/special/ellipj to ULP-based assertions - #15264
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
| tol = 40.0 * EPS; | ||
| t.strictEqual( delta <= tol, true, 'within tolerance. u: '+u[i]+'. m: '+m[i]+', dn: '+dn+'. E: '+dnExpected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); | ||
| } | ||
| t.strictEqual( isAlmostSameValue( sn, snExpected[ i ], 4750 ), true, 'returns expected value' ); |
There was a problem hiding this comment.
@Devansh-18155 How did you derive these ULP diffs? Given the previous deltas (e.g., 18*EPS), I am surprised by these large ULP differences.
There was a problem hiding this comment.
This same comment applies to several other test assertions.
There was a problem hiding this comment.
@kgryte ,Large ULP diffs because the previous test checks difference (18 * EPS), while isAlmostSameValue checks ULP, As an deltas of 2.3 * EPS which makes approx 4750 ULP.
I derived it by checking max ULP diff across dataset and we can keep this limits!
There was a problem hiding this comment.
This still doesn't seem right. 1 unit of epsilon is roughly equal to 1 ULP, so, again, this large divergence is surprising. Can you provide exact test values demonstrating the large ULP difference?
There was a problem hiding this comment.
@kgryte ,
Taken a test case from medium_positive_modulus.json :
- u : 5.006645997054875
- m : 0.8826190324290656
- Computed sn : -0.000761851982413601
- Expected sn : -0.000761851982414116
- Difference : 5.15 e-16 ( approx 2.3 EPS)
The value is small (0.0007), 1 ULP is 1.08e-19. So difference is 2.3 * EPS in terms, it takes 4750 ULPs.
1 ULP =1 EPS but, if the numbers are closer to zero the ULP shrinks as well.
There was a problem hiding this comment.
Oh, I see. The tolerances were previously computed incorrectly. They should have been scaled by the expected value.
Resolves a part of #11352
Description
This pull request:
@stdlib/math/base/special/ellipjfrom relative tolerance testing to ULP difference testing using@stdlib/assert/is-almost-same-value.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
I used AI assistance to calculate minimum required ULP values.
@stdlib-js/reviewers