Skip to content

Commit

Permalink
feat:C implementation of stats/base/dists/weibull/skewness
Browse files Browse the repository at this point in the history
---
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: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - 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
yuvi-mittal committed Jan 16, 2025
1 parent b69ece4 commit f58b282
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,21 @@ static double benchmark( void ) {
double t;
int i;

// Generate random values for k (shape) and lambda (scale)
for ( i = 0; i < 100; i++ ) {
k[ i ] = random_uniform( 0.1, 10.0 ); // k > 0 to avoid NaN result
lambda[ i ] = random_uniform( 0.1, 10.0 ); // lambda > 0 to avoid NaN result
k[ i ] = random_uniform( 0.1, 10.0 );
lambda[ i ] = random_uniform( 0.1, 10.0 );
}

t = tic();
// Benchmark loop
for ( i = 0; i < ITERATIONS; i++ ) {
// Calculate skewness for the Weibull distribution
y = stdlib_base_dists_weibull_skewness( k[ i % 100 ], lambda[ i % 100 ] );
if ( y != y ) { // Check for NaN
if ( y != y ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;

// Final NaN check
if ( y != y ) {
printf( "should not return NaN\n" );
}
Expand Down

0 comments on commit f58b282

Please sign in to comment.