@@ -344,7 +344,8 @@ impl UDDSketch {
344344 alpha : initial_error,
345345 gamma : ( 1.0 + initial_error) / ( 1.0 - initial_error) ,
346346 compactions : 0 ,
347- max_buckets : NonZeroU32 :: new ( max_buckets as u32 ) . expect ( "max buckets should be greater than zero" ) ,
347+ max_buckets : NonZeroU32 :: new ( max_buckets as u32 )
348+ . expect ( "max buckets should be greater than zero" ) ,
348349 num_values : 0 ,
349350 values_sum : 0.0 ,
350351 }
@@ -361,8 +362,10 @@ impl UDDSketch {
361362 buckets : SketchHashMap :: with_capacity ( capacity) ,
362363 alpha : metadata. current_error ,
363364 gamma : gamma ( metadata. current_error ) ,
364- compactions : u8:: try_from ( metadata. compactions ) . expect ( "compactions cannot be higher than 65" ) ,
365- max_buckets : NonZeroU32 :: new ( metadata. max_buckets ) . expect ( "max buckets should be greater than zero" ) ,
365+ compactions : u8:: try_from ( metadata. compactions )
366+ . expect ( "compactions cannot be higher than 65" ) ,
367+ max_buckets : NonZeroU32 :: new ( metadata. max_buckets )
368+ . expect ( "max buckets should be greater than zero" ) ,
366369 num_values : metadata. values ,
367370 values_sum : metadata. sum ,
368371 } ;
@@ -864,13 +867,13 @@ mod tests {
864867
865868 for i in 0 ..100 {
866869 assert ! ( ( ( sketch. estimate_quantile( ( i as f64 + 1.0 ) / 100.0 ) / bounds[ i] ) - 1.0 ) . abs( ) < sketch. max_error( ) * bounds[ i] . abs( ) ,
867- "Failed to correct match {} quantile with seed {}. Received: {}, Expected: {}, Error: {}, Expected error bound: {}" ,
868- ( i as f64 + 1.0 ) / 100.0 ,
869- seed,
870- sketch. estimate_quantile( ( i as f64 + 1.0 ) / 100.0 ) ,
871- bounds[ i] ,
872- ( ( sketch. estimate_quantile( ( i as f64 + 1.0 ) / 100.0 ) / bounds[ i] ) - 1.0 ) . abs( ) / bounds[ i] . abs( ) ,
873- sketch. max_error( ) ) ;
870+ "Failed to correct match {} quantile with seed {}. Received: {}, Expected: {}, Error: {}, Expected error bound: {}" ,
871+ ( i as f64 + 1.0 ) / 100.0 ,
872+ seed,
873+ sketch. estimate_quantile( ( i as f64 + 1.0 ) / 100.0 ) ,
874+ bounds[ i] ,
875+ ( ( sketch. estimate_quantile( ( i as f64 + 1.0 ) / 100.0 ) / bounds[ i] ) - 1.0 ) . abs( ) / bounds[ i] . abs( ) ,
876+ sketch. max_error( ) ) ;
874877 }
875878 }
876879
0 commit comments