Skip to content

Commit b067f2f

Browse files
committed
Fix implementation to properly handle NaN as first value edge case
1 parent 93f083e commit b067f2f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • lib/node_modules/@stdlib/stats/incr/mda/lib

lib/node_modules/@stdlib/stats/incr/mda/lib/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@ function incrmda() {
7070
if ( arguments.length === 0 ) {
7171
return mean();
7272
}
73-
if ( FLG ) {
74-
sf = signum( f-f0 );
75-
sa = signum( a-a0 );
76-
} else {
73+
if ( FLG === void 0 ) {
7774
FLG = true;
78-
sf = 1.0;
79-
sa = 1.0;
75+
f0 = f;
76+
a0 = a;
8077
}
78+
sf = signum( f-f0 );
79+
sa = signum( a-a0 );
8180
f0 = f;
8281
a0 = a;
8382
return mean( kroneckerDelta( sf, sa ) );

0 commit comments

Comments
 (0)