Skip to content

Commit 5bf8941

Browse files
chore: update bench.c to handle NaN elements
1 parent 2124cd3 commit 5bf8941

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

lib/node_modules/@stdlib/stats/base/dsnanmeanpn/benchmark/c/benchmark.length.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ static double benchmark1( int iterations, int len ) {
102102
int i;
103103

104104
for ( i = 0; i < len; i++ ) {
105-
x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
105+
if ( rand_float() < 0.2f ) {
106+
x[ i ] = 0.0f / 0.0f; // NaN
107+
} else {
108+
x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
109+
}
106110
}
107111
v = 0.0;
108112
t = tic();
@@ -136,7 +140,11 @@ static double benchmark2( int iterations, int len ) {
136140
int i;
137141

138142
for ( i = 0; i < len; i++ ) {
139-
x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
143+
if ( rand_float() < 0.2f ) {
144+
x[ i ] = 0.0f / 0.0f; // NaN
145+
} else {
146+
x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
147+
}
140148
}
141149
v = 0.0;
142150
t = tic();

lib/node_modules/@stdlib/stats/base/dsnanmeanpn/src/addon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2020 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dsnanmeanpn/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2020 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)