Skip to content

Commit d34dd05

Browse files
committed
refactor: remove unneeded isnan checks across stats/base/dists/discrete-uniform/*
Propagates fix from 80a434f ("refactor: remove unneeded `isnan` checks") to the discrete-uniform sibling distribution: removes the redundant `isnan( a )` / `isnan( b )` clauses (and their `is-nan` require) from mean, variance, entropy, kurtosis, skewness, stdev, and median. `!isInteger( a )` / `!isInteger( b )` already short-circuit to `return NaN` for NaN inputs, so the `isnan` calls are dead code.
1 parent 32ebdf3 commit d34dd05

7 files changed

Lines changed: 0 additions & 21 deletions

File tree

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/entropy/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
24-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2524
var ln = require( '@stdlib/math/base/special/ln' );
2625

2726

@@ -64,8 +63,6 @@ var ln = require( '@stdlib/math/base/special/ln' );
6463
*/
6564
function entropy( a, b ) {
6665
if (
67-
isnan( a ) ||
68-
isnan( b ) ||
6966
!isInteger( a ) ||
7067
!isInteger( b ) ||
7168
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/kurtosis/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524
var pow = require( '@stdlib/math/base/special/pow' );
2625

@@ -65,8 +64,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
6564
function kurtosis( a, b ) {
6665
var n2;
6766
if (
68-
isnan( a ) ||
69-
isnan( b ) ||
7067
!isInteger( a ) ||
7168
!isInteger( b ) ||
7269
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/mean/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524

2625

@@ -63,8 +62,6 @@ var isInteger = require( '@stdlib/math/base/assert/is-integer' );
6362
*/
6463
function mean( a, b ) {
6564
if (
66-
isnan( a ) ||
67-
isnan( b ) ||
6865
!isInteger( a ) ||
6966
!isInteger( b ) ||
7067
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/median/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524

2625

@@ -63,8 +62,6 @@ var isInteger = require( '@stdlib/math/base/assert/is-integer' );
6362
*/
6463
function median( a, b ) {
6564
if (
66-
isnan( a ) ||
67-
isnan( b ) ||
6865
!isInteger( a ) ||
6966
!isInteger( b ) ||
7067
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/skewness/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524

2625

@@ -63,8 +62,6 @@ var isInteger = require( '@stdlib/math/base/assert/is-integer' );
6362
*/
6463
function skewness( a, b ) {
6564
if (
66-
isnan( a ) ||
67-
isnan( b ) ||
6865
!isInteger( a ) ||
6966
!isInteger( b ) ||
7067
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/stdev/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524
var pow = require( '@stdlib/math/base/special/pow' );
2625
var sqrt = require( '@stdlib/math/base/special/sqrt' );
@@ -70,8 +69,6 @@ var SQRT1O12 = sqrt( 1.0/12.0 );
7069
*/
7170
function stdev( a, b ) {
7271
if (
73-
isnan( a ) ||
74-
isnan( b ) ||
7572
!isInteger( a ) ||
7673
!isInteger( b ) ||
7774
a > b

lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/variance/lib/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2423
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2524
var pow = require( '@stdlib/math/base/special/pow' );
2625

@@ -64,8 +63,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
6463
*/
6564
function variance( a, b ) {
6665
if (
67-
isnan( a ) ||
68-
isnan( b ) ||
6966
!isInteger( a ) ||
7067
!isInteger( b ) ||
7168
a > b

0 commit comments

Comments
 (0)