Skip to content

Commit a99cc9e

Browse files
committed
docs: fix accumulator example in stats/incr/nanpcorr2
Follow-up to 6570c4f. The `@example` block in main.js and the identical examples in docs/types/index.d.ts and docs/repl.txt only supplied one valid `(x, y)` pair followed by four NaN-poisoned calls, so the correlation never accumulated a second data point and the result stayed at 0.0 for every follow-up call — failing to demonstrate that NaN inputs are ignored. Interleave a second valid pair `accumulator( 1.0, 90.0 )` (mirroring the README) so subsequent NaN calls correctly show `~1.0`.
1 parent 96db5e8 commit a99cc9e

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

lib/node_modules/@stdlib/stats/incr/nanpcorr2/docs/repl.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
null
2828
> r2 = accumulator( 2.0, 1.0 )
2929
0.0
30+
> r2 = accumulator( 1.0, 90.0 )
31+
1.0
3032
> r2 = accumulator( -5.0, NaN )
31-
~0.0
33+
~1.0
3234
> r2 = accumulator( NaN, NaN )
33-
~0.0
35+
~1.0
3436
> r2 = accumulator( NaN, -8.0 )
35-
~0.0
37+
~1.0
3638
> r2 = accumulator()
37-
~0.0
39+
~1.0
3840

3941
See Also
4042
--------

lib/node_modules/@stdlib/stats/incr/nanpcorr2/docs/types/index.d.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,20 @@ declare function incrnanpcorr2( meanx: number, meany: number ): accumulator;
5555
* r2 = accumulator( 2.0, 1.0 );
5656
* // returns 0.0
5757
*
58+
* r2 = accumulator( 1.0, 90.0 );
59+
* // returns 1.0
60+
*
5861
* r2 = accumulator( -5.0, NaN );
59-
* // returns ~0.0
62+
* // returns ~1.0
6063
*
6164
* r2 = accumulator( NaN, NaN );
62-
* // returns ~0.0
65+
* // returns ~1.0
6366
*
6467
* r2 = accumulator( NaN, 8.0 );
65-
* // returns ~0.0
68+
* // returns ~1.0
6669
*
6770
* r2 = accumulator();
68-
* // returns ~0.0
71+
* // returns ~1.0
6972
*/
7073
declare function incrnanpcorr2(): accumulator;
7174

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,20 @@ var incrpcorr2 = require( '@stdlib/stats/incr/pcorr2' );
4444
* r2 = accumulator( 2.0, 1.0 );
4545
* // returns 0.0
4646
*
47+
* r2 = accumulator( 1.0, 90.0 );
48+
* // returns 1.0
49+
*
4750
* r2 = accumulator( -5.0, NaN );
48-
* // returns ~0.0
51+
* // returns ~1.0
4952
*
5053
* r2 = accumulator( NaN, NaN );
51-
* // returns ~0.0
54+
* // returns ~1.0
5255
*
5356
* r2 = accumulator( NaN, 8.0 );
54-
* // returns ~0.0
57+
* // returns ~1.0
5558
*
5659
* r2 = accumulator();
57-
* // returns ~0.0
60+
* // returns ~1.0
5861
*
5962
* @example
6063
* var accumulator = incrnanpcorr2( 2.0, -3.0 );

0 commit comments

Comments
 (0)