File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -635,11 +635,11 @@ mod math {
635635 let mut x = * obj?;
636636
637637 let xsave = x;
638- let mut j = 0 ;
638+ let mut i = 0 ;
639639 // This inner loop applies `hi`/`lo` summation to each
640640 // partial so that the list of partial sums remains exact.
641- for i in 0 ..partials. len ( ) {
642- let mut y: f64 = partials[ i ] ;
641+ for j in 0 ..partials. len ( ) {
642+ let mut y: f64 = partials[ j ] ;
643643 if x. abs ( ) < y. abs ( ) {
644644 std:: mem:: swap ( & mut x, & mut y) ;
645645 }
@@ -648,8 +648,8 @@ mod math {
648648 let hi = x + y;
649649 let lo = y - ( hi - x) ;
650650 if lo != 0.0 {
651- partials[ j ] = lo;
652- j += 1 ;
651+ partials[ i ] = lo;
652+ i += 1 ;
653653 }
654654 x = hi;
655655 }
@@ -668,15 +668,11 @@ mod math {
668668 special_sum += xsave;
669669 // reset partials
670670 partials. clear ( ) ;
671- }
672-
673- if j >= partials. len ( ) {
674- partials. push ( x) ;
675671 } else {
676- partials[ j] = x;
677- partials. truncate ( j + 1 ) ;
672+ partials. push ( x) ;
678673 }
679674 }
675+
680676 if special_sum != 0.0 {
681677 return if inf_sum. is_nan ( ) {
682678 Err ( vm. new_value_error ( "-inf + inf in fsum" . to_owned ( ) ) )
You can’t perform that action at this time.
0 commit comments