mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (nucomp_to_c): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c07d295204
commit
4d03af3d9c
2 changed files with 20 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Nov 21 21:53:29 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c (nucomp_to_c): added.
|
||||
|
||||
Wed Nov 21 21:35:38 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* include/ruby/util.h: removed extra semicolon in definition of
|
||||
|
|
16
complex.c
16
complex.c
|
@ -1472,6 +1472,21 @@ nucomp_rationalize(int argc, VALUE *argv, VALUE self)
|
|||
return rb_funcall2(dat->real, rb_intern("rationalize"), argc, argv);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* complex.to_c -> self
|
||||
*
|
||||
* Returns self.
|
||||
*
|
||||
* Complex(2).to_c #=> (2+0i)
|
||||
* Complex(-8, 6).to_c #=> (-8+6i)
|
||||
*/
|
||||
static VALUE
|
||||
nucomp_to_c(VALUE self)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* nil.to_c -> (0+0i)
|
||||
|
@ -2178,6 +2193,7 @@ Init_Complex(void)
|
|||
rb_define_method(rb_cComplex, "to_f", nucomp_to_f, 0);
|
||||
rb_define_method(rb_cComplex, "to_r", nucomp_to_r, 0);
|
||||
rb_define_method(rb_cComplex, "rationalize", nucomp_rationalize, -1);
|
||||
rb_define_method(rb_cComplex, "to_c", nucomp_to_c, 0);
|
||||
rb_define_method(rb_cNilClass, "to_c", nilclass_to_c, 0);
|
||||
rb_define_method(rb_cNumeric, "to_c", numeric_to_c, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue