* complex.c: modified doc.
* ratioanl.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b04aa4d2cf
commit
e864787c84
@ -1,3 +1,8 @@
|
|||||||
|
Sat Nov 10 19:28:16 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* complex.c: modified doc.
|
||||||
|
* ratioanl.c: ditto.
|
||||||
|
|
||||||
Sat Nov 10 18:20:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
Sat Nov 10 18:20:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* ext/date/date_parse.c: edited about era.
|
* ext/date/date_parse.c: edited about era.
|
||||||
|
@ -482,6 +482,7 @@ f_complex_new2(VALUE klass, VALUE x, VALUE y)
|
|||||||
* Returns x+i*y;
|
* Returns x+i*y;
|
||||||
*
|
*
|
||||||
* Complex(1, 2) #=> (1+2i)
|
* Complex(1, 2) #=> (1+2i)
|
||||||
|
* Complex('1+2i') #=> (1+2i)
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
|
nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
|
||||||
@ -1427,6 +1428,8 @@ nucomp_to_f(VALUE self)
|
|||||||
* Complex(1, 0).to_r #=> (1/1)
|
* Complex(1, 0).to_r #=> (1/1)
|
||||||
* Complex(1, 0.0).to_r # RangeError
|
* Complex(1, 0.0).to_r # RangeError
|
||||||
* Complex(1, 2).to_r # RangeError
|
* Complex(1, 2).to_r # RangeError
|
||||||
|
*
|
||||||
|
* See rationalize.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
nucomp_to_r(VALUE self)
|
nucomp_to_r(VALUE self)
|
||||||
@ -1446,12 +1449,13 @@ nucomp_to_r(VALUE self)
|
|||||||
* cmp.rationalize([eps]) -> rational
|
* cmp.rationalize([eps]) -> rational
|
||||||
*
|
*
|
||||||
* Returns the value as a rational if possible (the imaginary part
|
* Returns the value as a rational if possible (the imaginary part
|
||||||
* should be exactly zero). The optional argument eps is always
|
* should be exactly zero).
|
||||||
* ignored.
|
|
||||||
*
|
*
|
||||||
* Complex(1.0/3, 0).rationalize #=> (1/3)
|
* Complex(1.0/3, 0).rationalize #=> (1/3)
|
||||||
* Complex(1, 0.0).rationalize # RangeError
|
* Complex(1, 0.0).rationalize # RangeError
|
||||||
* Complex(1, 2).rationalize # RangeError
|
* Complex(1, 2).rationalize # RangeError
|
||||||
|
*
|
||||||
|
* See to_r.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
nucomp_rationalize(int argc, VALUE *argv, VALUE self)
|
nucomp_rationalize(int argc, VALUE *argv, VALUE self)
|
||||||
|
13
rational.c
13
rational.c
@ -550,6 +550,7 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
|
|||||||
* Returns x/y;
|
* Returns x/y;
|
||||||
*
|
*
|
||||||
* Rational(1, 2) #=> (1/2)
|
* Rational(1, 2) #=> (1/2)
|
||||||
|
* Rational('1/2') #=> (1/2)
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
nurat_f_rational(int argc, VALUE *argv, VALUE klass)
|
nurat_f_rational(int argc, VALUE *argv, VALUE klass)
|
||||||
@ -1450,7 +1451,7 @@ nurat_rationalize_internal(VALUE a, VALUE b, VALUE *p, VALUE *q)
|
|||||||
* rat.rationalize -> self
|
* rat.rationalize -> self
|
||||||
* rat.rationalize(eps) -> rational
|
* rat.rationalize(eps) -> rational
|
||||||
*
|
*
|
||||||
* Returns a simpler approximation of the value if an optional
|
* Returns a simpler approximation of the value if the optional
|
||||||
* argument eps is given (rat-|eps| <= result <= rat+|eps|), self
|
* argument eps is given (rat-|eps| <= result <= rat+|eps|), self
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*
|
*
|
||||||
@ -1793,7 +1794,7 @@ nilclass_to_r(VALUE self)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* nil.rationalize([eps]) -> (0/1)
|
* nil.rationalize([eps]) -> (0/1)
|
||||||
*
|
*
|
||||||
* Returns zero as a rational. An optional argument eps is always
|
* Returns zero as a rational. The optional argument eps is always
|
||||||
* ignored.
|
* ignored.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -1822,7 +1823,7 @@ integer_to_r(VALUE self)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* int.rationalize([eps]) -> rational
|
* int.rationalize([eps]) -> rational
|
||||||
*
|
*
|
||||||
* Returns the value as a rational. An optional argument eps is
|
* Returns the value as a rational. The optional argument eps is
|
||||||
* always ignored.
|
* always ignored.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -1872,6 +1873,8 @@ float_decode(VALUE self)
|
|||||||
* 2.5.to_r #=> (5/2)
|
* 2.5.to_r #=> (5/2)
|
||||||
* -0.75.to_r #=> (-3/4)
|
* -0.75.to_r #=> (-3/4)
|
||||||
* 0.0.to_r #=> (0/1)
|
* 0.0.to_r #=> (0/1)
|
||||||
|
*
|
||||||
|
* See rationalize.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
float_to_r(VALUE self)
|
float_to_r(VALUE self)
|
||||||
@ -1900,12 +1903,14 @@ float_to_r(VALUE self)
|
|||||||
* flt.rationalize([eps]) -> rational
|
* flt.rationalize([eps]) -> rational
|
||||||
*
|
*
|
||||||
* Returns a simpler approximation of the value (flt-|eps| <= result
|
* Returns a simpler approximation of the value (flt-|eps| <= result
|
||||||
* <= flt+|eps|). if eps is not given, it will be chosen
|
* <= flt+|eps|). if the optional eps is not given, it will be chosen
|
||||||
* automatically.
|
* automatically.
|
||||||
*
|
*
|
||||||
* 0.3.rationalize #=> (3/10)
|
* 0.3.rationalize #=> (3/10)
|
||||||
* 1.333.rationalize #=> (1333/1000)
|
* 1.333.rationalize #=> (1333/1000)
|
||||||
* 1.333.rationalize(0.01) #=> (4/3)
|
* 1.333.rationalize(0.01) #=> (4/3)
|
||||||
|
*
|
||||||
|
* See to_r.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
float_rationalize(int argc, VALUE *argv, VALUE self)
|
float_rationalize(int argc, VALUE *argv, VALUE self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user