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

ruby-changes:27317

From: zzak <ko1@a...>
Date: Fri, 22 Feb 2013 11:01:38 +0900 (JST)
Subject: [ruby-changes:27317] zzak:r39369 (trunk): * numeric.c: Examples and formatting for Numeric and Float

zzak	2013-02-22 11:01:28 +0900 (Fri, 22 Feb 2013)

  New Revision: 39369

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39369

  Log:
    * numeric.c: Examples and formatting for Numeric and Float
      Based on a patch by Zach Morek and Oren K of newhaven.rb
      [Github documenting-ruby/ruby#5]

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39368)
+++ ChangeLog	(revision 39369)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 22 11:00:00 2013  Zachary Scott  <zachary@z...>
+
+	* numeric.c: Examples and formatting for Numeric and Float
+	  Based on a patch by Zach Morek and Oren K of newhaven.rb
+	  [Github documenting-ruby/ruby#5]
+
 Fri Feb 22 07:04:41 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems/installer.rb (build_extensions):  Create extension
Index: numeric.c
===================================================================
--- numeric.c	(revision 39368)
+++ numeric.c	(revision 39369)
@@ -522,8 +522,10 @@ num_real_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L522
  *  call-seq:
  *     num.integer?  ->  true or false
  *
- *  Returns <code>true</code> if <i>num</i> is an <code>Integer</code>
- *  (including <code>Fixnum</code> and <code>Bignum</code>).
+ *  Returns +true+ if +num+ is an Integer (including Fixnum and Bignum).
+ *
+ *      (1.0).integer? #=> false
+ *      (1).integer?   #=> true
  */
 
 static VALUE
@@ -596,8 +598,11 @@ num_nonzero_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L598
  *  call-seq:
  *     num.to_int  ->  integer
  *
- *  Invokes the child class's <code>to_i</code> method to convert
- *  <i>num</i> to an integer.
+ *  Invokes the child class's +to_i+ method to convert +num+ to an integer.
+ *
+ *      1.0.class => Float
+ *      1.0.to_int.class => Fixnum
+ *      1.0.to_i.class => Fixnum
  */
 
 static VALUE
@@ -899,10 +904,10 @@ ruby_float_mod(double x, double y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L904
 
 /*
  *  call-seq:
- *     flt % other        ->  float
- *     flt.modulo(other)  ->  float
+ *     float % other        ->  float
+ *     float.modulo(other)  ->  float
  *
- *  Return the modulo after division of <code>flt</code> by <code>other</code>.
+ *  Return the modulo after division of +float+ by +other+.
  *
  *     6543.21.modulo(137)      #=> 104.21
  *     6543.21.modulo(137.24)   #=> 92.9299999999996
@@ -941,9 +946,12 @@ dbl2ival(double d) https://github.com/ruby/ruby/blob/trunk/numeric.c#L946
 
 /*
  *  call-seq:
- *     flt.divmod(numeric)  ->  array
+ *     float.divmod(numeric)  ->  array
+ *
+ *  See Numeric#divmod.
  *
- *  See <code>Numeric#divmod</code>.
+ *      42.0.divmod 6 #=> [7, 0.0]
+ *      42.0.divmod 5 #=> [8, 2.0]
  */
 
 static VALUE

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

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