-
-
Notifications
You must be signed in to change notification settings - Fork 995
feat: add math/base/special/acoshf
#5812
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?
Conversation
|
Depend on #5803 |
---
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
---
|
I noticed your PR description contains closing keywords ("Resolves", "Closes", or "Fixes") referencing a "Tracking Issue". Why this matters: Required action: Thank you for your contribution to the project! |
|
/stdlib merge |
|
/stdlib update-copyright-years |
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Coverage Report
The above coverage report was generated for the changes in this PR. |
| var opts = { | ||
| 'skip': ( typeof Math.acoshf !== 'function' ) // eslint-disable-line stdlib/no-builtin-math | ||
| }; |
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 not needed. JavaScript does not have Math.acoshf
| var y; | ||
| var i; | ||
|
|
||
| x = uniform( 100, 1.0, 100.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.
Missing opts argument.
Should be changed to:
x = uniform( 100, 1.0, 100.0, {
'dtype': 'float32'
});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.
Same for benchmark.native.js
| /** | ||
| * Generates a random number on the interval [0,1). | ||
| * | ||
| * @return random number | ||
| */ | ||
| static float rand_float( void ) { | ||
| int r = rand(); | ||
| return (float)r / ( (float)RAND_MAX + 1.0f ); | ||
| } |
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.
We have moved away from using rand_float in our benchmarks. We use this instead:
/**
* Generates a random number on the interval [min,max).
*
* @param min minimum value (inclusive)
* @param max maximum value (exclusive)
* @return random number
*/
static float random_uniform( const float min, const float max ) {
float v = (float)rand() / ( (float)RAND_MAX + 1.0f );
return min + ( v*(max-min) );
}| for ( i = 0; i < 100; i++ ) { | ||
| x[ i ] = ( 100.0f*rand_float() ) + 1.0f; | ||
| } |
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.
These lines will be changed accordingly. Reference: https://github.com/0PrashantYadav0/stdlib/blob/a8785515d4aab7c059e0d1c45e62f656404e5f45/lib/node_modules/%40stdlib/math/base/special/log1pf/benchmark/c/native/benchmark.c#L101-L103
| var linspace = require( '@stdlib/array/base/linspace' ); | ||
| var acoshf = require( './../lib' ); | ||
|
|
||
| var x = linspace( 1.0, 5.0, 100 ); | ||
|
|
||
| var i; | ||
| for ( i = 0; i < x.length; i++ ) { | ||
| console.log( 'acoshf( %d ) = %d', x[ i ], acoshf( x[ i ] ) ); | ||
| } |
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.
Can you please use @stdlib/console/log-each-map instead? The above coding structure is outdated now.
|
|
||
| // VARIABLES // | ||
|
|
||
| var HUGE = 1 << 28; // 2**28 |
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 HUGE = f32( 1 << 28 ); // 2**28
| var t; | ||
| var s; | ||
| x = f32( x ); | ||
| if ( isnanf( x ) || x < 1.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.
if ( isnanf( x ) || x < f32( 1.0 ) ) {
This applies to all the numbers below too. Like 0.0, 1.0, 2.0, etc.
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.
Or you can declare them as separate variables. Like https://github.com/0PrashantYadav0/stdlib/blob/a8785515d4aab7c059e0d1c45e62f656404e5f45/lib/node_modules/%40stdlib/math/base/special/log1pf/lib/main.js#L85-L89
| var s; | ||
| x = f32( x ); |
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 s;
x = f32( x );
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.
Leaving a space between the variable declarations and rest of the code makes it a bit cleaner :)
| ```javascript | ||
| var linspace = require( '@stdlib/array/base/linspace' ); | ||
| var acoshf = require( '@stdlib/math/base/special/acoshf' ); | ||
|
|
||
| var x = linspace( 1.0, 5.0, 100 ); | ||
|
|
||
| var i; | ||
| for ( i = 0; i < x.length; i++ ) { | ||
| console.log( acoshf( x[ i ] ) ); | ||
| } | ||
| ``` |
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 will be updated accordingly.
| * * * | ||
|
|
||
| ## See Also | ||
|
|
||
| - <span class="package-name">[`@stdlib/math/base/special/acos`][@stdlib/math/base/special/acos]</span><span class="delimiter">: </span><span class="description">compute the arccosine of a double-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math/base/special/asinh`][@stdlib/math/base/special/asinh]</span><span class="delimiter">: </span><span class="description">compute the hyperbolic arcsine of a double-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math/base/special/atanh`][@stdlib/math/base/special/atanh]</span><span class="delimiter">: </span><span class="description">compute the hyperbolic arctangent of a double-precision floating-point number.</span> | ||
|
|
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 can remove these as these get automatically populated, through our automation scripts.
| [@stdlib/math/base/special/acos]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/acos | ||
|
|
||
| [@stdlib/math/base/special/asinh]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/asinh | ||
|
|
||
| [@stdlib/math/base/special/atanh]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/atanh |
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.
Same for these.
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Updated the benchmark for acoshf to use float32 dtype and removed the built-in benchmark. Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
|
/stdlib lint-autofix |
Signed-off-by: Karan Anand <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Signed-off-by: Nakul Krishnakumar <[email protected]>
Resolves None.
Description
This pull request:
math/base/special/acoshfRelated Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers