From d11b549104e21dfcc57f6769beab3e2ccf292230 Mon Sep 17 00:00:00 2001 From: tadf Date: Fri, 19 Jun 2009 14:44:03 +0000 Subject: * numeric.c: edited rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ numeric.c | 47 +++++++++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6378a5f1b3..e4c7fa8d8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jun 19 23:43:38 2009 Tadayoshi Funaba + + * numeric.c: edited rdoc. + Fri Jun 19 22:58:16 2009 Tadayoshi Funaba * rational.c; edited rdoc. diff --git a/numeric.c b/numeric.c index aee74cb098..627c5297c1 100644 --- a/numeric.c +++ b/numeric.c @@ -425,7 +425,8 @@ num_int_p(VALUE num) /* * call-seq: - * num.abs => num or numeric + * num.abs => num or numeric + * num.magnitude => num or numeric * * Returns the absolute value of num. * @@ -463,9 +464,9 @@ num_zero_p(VALUE num) /* * call-seq: - * num.nonzero? => num or nil + * num.nonzero? => self or nil * - * Returns num if num is not zero, nil + * Returns self if num is not zero, nil * otherwise. This behavior is useful when chaining comparisons: * * a = %w( z Bb bB bb BB a aA Aa AA A ) @@ -801,6 +802,9 @@ flo_divmod(VALUE x, VALUE y) * flt ** other => float * * Raises float the other power. + * + * 2.0**3 #=> 8.0 + * (-8.0)**0.5 #=> NaN # try Complex(-8.0)**0.5 */ static VALUE @@ -1167,7 +1171,8 @@ flo_to_f(VALUE num) /* * call-seq: - * flt.abs => float + * flt.abs => float + * flt.magnitude => num or numeric * * Returns the absolute value of flt. * @@ -1498,21 +1503,22 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl) /* * call-seq: - * num.step(limit, step ) {|i| block } => self + * num.step(limit[, step]) {|i| block } => self + * num.step(limit[, step]) => enumerator * * Invokes block with the sequence of numbers starting at - * num, incremented by step on each call. The loop - * finishes when the value to be passed to the block is greater than - * limit (if step is positive) or less than - * limit (if step is negative). If all the arguments are - * integers, the loop operates using an integer counter. If any of the - * arguments are floating point numbers, all are converted to floats, - * and the loop is executed floor(n + n*epsilon)+ 1 times, - * where n = (limit - num)/step. Otherwise, the loop - * starts at num, uses either the < or - * > operator to compare the counter against - * limit, and increments itself using the + - * operator. + * num, incremented by step (default 1) on each + * call. The loop finishes when the value to be passed to the block + * is greater than limit (if step is positive) or less + * than limit (if step is negative). If all the + * arguments are integers, the loop operates using an integer + * counter. If any of the arguments are floating point numbers, all + * are converted to floats, and the loop is executed floor(n + + * n*epsilon)+ 1 times, where n = (limit - + * num)/step. Otherwise, the loop starts at num, uses + * either the < or > operator to compare + * the counter against limit, and increments itself using the + * + operator. * * 1.step(10, 2) { |i| print i, " " } * Math::E.step(Math::PI, 0.2) { |f| print f, " " } @@ -2438,6 +2444,7 @@ int_pow(long x, unsigned long y) * 2 ** 3 #=> 8 * 2 ** -1 #=> 0.5 * 2 ** 0.5 #=> 1.4142135623731 + * (-8)**0.5 #=> NaN # try Complex(-8)**Rational(1,2) */ static VALUE @@ -2861,7 +2868,8 @@ fix_to_f(VALUE num) /* * call-seq: - * fix.abs => fix + * fix.abs => fix + * fix.magnitude => fix * * Returns the absolute value of fix. * @@ -2903,6 +2911,7 @@ fix_size(VALUE fix) /* * call-seq: * int.upto(limit) {|i| block } => self + * int.upto(limit) => enumerator * * Iterates block, passing in integer values from int * up to and including limit. @@ -2941,6 +2950,7 @@ int_upto(VALUE from, VALUE to) /* * call-seq: * int.downto(limit) {|i| block } => self + * int.downto(limit) => enumerator * * Iterates block, passing decreasing values from int * down to and including limit. @@ -2980,6 +2990,7 @@ int_downto(VALUE from, VALUE to) /* * call-seq: * int.times {|i| block } => self + * int.times => enumerator * * Iterates block int times, passing in values from zero to * int - 1. -- cgit v1.2.3