private static void RecordSnapshot( Dictionary <string, double> result, ReservoirHistogramSnapshot snapshot) { result.Add("mean", snapshot.Mean); result.Add("stddev", snapshot.StdDev); foreach (var percentile in percentiles) { var value = snapshot.GetUpperQuantile(percentile); result.Add($"upper{percentile*100:###}", value); } }
private static void AssertQuantile( ReservoirHistogramSnapshot snapshot, double quantile, int range, double maxError, bool log) { var result = snapshot.GetUpperQuantile(quantile); if (log) { Console.WriteLine($"{quantile:F3}: {result:F3}"); } result.Should().BeApproximately(range * quantile, maxError); }