feat: add math/base/special/erff#10218
feat: add math/base/special/erff#10218officiallyanee wants to merge 4 commits intostdlib-js:developfrom
math/base/special/erff#10218Conversation
---
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: passed
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: passed
- 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
---
erffmath/base/special/erff
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
/stdlib update-copyright-years |
---
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: passed
- 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
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- 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
---
gunjjoshi
left a comment
There was a problem hiding this comment.
Thanks for working on this, @officiallyanee. We can revisit this PR once @stdlib/math/base/special/expf is implemented.
| // Prevent compilers from erroneously constant folding | ||
| static const volatile float tiny = 1.0e-30f; |
There was a problem hiding this comment.
@officiallyanee We do not directly use these constant declarations and initializations as given in the reference implementation, like what you have done here. Instead, you can follow how we do the same thing in the double-precision implementation, i.e., in https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/erf/src/main.c#L41
| static const float | ||
| half = 0.5f, | ||
| one = 1.0f, | ||
| two = 2.0f, | ||
| erx = 8.4506291151e-01f, // 0x3f58560b | ||
| efx = 1.2837916613e-01f, // 0x3e0375d4 | ||
| efx8 = 1.0270333290e+00f; // 0x3f8375d4 |
There was a problem hiding this comment.
Same comment for all these constants. See https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/erf/src/main.c#L45
| * Define prototypes for external functions. | ||
| */ | ||
| extern float expf( float x ); |
There was a problem hiding this comment.
This is not what we want. Instead, we need to use @stdlib/math/base/special/expf, once we have implemented it. Till we do not have expf, we might not be able to move forward with erff.
There was a problem hiding this comment.
hello thanks for your review,
i saw it being used for coshf that also depends on expf so i went ahead with it. Are there any particular usecases where its fine to use and where its not?
math/base/special/erffmath/base/special/erff
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves #729 .
Description
This pull request:
math/base/special/erff.Related 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
used for understanding https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/s_erff.c?view=markup
@stdlib-js/reviewers