Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
#include "stdlib/stats/base/dists/binomial/logpmf.h"
#include "stdlib/math/base/napi/ternary.h"

STDLIB_MATH_BASE_NAPI_MODULE_DID_D( stdlib_base_dists_binomial_logpmf );
STDLIB_MATH_BASE_NAPI_MODULE_DID_D( stdlib_base_dists_binomial_logpmf )
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ tape( 'the function evaluates the logpmf for `x` given large `n` and `p`', opts,
n = highHigh.n;
p = highHigh.p;
for ( i = 0; i < x.length; i++ ) {
y = logpmf( x[i], n[i], p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = logpmf( x[ i ], n[ i ], p[ i ] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
} else {
delta = abs( y - expected[i] );
tol = 30.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. p: '+p[i]+'. y: '+y+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
delta = abs( y - expected[ i ] );
tol = 30.0 * EPS * abs( expected[ i ] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[ i ]+'. n: '+n[ i ]+'. p: '+p[ i ]+'. y: '+y+'. Expected: '+expected[ i ]+'. tol: '+tol+'. delta: '+delta+'.' );
}
}
t.end();
Expand All @@ -182,13 +182,13 @@ tape( 'the function evaluates the logpmf for `x` given large `n` and small `p`',
n = highSmall.n;
p = highSmall.p;
for ( i = 0; i < x.length; i++ ) {
y = logpmf( x[i], n[i], p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = logpmf( x[ i ], n[ i ], p[ i ] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
} else {
delta = abs( y - expected[i] );
tol = 20.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. p: '+p[i]+'. y: '+y+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
delta = abs( y - expected[ i ] );
tol = 20.0 * EPS * abs( expected[ i ] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[ i ]+'. n: '+n[ i ]+'. p: '+p[ i ]+'. y: '+y+'. Expected: '+expected[ i ]+'. tol: '+tol+'. delta: '+delta+'.' );
}
}
t.end();
Expand All @@ -209,13 +209,13 @@ tape( 'the function evaluates the logpmf for `x` given small `n` and large `p`',
n = smallHigh.n;
p = smallHigh.p;
for ( i = 0; i < x.length; i++ ) {
y = logpmf( x[i], n[i], p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = logpmf( x[ i ], n[ i ], p[ i ] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
} else {
delta = abs( y - expected[i] );
tol = 20.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. p: '+p[i]+'. y: '+y+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
delta = abs( y - expected[ i ] );
tol = 20.0 * EPS * abs( expected[ i ] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[ i ]+'. n: '+n[ i ]+'. p: '+p[ i ]+'. y: '+y+'. Expected: '+expected[ i ]+'. tol: '+tol+'. delta: '+delta+'.' );
}
}
t.end();
Expand All @@ -236,13 +236,13 @@ tape( 'the function evaluates the logpmf for `x` given small `n` and `p`', opts,
n = smallSmall.n;
p = smallSmall.p;
for ( i = 0; i < x.length; i++ ) {
y = logpmf( x[i], n[i], p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = logpmf( x[ i ], n[ i ], p[ i ] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
} else {
delta = abs( y - expected[i] );
tol = 10.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. p: '+p[i]+'. y: '+y+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[ i ]+'. n: '+n[ i ]+'. p: '+p[ i ]+'. y: '+y+'. Expected: '+expected[ i ]+'. tol: '+tol+'. delta: '+delta+'.' );
}
}
t.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var addon = require( './../src/addon.node' );
* @private
* @param {Probability} r - input value
* @param {NonNegativeInteger} n - number of trials
* @param {Probability} p - success probability
* @param {Probability} p - success probability
* @returns {NonNegativeInteger} evaluated quantile function
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ tape( 'the function evaluates the quantile for `r` given large `n` and `p`', opt
n = highHigh.n;
p = highHigh.p;
for ( i = 0; i < r.length; i++ ) {
y = quantile( r[i], n[i], p[i] );
t.strictEqual( y, expected[i], 'r: '+r[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = quantile( r[ i ], n[ i ], p[ i ] );
t.strictEqual( y, expected[ i ], 'r: '+r[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
}
t.end();
});
Expand All @@ -204,8 +204,8 @@ tape( 'the function evaluates the quantile for `r` given large `n` and small `p`
n = highSmall.n;
p = highSmall.p;
for ( i = 0; i < r.length; i++ ) {
y = quantile( r[i], n[i], p[i] );
t.strictEqual( y, expected[i], 'r: '+r[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = quantile( r[ i ], n[ i ], p[ i ] );
t.strictEqual( y, expected[ i ], 'r: '+r[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
}
t.end();
});
Expand All @@ -223,8 +223,8 @@ tape( 'the function evaluates the quantile for `r` given small `n` and large `p`
n = smallHigh.n;
p = smallHigh.p;
for ( i = 0; i < r.length; i++ ) {
y = quantile( r[i], n[i], p[i] );
t.strictEqual( y, expected[i], 'r: '+r[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = quantile( r[ i ], n[ i ], p[ i ] );
t.strictEqual( y, expected[ i ], 'r: '+r[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
}
t.end();
});
Expand All @@ -242,8 +242,8 @@ tape( 'the function evaluates the quantile for `r` given small `n` and `p`', opt
n = smallSmall.n;
p = smallSmall.p;
for ( i = 0; i < r.length; i++ ) {
y = quantile( r[i], n[i], p[i] );
t.strictEqual( y, expected[i], 'r: '+r[i]+', n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
y = quantile( r[ i ], n[ i ], p[ i ] );
t.strictEqual( y, expected[ i ], 'r: '+r[ i ]+', n: '+n[ i ]+', p: '+p[ i ]+', y: '+y+', expected: '+expected[ i ] );
}
t.end();
});