mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
RDoc for complex.c
This commit is contained in:
parent
f0efeddd41
commit
86ef38194b
1 changed files with 32 additions and 39 deletions
71
complex.c
71
complex.c
|
@ -1932,9 +1932,9 @@ nilclass_to_c(VALUE self)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.to_c -> complex
|
||||
* to_c -> complex
|
||||
*
|
||||
* Returns the value as a complex.
|
||||
* Returns +self+ as a Complex object.
|
||||
*/
|
||||
static VALUE
|
||||
numeric_to_c(VALUE self)
|
||||
|
@ -2232,32 +2232,30 @@ string_to_c_strict(VALUE self, int raise)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* str.to_c -> complex
|
||||
* to_c -> complex
|
||||
*
|
||||
* Returns a complex which denotes the string form. The parser
|
||||
* ignores leading whitespaces and trailing garbage. Any digit
|
||||
* sequences can be separated by an underscore. Returns zero for null
|
||||
* or garbage string.
|
||||
* Returns +self+ interpreted as a Complex object;
|
||||
* leading whitespace and trailing garbage are ignored:
|
||||
*
|
||||
* '9'.to_c #=> (9+0i)
|
||||
* '2.5'.to_c #=> (2.5+0i)
|
||||
* '2.5/1'.to_c #=> ((5/2)+0i)
|
||||
* '-3/2'.to_c #=> ((-3/2)+0i)
|
||||
* '-i'.to_c #=> (0-1i)
|
||||
* '45i'.to_c #=> (0+45i)
|
||||
* '3-4i'.to_c #=> (3-4i)
|
||||
* '-4e2-4e-2i'.to_c #=> (-400.0-0.04i)
|
||||
* '-0.0-0.0i'.to_c #=> (-0.0-0.0i)
|
||||
* '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i)
|
||||
* 'ruby'.to_c #=> (0+0i)
|
||||
* '9'.to_c # => (9+0i)
|
||||
* '2.5'.to_c # => (2.5+0i)
|
||||
* '2.5/1'.to_c # => ((5/2)+0i)
|
||||
* '-3/2'.to_c # => ((-3/2)+0i)
|
||||
* '-i'.to_c # => (0-1i)
|
||||
* '45i'.to_c # => (0+45i)
|
||||
* '3-4i'.to_c # => (3-4i)
|
||||
* '-4e2-4e-2i'.to_c # => (-400.0-0.04i)
|
||||
* '-0.0-0.0i'.to_c # => (-0.0-0.0i)
|
||||
* '1/2+3/4i'.to_c # => ((1/2)+(3/4)*i)
|
||||
* '1.0@0'.to_c # => (1+0.0i)
|
||||
* "1.0@#{Math::PI/2}".to_c # => (0.0+1i)
|
||||
* "1.0@#{Math::PI}".to_c # => (-1+0.0i)
|
||||
*
|
||||
* Polar form:
|
||||
* include Math
|
||||
* "1.0@0".to_c #=> (1+0.0i)
|
||||
* "1.0@#{PI/2}".to_c #=> (0.0+1i)
|
||||
* "1.0@#{PI}".to_c #=> (-1+0.0i)
|
||||
* Returns \Complex zero if the string cannot be converted:
|
||||
*
|
||||
* See Kernel.Complex.
|
||||
* 'ruby'.to_c # => (0+0i)
|
||||
*
|
||||
* See Kernel#Complex.
|
||||
*/
|
||||
static VALUE
|
||||
string_to_c(VALUE self)
|
||||
|
@ -2368,9 +2366,9 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.abs2 -> real
|
||||
* abs2 -> real
|
||||
*
|
||||
* Returns square of self.
|
||||
* Returns the square of +self+.
|
||||
*/
|
||||
static VALUE
|
||||
numeric_abs2(VALUE self)
|
||||
|
@ -2380,11 +2378,9 @@ numeric_abs2(VALUE self)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.arg -> 0 or float
|
||||
* num.angle -> 0 or float
|
||||
* num.phase -> 0 or float
|
||||
* arg -> 0 or Math::PI
|
||||
*
|
||||
* Returns 0 if the value is positive, pi otherwise.
|
||||
* Returns zero if +self+ is positive, Math::PI otherwise.
|
||||
*/
|
||||
static VALUE
|
||||
numeric_arg(VALUE self)
|
||||
|
@ -2396,10 +2392,9 @@ numeric_arg(VALUE self)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.rect -> array
|
||||
* num.rectangular -> array
|
||||
* rect -> array
|
||||
*
|
||||
* Returns an array; [num, 0].
|
||||
* Returns array <tt>[self, 0]</tt>.
|
||||
*/
|
||||
static VALUE
|
||||
numeric_rect(VALUE self)
|
||||
|
@ -2409,9 +2404,9 @@ numeric_rect(VALUE self)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.polar -> array
|
||||
* polar -> array
|
||||
*
|
||||
* Returns an array; [num.abs, num.arg].
|
||||
* Returns array <tt>[self.abs, self.arg]</tt>.
|
||||
*/
|
||||
static VALUE
|
||||
numeric_polar(VALUE self)
|
||||
|
@ -2439,11 +2434,9 @@ numeric_polar(VALUE self)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* flo.arg -> 0 or float
|
||||
* flo.angle -> 0 or float
|
||||
* flo.phase -> 0 or float
|
||||
* arg -> 0 or Math::PI
|
||||
*
|
||||
* Returns 0 if the value is positive, pi otherwise.
|
||||
* Returns 0 if +self+ is positive, Math::PI otherwise.
|
||||
*/
|
||||
static VALUE
|
||||
float_arg(VALUE self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue