From: muraken@... Date: 2021-08-02T03:41:47+00:00 Subject: [ruby-core:104747] [Ruby master Feature#18057] Introduce Array#average Issue #18057 has been updated by mrkn (Kenta Murata). I created [enumerable-statistics gem](https://github.com/mrkn/enumerable-statistics) to provide the methods for calculating precise statistical summary in Array and Enumerable. Does this gem fit your use cases? I think this is unnecessary to provide in the core because average values can be calculated by `ary.sum / ary.length` without floating-point arithmetic errors. If we provide this method in the core, why not provide `stddev` or `variance`, which need complex calculations to avoid floating-point arithmetic errors. If this feature request will be accepted by any chance, I prefer `mean` over `average` because in many languages, such a functions are named `mean` instead of `average`. For example Python's `statistics.mean`, pandas's `pandas.Series.mean`, NumPy's `numpy.mean`, Julia's `Statistics.mean`, Boost's ``, etc. ---------------------------------------- Feature #18057: Introduce Array#average https://bugs.ruby-lang.org/issues/18057#change-93084 * Author: ggmichaelgo (Michael Go) * Status: Open * Priority: Normal ---------------------------------------- Introduce Array#average to calculate the average value of an array. ```ruby array = [1, 2, 3] array.average # 2 array = [1.5, 2.2, 3.1] array.average(&:round) # 2 array = [-3, -2, -1] array.average { |e| e.abs } # 2 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: