Repository navigation
feat: add stats/base/dists/wald/cdf - #9709
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
Given that the CI error is not due to changes in this PR will go ahead and open it for review!! |
| z = sqrt( lambda / x ); | ||
|
|
||
| // Φ(a) = 0.5 * erfc( -a / sqrt( 2 ) ) | ||
| t1 = 0.5 * erfc( ( -z * ( ( x / mu ) - 1.0 ) ) / sqrt( 2.0 ) ); |
There was a problem hiding this comment.
Could have used stats/base/dists/normal/cdf but while writing the C implementation using normal_cdf into the equation causes discrepancy in the return values.
| y = mycdf( 8.0 ); | ||
| // returns ~0.999 |
There was a problem hiding this comment.
Throws an error if 0.998 is rounded of to 1.000 so used this instead!!
Planeshifter
left a comment
There was a problem hiding this comment.
Left a bunch of comments. Thanks!
|
@Planeshifter Updated the changes. But, benchmarks do seem to fail but runs clean locally. |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: passed
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: na
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
|
@batpigandme Do we need to update our R versions again? |
|
Looks like CI failures stem from R to varying degree. @Neerajpathak07 Was there a reason why you decided to include R benchmarks in this PR? |
|
Also, @Neerajpathak07 you should address the R lint warnings, as they are simple fixes. |
|
Something weird is going on because R 4.7 is still devel, and (much to my surprise) MASS depends on R >= 4.4. The R lint fixes should be addressable. We could update R (again, really surprised about the versioning of MASS…must be a good reason, I’ll check the change log), but no released version of a package depends on 4.7. |
|
We can definitely update to >= 4.4.0 if we need to. It looks like MASS just published a new version today (2026-07-15), so I wonder if there was a transient something that led to the 4.7 error. |
|
I am thinking we can just remove the R benchmarks altogether. They are not essential to getting this package in. |
|
@kgryte sure I'll go ahead and remove the |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: na
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
@kgryte also I was wondering why git hooks didn't catch the lint |
Likely because, at least in CI, they are only warnings, not errors. |
|
@kgryte do you still want me to upgrade to 4.4.0? |
|
@batpigandme Your call. I am not sure what is an appropriate minimum version to "support" in R world. The reality is that we are only using R for tests and benchmarks, so there is no production constraint. In which case, we are free to support what minimum version we want, at the cost of forcing devs to satisfy that constraint in their local environments. In short, I'll defer to you. 😅 |
… feedback
- Add missing x === +infinity check to the factory-created CDF (was
only fixed in main.js and src/main.c).
- Call the factory-created unary function with a single argument in
tests.
- Extend +/- infinity tests to cover the non-degenerate case.
- Align repl.txt lambda constraint with the implementation (lambda < 0
returns NaN; lambda = 0 is the degenerate case).
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
Pushed 15b227b addressing the remaining review feedback:
|
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
…feedback
- Compute the exponentially-scaled term via `erfcx`:
`exp( 2λ/μ ) * erfc( b ) = erfcx( b ) * exp( -a² )`, since
`b² - a² = 2λ/μ`. Previously, `exp( 2λ/μ )` overflowed for
`2λ/μ ≳ 709.8`, yielding `Infinity` or `NaN` for valid parameters
(e.g., `cdf( 1.0, 1.0, 400.0 )`) and intermittently failing
benchmarks which draw `μ` near `EPS`. Applied to JS main, factory,
and C implementations; `erfcx` added to manifest dependencies.
- Bump fixture ULP tolerance from 4 to 5 (max observed diff with the
reformulated expression).
- Exercise the created function's own `NaN` and `x <= 0` branches in
factory tests (previously only degenerate/invalid-parameter paths
were hit) and add dedicated nonpositive-`mu` tests to main, native,
and factory suites; avoid conflating invalid `mu` with other failure
causes in NaN tests, repl.txt, and TypeScript declaration examples.
- Annotate `mu` as `{PositiveNumber}` in JSDoc; document `mu <= 0`
constraint and add nonpositive-mean and degenerate examples to the
TypeScript declarations.
- Use Greek `μ` (U+03BC) instead of micro sign (U+00B5) and `F(x;μ,λ)`
(CDF) instead of `f(x;μ,λ)` in printouts; capitalize "Wald".
- Replace standalone "inverse"/"gaussian" keywords with
"inverse gaussian"/"inverse-gaussian" per sibling packages.
- Remove unused `LEN` define and restore standard C benchmark Makefile
boilerplate.
- Sync Julia fixture runner docstring with actual generation code and
fix test message spacing.
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: missing_dependencies
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
PR Commit MessagePlease review the above commit message and make any necessary adjustments. |

Progresses #209.
Description
This pull request:
stats/base/dists/wald/cdfRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers