From 0ddb44fc749da00223d915ec3eecc04148926acd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Jul 2026 13:16:10 +0000 Subject: [PATCH] bench: adopt `y != y` NaN check across `stats/base/dists/*` C benchmarks Propagates fix from fe3bacee ("bench: add missing function documentation and ensure consistency with other benchmarks") to sibling C benchmarks still using `isnan( y )`. Removes the now-unneeded `` include and switches both call sites to the tree's canonical `y != y` self-comparison idiom. Affects: chi/entropy, chisquare/kurtosis, chisquare/mgf, degenerate/logpmf, degenerate/pdf, degenerate/pmf, degenerate/quantile, planck/mgf. --- .../stats/base/dists/chi/entropy/benchmark/c/benchmark.c | 5 ++--- .../base/dists/chisquare/kurtosis/benchmark/c/benchmark.c | 5 ++--- .../stats/base/dists/chisquare/mgf/benchmark/c/benchmark.c | 5 ++--- .../base/dists/degenerate/logpmf/benchmark/c/benchmark.c | 5 ++--- .../stats/base/dists/degenerate/pdf/benchmark/c/benchmark.c | 5 ++--- .../stats/base/dists/degenerate/pmf/benchmark/c/benchmark.c | 5 ++--- .../base/dists/degenerate/quantile/benchmark/c/benchmark.c | 5 ++--- .../stats/base/dists/planck/mgf/benchmark/c/benchmark.c | 5 ++--- 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/c/benchmark.c index 44cd421acb8c..81472dc2c37a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/c/benchmark.c @@ -20,7 +20,6 @@ #include "stdlib/constants/float64/eps.h" #include #include -#include #include #include @@ -106,14 +105,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_chi_entropy( k[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/chisquare/kurtosis/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/chisquare/kurtosis/benchmark/c/benchmark.c index f52b22867d85..ccaa7d150152 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chisquare/kurtosis/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chisquare/kurtosis/benchmark/c/benchmark.c @@ -20,7 +20,6 @@ #include "stdlib/constants/float64/eps.h" #include #include -#include #include #include @@ -106,14 +105,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_chisquare_kurtosis( k[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/benchmark/c/benchmark.c index 80bcd9e9a958..50b285c57a3a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/benchmark/c/benchmark.c @@ -17,7 +17,6 @@ */ #include "stdlib/stats/base/dists/chisquare/mgf.h" -#include #include #include #include @@ -107,14 +106,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_chisquare_mgf( t[ i % 100 ], k[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/degenerate/logpmf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/degenerate/logpmf/benchmark/c/benchmark.c index 3e6d5fdec751..b261ce5ed655 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/degenerate/logpmf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/degenerate/logpmf/benchmark/c/benchmark.c @@ -20,7 +20,6 @@ #include "stdlib/math/base/special/ceil.h" #include #include -#include #include #include @@ -108,14 +107,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_degenerate_logpmf( x[ i % 100 ], mu[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/degenerate/pdf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/degenerate/pdf/benchmark/c/benchmark.c index 5b0b2adf16a5..1cde1dcb825c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/degenerate/pdf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/degenerate/pdf/benchmark/c/benchmark.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/degenerate/pdf.h" #include #include -#include #include #include @@ -107,14 +106,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_degenerate_pdf( x[ i % 100 ], mu[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/degenerate/pmf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/degenerate/pmf/benchmark/c/benchmark.c index 7a0abc18dab2..1bc1cb1d2c94 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/degenerate/pmf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/degenerate/pmf/benchmark/c/benchmark.c @@ -20,7 +20,6 @@ #include "stdlib/math/base/special/ceil.h" #include #include -#include #include #include @@ -108,14 +107,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_degenerate_pmf( x[ i % 100 ], mu[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile/benchmark/c/benchmark.c index a5e86444a6c6..e2af8f1ad3ac 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile/benchmark/c/benchmark.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/degenerate/quantile.h" #include #include -#include #include #include @@ -107,14 +106,14 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_degenerate_quantile( p[ i % 100 ], mu[ i % 100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mgf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/planck/mgf/benchmark/c/benchmark.c index 50c27e510d53..281e5b016671 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mgf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mgf/benchmark/c/benchmark.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/planck/mgf.h" #include #include -#include #include #include @@ -107,13 +106,13 @@ static double benchmark( void ) { start = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = stdlib_base_dists_planck_mgf( t[ i%100 ], lambda[ i%100 ] ); - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - start; - if ( isnan( y ) ) { + if ( y != y ) { printf( "should not return NaN\n" ); } return elapsed;