@@ -1088,10 +1088,23 @@ mod tests {
10881088 let doubled = i64:: from ( mu) + ( d * 2 * i64:: from ( s) ) . div_euclid ( i64:: from ( s) ) ;
10891089 assert_eq ! ( i64 :: from( e. locate( l, mu, 2 * s) ) , doubled, "scale, k {}" , l. 0 ) ;
10901090 }
1091+ // Rounding is floor (toward −∞), also for offsets below the mean.
1092+ let below = SigmaLevel ( 12 ) ;
1093+ let x = quantile_of_sorted ( e. sorted ( ) , below. gaussian_tail_per_10000 ( ) ) ;
1094+ let d = i64:: from ( x) - i64:: from ( mu) ;
1095+ assert ! (
1096+ d < 0 && ( d * i64 :: from( s + 1 ) ) % i64 :: from( s) != 0 ,
1097+ "fixture must exercise a fractional negative offset"
1098+ ) ;
1099+ assert_eq ! (
1100+ i64 :: from( e. locate( below, mu, s + 1 ) ) ,
1101+ i64 :: from( mu) + ( d * i64 :: from( s + 1 ) ) . div_euclid( i64 :: from( s) )
1102+ ) ;
10911103 assert_eq ! ( EmpiricalShape :: from_sample( & [ ] ) , None ) ;
1092- // No spread: the offset is used unscaled.
1093- let flat = EmpiricalShape :: from_sample ( & [ 7 , 7 , 7 ] ) . unwrap ( ) ;
1094- assert_eq ! ( ( flat. sigma( ) , flat. locate( SigmaLevel ( 12 ) , 100 , 50 ) ) , ( 0 , 100 ) ) ;
1104+ // Floor spread 0 with a non-zero offset: the offset is used unscaled.
1105+ let flat = EmpiricalShape :: from_sample ( & [ 7 , 8 , 8 , 8 ] ) . unwrap ( ) ;
1106+ assert_eq ! ( ( flat. mu( ) , flat. sigma( ) ) , ( 7 , 0 ) ) ;
1107+ assert_eq ! ( flat. locate( SigmaLevel ( 0 ) , 100 , 50 ) , 101 ) ;
10951108 }
10961109
10971110 /// Each kurtosis bound switches to the empirical shape on its own, with
0 commit comments