Skip to content

Commit

Permalink
chore: minor clean-up
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: 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: 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: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
  • Loading branch information
Planeshifter committed Jan 24, 2025
1 parent 7aff79a commit 3446619
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#include "stdlib/math/base/napi/binary.h"
#include "stdlib/stats/base/dists/arcsine/mode.h"
#include "stdlib/math/base/napi/binary.h"

// cppcheck-suppress shadowFunction
STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_arcsine_mode )
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/stats/base/dists/arcsine/mode.h"
#include "stdlib/math/base/assert/is_nan.h"

/**
* Returns the mode of an arcsine distribution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
// MODULES //

var tape = require( 'tape' );
var abs = require( '@stdlib/math/base/special/abs' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var mode = require( './../lib' );


Expand Down Expand Up @@ -72,8 +70,6 @@ tape( 'if provided `a >= b`, the function returns `NaN`', function test( t ) {

tape( 'the function returns the mode of an arcsine distribution', function test( t ) {
var expected;
var delta;
var tol;
var a;
var b;
var i;
Expand All @@ -84,13 +80,7 @@ tape( 'the function returns the mode of an arcsine distribution', function test(
b = data.b;
for ( i = 0; i < expected.length; i++ ) {
y = mode( a[i], b[i] );
if ( y === expected[i] ) {
t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var tryRequire = require( '@stdlib/utils/try-require' );
var abs = require( '@stdlib/math/base/special/abs' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );


// VARIABLES //
Expand Down Expand Up @@ -81,8 +79,6 @@ tape( 'if provided `a >= b`, the function returns `NaN`', opts, function test( t

tape( 'the function returns the mode of an arcsine distribution', opts, function test( t ) {
var expected;
var delta;
var tol;
var a;
var b;
var i;
Expand All @@ -93,13 +89,7 @@ tape( 'the function returns the mode of an arcsine distribution', opts, function
b = data.b;
for ( i = 0; i < expected.length; i++ ) {
y = mode( a[i], b[i] );
if ( y === expected[i] ) {
t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "stdlib/stats/base/dists/arcsine/skewness.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#include "stdlib/math/base/napi/binary.h"
#include "stdlib/stats/base/dists/arcsine/skewness.h"
#include "stdlib/math/base/napi/binary.h"

// cppcheck-suppress shadowFunction
STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_arcsine_skewness )
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/stats/base/dists/arcsine/skewness.h"
#include "stdlib/math/base/assert/is_nan.h"

/**
* Returns the skewness of an arcsine distribution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "stdlib/stats/base/dists/arcsine/stdev.h"
#include "stdlib/math/base/assert/is_nan.h"

#define SQRT1OVER8 0.35355339059327373 // sqrt(1.0 / 8.0)
static const double SQRT1OVER8 = 0.35355339059327373 // sqrt(1.0 / 8.0)

/**
* Returns the standard deviation of an arcsine distribution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"libpath": [],
"dependencies": [
"@stdlib/math/base/napi/binary",
"@stdlib/math/base/assert/is-nan",
"@stdlib/constants/float64/eps"
"@stdlib/math/base/assert/is-nan"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@

var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var mode = require( './../lib' );


Expand Down Expand Up @@ -79,8 +77,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test

tape( 'the function returns the mode of a raised cosine distribution', function test( t ) {
var expected;
var delta;
var tol;
var mu;
var s;
var y;
Expand All @@ -92,13 +88,7 @@ tape( 'the function returns the mode of a raised cosine distribution', function
for ( i = 0; i < mu.length; i++ ) {
y = mode( mu[i], s[i] );
if ( expected[i] !== null ) {
if ( y === expected[i] ) {
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
}
}
t.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -88,8 +86,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio

tape( 'the function returns the mode of a raised cosine distribution', opts, function test( t ) {
var expected;
var delta;
var tol;
var mu;
var s;
var y;
Expand All @@ -101,13 +97,7 @@ tape( 'the function returns the mode of a raised cosine distribution', opts, fun
for ( i = 0; i < mu.length; i++ ) {
y = mode( mu[i], s[i] );
if ( expected[i] !== null ) {
if ( y === expected[i] ) {
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
}
}
t.end();
Expand Down

0 comments on commit 3446619

Please sign in to comment.