@@ -78,15 +78,7 @@ tape( 'the accumulator function incrementally computes an unbiased sample varian
7878
7979 data = [ 2.0 , 3.0 , NaN , 4.0 , 3.0 , NaN , 4.0 ] ;
8080
81- // Expected results (excluding NaN values):
82- expected = [
83- 0.0 ,
84- 0.5 ,
85- 0.5 ,
86- 0.9166666666666666 ,
87- 0.9166666666666666 ,
88- 0.8
89- ] ;
81+ expected = [ 0 , 0.5 , 0.5 , 1 , 0.6666666666666666 , 0.6666666666666666 , 0.7 ] ;
9082
9183 acc = incrnanvariance ( ) ;
9284
@@ -107,16 +99,7 @@ tape( 'the accumulator function incrementally computes an unbiased sample varian
10799
108100 data = [ 2.0 , 3.0 , NaN , 2.0 , 4.0 , NaN , 3.0 , 4.0 ] ;
109101
110- // Expected results (excluding NaN values):
111- expected = [
112- 1.0 ,
113- 0.5 ,
114- 0.5 ,
115- 0.75 ,
116- 0.75 ,
117- 0.6 ,
118- 0.6666666666666666
119- ] ;
102+ expected = [ 1 , 0.5 , 0.5 , 0.6666666666666666 , 0.75 , 0.75 , 0.6 , 0.6666666666666666 ] ;
120103
121104 acc = incrnanvariance ( 3.0 ) ;
122105
@@ -133,7 +116,7 @@ tape( 'if not provided an input value, the accumulator function returns the curr
133116 var acc ;
134117 var i ;
135118
136- data = [ 2.0 , 3.0 , NaN , 1.0 ] ;
119+ data = [ 2.0 , 3.0 , 1.0 ] ;
137120 acc = incrnanvariance ( ) ;
138121 for ( i = 0 ; i < data . length ; i ++ ) {
139122 acc ( data [ i ] ) ;
@@ -147,7 +130,7 @@ tape( 'if not provided an input value, the accumulator function returns the curr
147130 var acc ;
148131 var i ;
149132
150- data = [ 2.0 , 3.0 , NaN , 1.0 ] ;
133+ data = [ 2.0 , 3.0 , 1.0 ] ;
151134 acc = incrnanvariance ( 2.0 ) ;
152135 for ( i = 0 ; i < data . length ; i ++ ) {
153136 acc ( data [ i ] ) ;
@@ -213,7 +196,7 @@ tape( 'the sample variance is `0` until at least 2 datums have been provided (un
213196 t . end ( ) ;
214197} ) ;
215198
216- tape ( 'if provided NaN, the accumulator function ignores the value and returns the current accumulated variance ' , function test ( t ) {
199+ tape ( 'if provided a ` NaN` , the accumulator function ignores the value' , function test ( t ) {
217200 var data ;
218201 var acc ;
219202 var v ;
@@ -225,8 +208,6 @@ tape( 'if provided NaN, the accumulator function ignores the value and returns t
225208 v = acc ( data [ i ] ) ;
226209 if ( i === 0 ) {
227210 t . equal ( v , null , 'returns null' ) ;
228- } else if ( i === 1 ) {
229- t . equal ( v , 0.0 , 'returns expected value' ) ;
230211 } else {
231212 t . equal ( isnan ( v ) , false , 'does not return NaN' ) ;
232213 }
@@ -238,7 +219,7 @@ tape( 'if provided NaN, the accumulator function ignores the value and returns t
238219 t . end ( ) ;
239220} ) ;
240221
241- tape ( 'if provided NaN, the accumulator function ignores the value and returns the current accumulated variance (known mean)' , function test ( t ) {
222+ tape ( 'if provided a ` NaN` , the accumulator function ignores the value (known mean)' , function test ( t ) {
242223 var data ;
243224 var acc ;
244225 var v ;
0 commit comments