[前][次][番号順一覧][スレッド一覧]

ruby-changes:42504

From: akr <ko1@a...>
Date: Thu, 14 Apr 2016 21:00:01 +0900 (JST)
Subject: [ruby-changes:42504] akr:r54578 (trunk): [DOC]

akr	2016-04-14 21:56:38 +0900 (Thu, 14 Apr 2016)

  New Revision: 54578

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54578

  Log:
    [DOC]

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 54577)
+++ array.c	(revision 54578)
@@ -5667,9 +5667,13 @@ rb_ary_dig(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L5667
  *   [].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#+.
  *

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]