diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-14 12:56:38 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-14 12:56:38 +0000 |
commit | df941c91b10d4a77631ecc85c51dc527642684b7 (patch) | |
tree | 7be4d0f57463f8f89d1f72a8ef7507aef97d8b1e /array.c | |
parent | 76426c7ea573785b8c7d3a0b4cfd15d2555741e4 (diff) | |
download | ruby-df941c91b10d4a77631ecc85c51dc527642684b7.tar.gz |
[DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -5667,9 +5667,13 @@ rb_ary_dig(int argc, VALUE *argv, VALUE self) * [].sum(0.0) #=> 0.0 * [1, 2, 3].sum #=> 6 * [3, 5.5].sum #=> 8.5 - * [2.5, 3.0].sum(0.0) {|v| v * v } #=> 15.25 + * [2.5, 3.0].sum(0.0) {|e| e * e } #=> 15.25 * [Object.new].sum #=> TypeError * + * The (arithmetic) mean value of an array can be obtained* as follows. + * + * mean = ary.sum(0.0) / ary.length + * * This method may not respect method redefinition of "+" methods * such as Fixnum#+. * |