Skip to content

Commit

Permalink
chore: updated according to code review
Browse files Browse the repository at this point in the history
---
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: 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: passed
  - task: lint_c_examples
    status: passed
  - task: lint_c_benchmarks
    status: passed
  - 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
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: passed
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: passed
  - task: run_c_benchmarks
    status: passed
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
0PrashantYadav0 committed Jan 19, 2025
1 parent 7c9e8af commit de687bf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ double out = stdlib_base_dists_cosine_kurtosis( 0.0, 1.0 );

The function accepts the following arguments:

- **mu**: `[in] int` location parameter
- **s**: `[in] int` scale parameter
- **mu**: `[in] double` location parameter
- **s**: `[in] double` scale parameter

```c
double stdlib_base_dists_cosine_kurtosis( const double mu, const double s );
Expand Down Expand Up @@ -210,7 +210,7 @@ int main( void ) {
for ( i = 0; i < 10; i++ ) {
mu = random_uniform( -50.0, 50.0 );
s = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
s = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 );
y = stdlib_base_dists_cosine_kurtosis( mu, s );
printf( "µ: %lf, s: %lf, Kurt(X;µ,s): %lf\n", mu, s , y );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static double benchmark( void ) {

for ( i = 0; i < 100; i++ ) {
mu[ i ] = random_uniform( -50.0, 50.0 );
s[ i ] = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
s[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 );
}

t = tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main( void ) {

for ( i = 0; i < 10; i++ ) {
mu = random_uniform( -50.0, 50.0 );
s = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
s = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 );
y = stdlib_base_dists_cosine_kurtosis( mu, s );
printf( "µ: %lf, s: %lf, Kurt(X;µ,s): %lf\n", mu, s , y );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifdef __cplusplus
extern "C" {
#endif

/**
* Returns the excess kurtosis for a raised cosine distribution with location `mu` and scale `s`.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' );
/**
* Returns the excess kurtosis for a raised cosine distribution with location `mu` and scale `s`.
*
* @private
* @param {number} mu - location parameter
* @param {PositiveNumber} s - scale parameter
* @returns {number} excess kurtosis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "stdlib/constants/float64/pi_squared.h"

/**
* Returns the excess kurtosis of a Cosine distribution.
* Returns the excess kurtosis of a raised cosine distribution.
*
* @param mu location parameter
* @param s scale parameter
Expand All @@ -33,9 +33,10 @@
* // returns ~-0.594
*/
double stdlib_base_dists_cosine_kurtosis( const double mu, const double s ) {
if ( stdlib_base_is_nan( mu ) ||
stdlib_base_is_nan( s ) ||
s <= 0.0
if (
stdlib_base_is_nan( mu ) ||
stdlib_base_is_nan( s ) ||
s <= 0.0
) {
return 0.0/0.0; // NaN
}
Expand Down

0 comments on commit de687bf

Please sign in to comment.