diff --git a/ChangeLog b/ChangeLog index b262d6d737..62a706f907 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Mar 9 21:52:19 2013 Zachary Scott + + * 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] + Sat Mar 9 21:46:41 2013 Eric Hodel * doc/globals.rdoc: Document what setting $DEBUG does. diff --git a/numeric.c b/numeric.c index cacccb9df6..3216b79ffa 100644 --- a/numeric.c +++ b/numeric.c @@ -522,8 +522,10 @@ num_real_p(VALUE num) * call-seq: * num.integer? -> true or false * - * Returns true if num is an Integer - * (including Fixnum and Bignum). + * 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) * call-seq: * num.to_int -> integer * - * Invokes the child class's to_i method to convert - * num 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) /* * call-seq: - * flt % other -> float - * flt.modulo(other) -> float + * float % other -> float + * float.modulo(other) -> float * - * Return the modulo after division of flt by other. + * 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) /* * call-seq: - * flt.divmod(numeric) -> array + * float.divmod(numeric) -> array * - * See Numeric#divmod. + * See Numeric#divmod. + * + * 42.0.divmod 6 #=> [7, 0.0] + * 42.0.divmod 5 #=> [8, 2.0] */ static VALUE diff --git a/version.h b/version.h index bd1e4e16b2..0b3988beb8 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-03-09" -#define RUBY_PATCHLEVEL 27 +#define RUBY_PATCHLEVEL 28 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 3