-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add constants/float16/fourth-root-eps
#9610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: add constants/float16/fourth-root-eps
#9610
Conversation
---
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: 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: passed
- 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: 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
constants/float16/fourth-root-eps
|
|
||
| #### FLOAT16_FOURTH_ROOT_EPS | ||
|
|
||
| [Fourth root][nth-root] of [single-precision floating-point epsilon][@stdlib/constants/float16/eps]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [Fourth root][nth-root] of [single-precision floating-point epsilon][@stdlib/constants/float16/eps]. | |
| [Fourth root][nth-root] of [half-precision floating-point epsilon][@stdlib/constants/float16/eps]. |
| var pow = require( '@stdlib/math/base/special/pow' ); | ||
| var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var pow = require( '@stdlib/math/base/special/pow' ); | |
| var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); | |
| var pow = require( '@stdlib/math/base/special/pow' ); | |
| var sqrt = require( '@stdlib/math/base/special/sqrt' ); |
you need to use the double-precision version for the test and then convert them to float16.
| }); | ||
|
|
||
| tape( 'the exported value equals the fourth root of the difference between one and the smallest value greater than one which is representable as a half-precision floating-point number (2**-10)', function test( t ) { | ||
| var expected = float64ToFloat16(sqrtf(sqrtf(float64ToFloat16( pow( 2.0, -10.0 ) )))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect sqrtf represents a float dtype and wrapping float64ToFloat16 around doesn't give out the half-precision value.
| /** | ||
| * Macro for the fourth root of half-precision floating-point epsilon. | ||
| */ | ||
| #define STDLIB_CONSTANT_FLOAT16_FOURTH_ROOT_EPS 0.1767578125f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove the C header files as stdlib_float16_t which cannot be readily supported in a macro as of now.
|
@aryan7071 Left a few comments. Also, do double check if the return value fits the half-precision limit. |
|
Ohh turns out this package has been worked on in #9250. |
|
Oh okay, @Neerajpathak07. In that case, I’ll close this for now. That PR is already 20 days old if it doesn’t move forward, I’d be happy to make the changes and commit them. Your call. |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Description
This pull request:
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
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers