Skip to content

Commit 8165e41

Browse files
committed
fix: address changes suggestion
1. Explicit type coversion of n from int32_t to double 2. Remove variable EPS and direct use STDLIB_CONSTANT_FLOAT64_EPS to maintain consistency 3. Fix typo from largeRangeRange to largeRange 4. Use exact SHA instead of develop in a moving target --- 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: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 17edfe9 commit 8165e41

3 files changed

Lines changed: 25 additions & 26 deletions

File tree

lib/node_modules/@stdlib/math/base/special/kernel-betainc/src/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include <stddef.h>
5656

5757
// VARIABLES //
58-
static const double EPS = STDLIB_CONSTANT_FLOAT64_EPS;
5958
static const double ONE_OVER_PI = 1.0 / STDLIB_CONSTANT_FLOAT64_PI;
6059

6160
/**
@@ -394,7 +393,7 @@ static double ibetaFraction2( const double a, const double b, const double x, co
394393
if ( result == 0.0 ) {
395394
return result;
396395
}
397-
fract = ibetaFraction2CF( a, b, x, y, EPS, 1000 );
396+
fract = ibetaFraction2CF( a, b, x, y, STDLIB_CONSTANT_FLOAT64_EPS, 1000 );
398397
return result / fract;
399398
}
400399

@@ -575,7 +574,7 @@ static double ibetaSeriesT( double *a, const double b, const double x, double *p
575574
double r;
576575
r = ( *result ) / ( *a );
577576
*a += 1.0;
578-
*result *= ( *poch ) * x / ( *n );
577+
*result *= ( *poch ) * x / (double)( *n );
579578
*n += 1;
580579
*poch += 1.0;
581580
return r;
@@ -704,7 +703,7 @@ static double ibetaSeries( const double a, const double b, const double x, const
704703
do {
705704
r = ibetaSeriesT( &ac, b, x, &poch, &n, &result );
706705
sum += r;
707-
} while ( ( stdlib_base_abs( EPS * sum ) < stdlib_base_abs( r ) ) && --counter );
706+
} while ( ( stdlib_base_abs( STDLIB_CONSTANT_FLOAT64_EPS * sum ) < stdlib_base_abs( r ) ) && --counter );
708707
return sum;
709708
}
710709

lib/node_modules/@stdlib/math/base/special/kernel-betainc/test/test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var kernelBetainc = require( './../lib' );
3636

3737
var smallRange = require( './fixtures/cpp/small_range.json' );
3838
var mediumRange = require( './fixtures/cpp/medium_range.json' );
39-
var largeRangeRange = require( './fixtures/cpp/large_range.json' );
39+
var largeRange = require( './fixtures/cpp/large_range.json' );
4040
var intValues = require( './fixtures/cpp/int_values.json' );
4141
var largeAsym = require( './fixtures/cpp/large_asym.json' );
4242

@@ -229,7 +229,7 @@ tape( 'the function handles the `a=1` branch', function test( t ) {
229229
t.end();
230230
});
231231

232-
// Source: https://raw.githubusercontent.com/boostorg/math/refs/heads/develop/test/test_ibeta.hpp
232+
// Source: https://raw.githubusercontent.com/boostorg/math/e1bdcad01783fe8d285c363c948b47173846e734/test/test_ibeta.hpp
233233
tape( 'the function evaluates the lower regularized incomplete beta function for Wolfram-verified spot values', function test( t ) {
234234
var expected;
235235
var val;
@@ -385,7 +385,7 @@ tape( 'the function handles the `b=1` special cases', function test( t ) {
385385

386386
// Bug cases from Rocco Romeo
387387

388-
// Source: https://raw.githubusercontent.com/boostorg/math/refs/heads/develop/test/test_ibeta.hpp
388+
// Source: https://raw.githubusercontent.com/boostorg/math/e1bdcad01783fe8d285c363c948b47173846e734/test/test_ibeta.hpp
389389
tape( 'the function handles extreme x values (Rocco Romeo bug cases)', function test( t ) {
390390
// These test extreme x values near powers of 2
391391
var expected;
@@ -538,10 +538,10 @@ tape( 'the function evaluates the lower regularized incomplete beta function for
538538
var i;
539539
var y;
540540

541-
expected = largeRangeRange.lower_regularized;
542-
lv = largeRangeRange.x;
543-
la = largeRangeRange.a;
544-
lb = largeRangeRange.b;
541+
expected = largeRange.lower_regularized;
542+
lv = largeRange.x;
543+
la = largeRange.a;
544+
lb = largeRange.b;
545545
for ( i = 0; i < lv.length; i++ ) {
546546
y = kernelBetainc( lv[i], la[i], lb[i], true, false )[0];
547547
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2165 ), true, 'within tolerance' );
@@ -557,10 +557,10 @@ tape( 'the function evaluates the upper regularized incomplete beta function for
557557
var i;
558558
var y;
559559

560-
expected = largeRangeRange.upper_regularized;
561-
lv = largeRangeRange.x;
562-
la = largeRangeRange.a;
563-
lb = largeRangeRange.b;
560+
expected = largeRange.upper_regularized;
561+
lv = largeRange.x;
562+
la = largeRange.a;
563+
lb = largeRange.b;
564564
for ( i = 0; i < lv.length; i++ ) {
565565
y = kernelBetainc( lv[i], la[i], lb[i], true, true )[0];
566566
t.strictEqual( isAlmostSameValue( y, expected[ i ], 24771 ), true, 'within tolerance' );

lib/node_modules/@stdlib/math/base/special/kernel-betainc/test/test.native.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var opts = {
4545

4646
var smallRange = require( './fixtures/cpp/small_range.json' );
4747
var mediumRange = require( './fixtures/cpp/medium_range.json' );
48-
var largeRangeRange = require( './fixtures/cpp/large_range.json' );
48+
var largeRange = require( './fixtures/cpp/large_range.json' );
4949
var intValues = require( './fixtures/cpp/int_values.json' );
5050
var largeAsym = require( './fixtures/cpp/large_asym.json' );
5151

@@ -237,7 +237,7 @@ tape( 'the function handles the `a=1` branch', opts, function test( t ) {
237237
t.end();
238238
});
239239

240-
// Source: https://raw.githubusercontent.com/boostorg/math/refs/heads/develop/test/test_ibeta.hpp
240+
// Source: https://raw.githubusercontent.com/boostorg/math/e1bdcad01783fe8d285c363c948b47173846e734/test/test_ibeta.hpp
241241
tape( 'the function evaluates the lower regularized incomplete beta function for Wolfram-verified spot values', opts, function test( t ) {
242242
var expected;
243243
var val;
@@ -393,7 +393,7 @@ tape( 'the function handles the `b=1` special cases', opts, function test( t ) {
393393

394394
// Bug cases from Rocco Romeo
395395

396-
// Source: https://raw.githubusercontent.com/boostorg/math/refs/heads/develop/test/test_ibeta.hpp
396+
// Source: https://raw.githubusercontent.com/boostorg/math/e1bdcad01783fe8d285c363c948b47173846e734/test/test_ibeta.hpp
397397
tape( 'the function handles extreme x values (Rocco Romeo bug cases)', opts, function test( t ) {
398398
// These test extreme x values near powers of 2
399399
var expected;
@@ -546,10 +546,10 @@ tape( 'the function evaluates the lower regularized incomplete beta function for
546546
var i;
547547
var y;
548548

549-
expected = largeRangeRange.lower_regularized;
550-
lv = largeRangeRange.x;
551-
la = largeRangeRange.a;
552-
lb = largeRangeRange.b;
549+
expected = largeRange.lower_regularized;
550+
lv = largeRange.x;
551+
la = largeRange.a;
552+
lb = largeRange.b;
553553
for ( i = 0; i < lv.length; i++ ) {
554554
y = kernelBetainc( lv[i], la[i], lb[i], true, false )[0];
555555
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2165 ), true, 'within tolerance' );
@@ -565,10 +565,10 @@ tape( 'the function evaluates the upper regularized incomplete beta function for
565565
var i;
566566
var y;
567567

568-
expected = largeRangeRange.upper_regularized;
569-
lv = largeRangeRange.x;
570-
la = largeRangeRange.a;
571-
lb = largeRangeRange.b;
568+
expected = largeRange.upper_regularized;
569+
lv = largeRange.x;
570+
la = largeRange.a;
571+
lb = largeRange.b;
572572
for ( i = 0; i < lv.length; i++ ) {
573573
y = kernelBetainc( lv[i], la[i], lb[i], true, true )[0];
574574
t.strictEqual( isAlmostSameValue( y, expected[ i ], 24771 ), true, 'within tolerance' );

0 commit comments

Comments
 (0)