@@ -1154,7 +1154,7 @@ impl TestResultComparison {
11541154 !self . is_regression ( )
11551155 }
11561156
1157- /// Whther the comparison yielded a statistically significant result
1157+ /// Whether the comparison yielded a statistically significant result
11581158 pub fn is_significant ( & self ) -> bool {
11591159 self . relative_change ( ) . abs ( ) >= self . significance_threshold ( )
11601160 }
@@ -1168,11 +1168,17 @@ impl TestResultComparison {
11681168 }
11691169
11701170 /// This is a numeric magnitude of a particular change.
1171- fn significance_factor ( & self ) -> Option < f64 > {
1171+ fn significance_factor ( & self ) -> f64 {
11721172 let change = self . relative_change ( ) ;
11731173 let threshold = self . significance_threshold ( ) ;
1174- // How many times the treshold this change is.
1175- Some ( change. abs ( ) / threshold)
1174+
1175+ // How many times the threshold this change is.
1176+ let factor = change. abs ( ) / threshold;
1177+ if factor. is_finite ( ) {
1178+ factor
1179+ } else {
1180+ 0.0
1181+ }
11761182 }
11771183
11781184 /// Whether the comparison is relevant or not.
@@ -1188,6 +1194,14 @@ impl TestResultComparison {
11881194 /// and the amount above the significance threshold.
11891195 pub fn magnitude ( & self ) -> Magnitude {
11901196 let change = self . relative_change ( ) . abs ( ) ;
1197+
1198+ // When the significance threshold is very small, magnitude can become VeryLarge even though
1199+ // the change itself if incredibly small. So we deliberately return a VerySmall magnitude
1200+ // here to avoid marking such small result as being relevant.
1201+ if change < 0.0001 {
1202+ return Magnitude :: VerySmall ;
1203+ }
1204+
11911205 let threshold = self . significance_threshold ( ) ;
11921206 let over_threshold = if change < threshold * 1.5 {
11931207 Magnitude :: VerySmall
0 commit comments