File tree 1 file changed +7
-11
lines changed
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -635,11 +635,11 @@ mod math {
635
635
let mut x = * obj?;
636
636
637
637
let xsave = x;
638
- let mut j = 0 ;
638
+ let mut i = 0 ;
639
639
// This inner loop applies `hi`/`lo` summation to each
640
640
// 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 ] ;
643
643
if x. abs ( ) < y. abs ( ) {
644
644
std:: mem:: swap ( & mut x, & mut y) ;
645
645
}
@@ -648,8 +648,8 @@ mod math {
648
648
let hi = x + y;
649
649
let lo = y - ( hi - x) ;
650
650
if lo != 0.0 {
651
- partials[ j ] = lo;
652
- j += 1 ;
651
+ partials[ i ] = lo;
652
+ i += 1 ;
653
653
}
654
654
x = hi;
655
655
}
@@ -668,15 +668,11 @@ mod math {
668
668
special_sum += xsave;
669
669
// reset partials
670
670
partials. clear ( ) ;
671
- }
672
-
673
- if j >= partials. len ( ) {
674
- partials. push ( x) ;
675
671
} else {
676
- partials[ j] = x;
677
- partials. truncate ( j + 1 ) ;
672
+ partials. push ( x) ;
678
673
}
679
674
}
675
+
680
676
if special_sum != 0.0 {
681
677
return if inf_sum. is_nan ( ) {
682
678
Err ( vm. new_value_error ( "-inf + inf in fsum" . to_owned ( ) ) )
You can’t perform that action at this time.
0 commit comments