@@ -1154,7 +1154,7 @@ impl TestResultComparison {
1154
1154
!self . is_regression ( )
1155
1155
}
1156
1156
1157
- /// Whther the comparison yielded a statistically significant result
1157
+ /// Whether the comparison yielded a statistically significant result
1158
1158
pub fn is_significant ( & self ) -> bool {
1159
1159
self . relative_change ( ) . abs ( ) >= self . significance_threshold ( )
1160
1160
}
@@ -1168,11 +1168,17 @@ impl TestResultComparison {
1168
1168
}
1169
1169
1170
1170
/// This is a numeric magnitude of a particular change.
1171
- fn significance_factor ( & self ) -> Option < f64 > {
1171
+ fn significance_factor ( & self ) -> f64 {
1172
1172
let change = self . relative_change ( ) ;
1173
1173
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
+ }
1176
1182
}
1177
1183
1178
1184
/// Whether the comparison is relevant or not.
@@ -1188,6 +1194,14 @@ impl TestResultComparison {
1188
1194
/// and the amount above the significance threshold.
1189
1195
pub fn magnitude ( & self ) -> Magnitude {
1190
1196
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
+
1191
1205
let threshold = self . significance_threshold ( ) ;
1192
1206
let over_threshold = if change < threshold * 1.5 {
1193
1207
Magnitude :: VerySmall
0 commit comments