From 40d6a7527e6ea663585ea3d82b2e3968fe0d4836 Mon Sep 17 00:00:00 2001 From: tadf Date: Fri, 19 Jun 2009 23:57:34 +0000 Subject: * complex.c: edited rdoc. * rational.c: ditto. * numeric.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++ complex.c | 34 +++++++++++++------------- numeric.c | 82 +++++++++++++++++++++++++++++++------------------------------- rational.c | 43 +++++++++++++++----------------- 4 files changed, 86 insertions(+), 81 deletions(-) diff --git a/ChangeLog b/ChangeLog index 894e5e6ea3..15c5ae3ccf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Jun 20 08:56:47 2009 Tadayoshi Funaba + + * complex.c: edited rdoc. + + * rational.c: ditto. + + * numeric.c: ditto. + Sat Jun 20 07:17:52 2009 Yukihiro Matsumoto * lib/monitor.rb (MonitorMixin::extend_object): should use diff --git a/complex.c b/complex.c index d3850ac4e5..30c4199063 100644 --- a/complex.c +++ b/complex.c @@ -527,7 +527,7 @@ nucomp_s_polar(VALUE klass, VALUE abs, VALUE arg) /* * call-seq: - * cmp.real => numeric + * cmp.real => real * * Returns the real part. */ @@ -540,8 +540,8 @@ nucomp_real(VALUE self) /* * call-seq: - * cmp.imag => numeric - * cmp.imaginary => numeric + * cmp.imag => real + * cmp.imaginary => real * * Returns the imaginary part. */ @@ -793,9 +793,9 @@ nucomp_expt(VALUE self, VALUE other) /* * call-seq: - * cmp == numeric => true or false + * cmp == object => true or false * - * Returns true if cmp equals numeric numerically. + * Returns true if cmp equals object numerically. */ static VALUE nucomp_equal_p(VALUE self, VALUE other) @@ -843,7 +843,7 @@ nucomp_abs(VALUE self) /* * call-seq: - * cmp.abs2 => float + * cmp.abs2 => real * * Returns square of the absolute value. */ @@ -898,8 +898,8 @@ nucomp_polar(VALUE self) /* * call-seq: - * cmp.conj => numeric - * cmp.conjucate => numeric + * cmp.conj => complex + * cmp.conjucate => complex * * Returns the complex conjucate. */ @@ -949,7 +949,7 @@ extern VALUE rb_lcm(VALUE x, VALUE y); /* * call-seq: - * cmp.denominator => numeric + * cmp.denominator => integer * * Returns the denominator. * @@ -1559,7 +1559,7 @@ numeric_imag(VALUE self) /* * call-seq: - * num.abs2 => numeric + * num.abs2 => real * * Returns square of self. */ @@ -1573,11 +1573,11 @@ numeric_abs2(VALUE self) /* * call-seq: - * num.arg => numeric - * num.angle => numeric - * num.phase => numeric + * num.arg => float + * num.angle => float + * num.phase => float * - * Returns 0 if the value is positive otherwise pi. + * Returns 0 if the value is positive, pi otherwise. */ static VALUE numeric_arg(VALUE self) @@ -1625,14 +1625,14 @@ numeric_conj(VALUE self) } /* - * Complex provides complex number class. - * it's so simple. it's not real. but really numeric. + * Complex provides complex number. + * it's simple. it's not real. but really numeric. * * Complex(0) #=> (0+0i) * Complex(1, 2) #=> (1+2i) * Complex.rect(1, 2) #=> (1+2i) * Complex(1.1, 3.3) #=> (1.1+3.3i) - * Complex(Rational(1, 2),Rational(2, 3)) + * Complex(Rational(1, 2), Rational(2, 3)) * #=> ((1/2)+(2/3)*i) * Complex.polar(1, 2) #=> (-0.4161468365471424+0.9092974268256817i) * diff --git a/numeric.c b/numeric.c index a2bd0f4ebf..cf3f0d2455 100644 --- a/numeric.c +++ b/numeric.c @@ -256,7 +256,7 @@ num_uminus(VALUE num) /* * call-seq: - * num.quo(numeric) => result + * num.quo(numeric) => real * * Returns most exact division (rational for integers, float for floats). */ @@ -355,7 +355,7 @@ num_divmod(VALUE x, VALUE y) /* * call-seq: - * num.modulo(numeric) => result + * num.modulo(numeric) => real * * x.modulo(y) means x-y*(x/y).floor * @@ -373,7 +373,7 @@ num_modulo(VALUE x, VALUE y) /* * call-seq: - * num.remainder(numeric) => result + * num.remainder(numeric) => real * * x.remainder(y) means x-y*(x/y).truncate * @@ -425,8 +425,8 @@ num_int_p(VALUE num) /* * call-seq: - * num.abs => num - * num.magnitude => num + * num.abs => numeric + * num.magnitude => numeric * * Returns the absolute value of num. * @@ -502,7 +502,7 @@ num_to_int(VALUE num) * * Document-class: Float * - * Float objects represent real numbers using the native + * Float objects represent inexact numbers using the native * architecture's double-precision floating point representation. */ @@ -804,7 +804,7 @@ flo_divmod(VALUE x, VALUE y) * Raises float the other power. * * 2.0**3 #=> 8.0 - * (-8.0)**0.5 #=> NaN # try Complex(-8.0)**0.5 + * (-8.0)**0.5 #=> NaN # try (-8.0)**Complex(0.5) */ static VALUE @@ -934,10 +934,10 @@ rb_dbl_cmp(double a, double b) /* * call-seq: - * flt <=> numeric => -1, 0, +1 + * flt <=> real => -1, 0, +1 * * Returns -1, 0, or +1 depending on whether flt is less than, - * equal to, or greater than numeric. This is the basis for the + * equal to, or greater than real. This is the basis for the * tests in Comparable. */ @@ -978,9 +978,9 @@ flo_cmp(VALUE x, VALUE y) /* * call-seq: - * flt > other => true or false + * flt > real => true or false * - * true if flt is greater than other. + * true if flt is greater than real. */ static VALUE @@ -1016,10 +1016,10 @@ flo_gt(VALUE x, VALUE y) /* * call-seq: - * flt >= other => true or false + * flt >= real => true or false * * true if flt is greater than - * or equal to other. + * or equal to real. */ static VALUE @@ -1055,9 +1055,9 @@ flo_ge(VALUE x, VALUE y) /* * call-seq: - * flt < other => true or false + * flt < real => true or false * - * true if flt is less than other. + * true if flt is less than real. */ static VALUE @@ -1093,10 +1093,10 @@ flo_lt(VALUE x, VALUE y) /* * call-seq: - * flt <= other => true or false + * flt <= rael => true or false * * true if flt is less than - * or equal to other. + * or equal to real. */ static VALUE @@ -1800,12 +1800,12 @@ rb_num2ull(VALUE val) /* * call-seq: - * int.to_i => int - * int.to_int => int - * int.floor => int - * int.ceil => int - * int.round => int - * int.truncate => int + * int.to_i => integer + * int.to_int => integer + * int.floor => integer + * int.ceil => integer + * int.round => integer + * int.truncate => integer * * As int is already an Integer, all these * methods simply return the receiver. @@ -2329,8 +2329,8 @@ fix_idiv(VALUE x, VALUE y) /* * call-seq: - * fix % other => numeric - * fix.modulo(other) => numeric + * fix % other => real + * fix.modulo(other) => real * * Returns fix modulo other. * See numeric.divmod for more information. @@ -2436,15 +2436,15 @@ int_pow(long x, unsigned long y) /* * call-seq: - * fix ** other => numeric + * fix ** numeric => numeric_result * - * Raises fix to the other power, which may + * Raises fix to the numeric power, which may * be negative or fractional. * * 2 ** 3 #=> 8 * 2 ** -1 #=> 0.5 * 2 ** 0.5 #=> 1.4142135623731 - * (-8)**0.5 #=> NaN # try Complex(-8)**Rational(1,2) + * (-8)**0.5 #=> NaN # try (-8)**Complex(0.5) */ static VALUE @@ -2554,10 +2554,10 @@ fix_cmp(VALUE x, VALUE y) /* * call-seq: - * fix > other => true or false + * fix > real => true or false * * Returns true if the value of fix is - * greater than that of other. + * greater than that of real. */ static VALUE @@ -2579,10 +2579,10 @@ fix_gt(VALUE x, VALUE y) /* * call-seq: - * fix >= other => true or false + * fix >= real => true or false * * Returns true if the value of fix is - * greater than or equal to that of other. + * greater than or equal to that of real. */ static VALUE @@ -2604,10 +2604,10 @@ fix_ge(VALUE x, VALUE y) /* * call-seq: - * fix < other => true or false + * fix < real => true or false * * Returns true if the value of fix is - * less than that of other. + * less than that of real. */ static VALUE @@ -2629,10 +2629,10 @@ fix_lt(VALUE x, VALUE y) /* * call-seq: - * fix <= other => true or false + * fix <= rael => true or false * * Returns true if the value of fix is - * less than or equal to that of other. + * less than or equal to that of real. */ static VALUE @@ -2682,7 +2682,7 @@ bit_coerce(VALUE x) /* * call-seq: - * fix & other => integer + * fix & integer => integer_result * * Bitwise AND. */ @@ -2701,7 +2701,7 @@ fix_and(VALUE x, VALUE y) /* * call-seq: - * fix | other => integer + * fix | integer => integer_result * * Bitwise OR. */ @@ -2720,7 +2720,7 @@ fix_or(VALUE x, VALUE y) /* * call-seq: - * fix ^ other => integer + * fix ^ integer => integer_result * * Bitwise EXCLUSIVE OR. */ @@ -2868,8 +2868,8 @@ fix_to_f(VALUE num) /* * call-seq: - * fix.abs => fix - * fix.magnitude => fix + * fix.abs => integer + * fix.magnitude => integer * * Returns the absolute value of fix. * diff --git a/rational.c b/rational.c index 35f5c40121..d76983f353 100644 --- a/rational.c +++ b/rational.c @@ -1019,19 +1019,19 @@ nurat_cmp(VALUE self, VALUE other) /* * call-seq: - * rat == numeric => +true+ or +false+ + * rat == object => true or false * - * Tests for equality. Returns +true+ if _rat_ is equal to _numeric_; +false+ + * Tests for equality. Returns +true+ if _rat_ is equal to _object_; +false+ * otherwise. * * For example: * - * Rational(2, 3) == Rational(2, 3) #=> +true+ - * Rational(5) == 5 #=> +true+ - * Rational(7, 1) == Rational(7) #=> +true+ - * Rational(-2, 9) == Rational(-9, 2) #=> +false+ - * Rational(9, 8) == 4 #=> +false+ - * Rational(5, 3) == 'string' #=> +false+ + * Rational(2, 3) == Rational(2, 3) #=> true + * Rational(5) == 5 #=> true + * Rational(7, 1) == Rational(7) #=> true + * Rational(-2, 9) == Rational(-9, 2) #=> false + * Rational(9, 8) == 4 #=> false + * Rational(5, 3) == 'string' #=> false */ static VALUE nurat_equal_p(VALUE self, VALUE other) @@ -1121,8 +1121,8 @@ nurat_idiv(VALUE self, VALUE other) /* * call-seq: - * rat.modulo(numeric) => numeric - * rat % numeric => numeric + * rat.modulo(numeric) => real + * rat % numeric => real * * Returns the modulo of _rat_ and _numeric_ as a +Numeric+ object. * @@ -1152,8 +1152,9 @@ nurat_mod(VALUE self, VALUE other) * call-seq: * rat.divmod(numeric) => array * - * Returns a two-element +Array+ containing the quotient and modulus obtained - * by dividing _rat_ by _numeric_. Both elements are +Numeric+. + * Returns a two-element +Array+ containing the quotient and modulus + * obtained by dividing _rat_ by _numeric_. The first element is + * an integer. The second selement is a real. * * A +ZeroDivisionError+ is raised if _numeric_ is 0. A +FloatDomainError+ is * raised if _numeric_ is 0.0. A +TypeError+ is raised unless _numeric_ is a @@ -1187,7 +1188,7 @@ nurat_quot(VALUE self, VALUE other) /* * call-seq: - * rat.remainder(numeric) => numeric_result + * rat.remainder(numeric) => real * * Returns the remainder of dividing _rat_ by _numeric_ as a +Numeric+ object. * @@ -1327,7 +1328,7 @@ nurat_round_common(int argc, VALUE *argv, VALUE self, /* * call-seq: * rat.floor => integer - * rat.floor(precision=0) => numeric + * rat.floor(precision=0) => rational * * Returns the largest integer less than or equal to _rat_ as an +Integer+ * object. Contrast with +Rational#ceil+. @@ -1362,7 +1363,7 @@ nurat_floor_n(int argc, VALUE *argv, VALUE self) /* * call-seq: * rat.ceil => integer - * rat.ceil(precision=0) => numeric + * rat.ceil(precision=0) => rational * * Returns the smallest integer greater than or equal to _rat_ as an +Integer+ * object. Contrast with +Rational#floor+. @@ -1397,7 +1398,7 @@ nurat_ceil_n(int argc, VALUE *argv, VALUE self) /* * call-seq: * rat.truncate => integer - * rat.truncate(precision=0) => numeric + * rat.truncate(precision=0) => rational * * Truncates self to an integer and returns the result as an +Integer+ object. * @@ -1431,7 +1432,7 @@ nurat_truncate_n(int argc, VALUE *argv, VALUE self) /* * call-seq: * rat.round => integer - * rat.round(precision=0) => numeric + * rat.round(precision=0) => rational * * Rounds _rat_ to an integer, and returns the result as an +Integer+ object. * @@ -1799,13 +1800,9 @@ float_denominator(VALUE self) /* * call-seq: - * nil.to_r => Rational(0, 1) + * nil.to_r => (0/1) * * Returns a +Rational+ object representing _nil_ as a rational number. - * - * For example: - * - * nil.to_r #=> (0/1) */ static VALUE nilclass_to_r(VALUE self) @@ -2139,7 +2136,7 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass) * Rational(0.5) #=> (1/2) * Rational("2/7") #=> (2/7) * Rational("0.25") #=> (1/4) - * Rational(10e3) #=> (10000/1) + * Rational("10e3") #=> (10000/1) * * The first argument is the numerator, the second the denominator. If the * denominator is not supplied it defaults to 1. The arguments can be -- cgit v1.2.3