mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
modified some descriptions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
16cb5ce483
commit
4ffe7a1734
2 changed files with 11 additions and 11 deletions
|
@ -1077,7 +1077,7 @@ extern VALUE rb_lcm(VALUE x, VALUE y);
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* cmp.denominator -> integer
|
* cmp.denominator -> integer
|
||||||
*
|
*
|
||||||
* Returns the denominator (lcm of both denominator, real and imag).
|
* Returns the denominator (lcm of both denominator - real and imag).
|
||||||
*
|
*
|
||||||
* See numerator.
|
* See numerator.
|
||||||
*/
|
*/
|
||||||
|
@ -1646,7 +1646,7 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
if (k_numeric_p(a1) && !f_real_p(a1))
|
if (k_numeric_p(a1) && !f_real_p(a1))
|
||||||
return a1;
|
return a1;
|
||||||
/* expect raise exception for consistency */
|
/* should raise exception for consistency */
|
||||||
if (!k_numeric_p(a1))
|
if (!k_numeric_p(a1))
|
||||||
return rb_convert_type(a1, T_COMPLEX, "Complex", "to_c");
|
return rb_convert_type(a1, T_COMPLEX, "Complex", "to_c");
|
||||||
}
|
}
|
||||||
|
|
18
rational.c
18
rational.c
|
@ -667,7 +667,7 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat + numeric -> numeric_result
|
* rat + numeric -> numeric
|
||||||
*
|
*
|
||||||
* Performs addition.
|
* Performs addition.
|
||||||
*
|
*
|
||||||
|
@ -709,7 +709,7 @@ nurat_add(VALUE self, VALUE other)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat - numeric -> numeric_result
|
* rat - numeric -> numeric
|
||||||
*
|
*
|
||||||
* Performs subtraction.
|
* Performs subtraction.
|
||||||
*
|
*
|
||||||
|
@ -790,7 +790,7 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat * numeric -> numeric_result
|
* rat * numeric -> numeric
|
||||||
*
|
*
|
||||||
* Performs multiplication.
|
* Performs multiplication.
|
||||||
*
|
*
|
||||||
|
@ -832,8 +832,8 @@ nurat_mul(VALUE self, VALUE other)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat / numeric -> numeric_result
|
* rat / numeric -> numeric
|
||||||
* rat.quo(numeric) -> numeric_result
|
* rat.quo(numeric) -> numeric
|
||||||
*
|
*
|
||||||
* Performs division.
|
* Performs division.
|
||||||
*
|
*
|
||||||
|
@ -913,7 +913,7 @@ nurat_fdiv(VALUE self, VALUE other)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat ** numeric -> numeric_result
|
* rat ** numeric -> numeric
|
||||||
*
|
*
|
||||||
* Performs exponentiation.
|
* Performs exponentiation.
|
||||||
*
|
*
|
||||||
|
@ -1145,7 +1145,6 @@ nurat_ceil(VALUE self)
|
||||||
return f_negate(f_idiv(f_negate(dat->num), dat->den));
|
return f_negate(f_idiv(f_negate(dat->num), dat->den));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat.to_i -> integer
|
* rat.to_i -> integer
|
||||||
|
@ -2224,8 +2223,8 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
||||||
* a/b (b>0). Where a is numerator and b is denominator. Integer a
|
* a/b (b>0). Where a is numerator and b is denominator. Integer a
|
||||||
* equals rational a/1 mathematically.
|
* equals rational a/1 mathematically.
|
||||||
*
|
*
|
||||||
* In ruby, you can create rational object with Rational or to_r
|
* In ruby, you can create rational object with Rational, to_r or
|
||||||
* method. The return values will be irreducible.
|
* rationalize method. The return values will be irreducible.
|
||||||
*
|
*
|
||||||
* Rational(1) #=> (1/1)
|
* Rational(1) #=> (1/1)
|
||||||
* Rational(2, 3) #=> (2/3)
|
* Rational(2, 3) #=> (2/3)
|
||||||
|
@ -2242,6 +2241,7 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
||||||
* 0.3.to_r #=> (5404319552844595/18014398509481984)
|
* 0.3.to_r #=> (5404319552844595/18014398509481984)
|
||||||
* '0.3'.to_r #=> (3/10)
|
* '0.3'.to_r #=> (3/10)
|
||||||
* '2/3'.to_r #=> (2/3)
|
* '2/3'.to_r #=> (2/3)
|
||||||
|
* 0.3.rationalize #=> (3/10)
|
||||||
*
|
*
|
||||||
* A rational object is an exact number, which helps you to write
|
* A rational object is an exact number, which helps you to write
|
||||||
* program without any rounding errors.
|
* program without any rounding errors.
|
||||||
|
|
Loading…
Reference in a new issue