Ruby  1.9.3p551(2014-11-13revision48407)
Macros | Functions | Variables
complex.c File Reference
#include "ruby.h"
#include "internal.h"
#include <math.h>
#include <assert.h>

Go to the source code of this file.

Macros

#define NDEBUG
 
#define ZERO   INT2FIX(0)
 
#define ONE   INT2FIX(1)
 
#define TWO   INT2FIX(2)
 
#define f_boolcast(x)   ((x) ? Qtrue : Qfalse)
 
#define binop(n, op)
 
#define fun1(n)
 
#define fun2(n)
 
#define math1(n)
 
#define math2(n)
 
#define PRESERVE_SIGNEDZERO
 
#define f_positive_p(x)   (!f_negative_p(x))
 
#define f_nonzero_p(x)   (!f_zero_p(x))
 
#define k_exact_p(x)   (!k_float_p(x))
 
#define k_inexact_p(x)   k_float_p(x)
 
#define k_exact_zero_p(x)   (k_exact_p(x) && f_zero_p(x))
 
#define k_exact_one_p(x)   (k_exact_p(x) && f_one_p(x))
 
#define get_dat1(x)
 
#define get_dat2(x, y)
 
#define imp1(n)
 
#define imp2(n)
 
#define m_hypot(x, y)   m_hypot_bang((x),(y))
 
#define rb_raise_zerodiv()   rb_raise(rb_eZeroDivError, "divided by 0")
 
#define nucomp_quo   nucomp_div
 
#define WS   "\\s*"
 
#define DIGITS   "(?:[0-9](?:_[0-9]|[0-9])*)"
 
#define NUMERATOR   "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?"
 
#define DENOMINATOR   DIGITS
 
#define NUMBER   "[-+]?" NUMERATOR "(?:\\/" DENOMINATOR ")?"
 
#define NUMBERNOS   NUMERATOR "(?:\\/" DENOMINATOR ")?"
 
#define PATTERN0   "\\A" WS "(" NUMBER ")@(" NUMBER ")" WS
 
#define PATTERN1   "\\A" WS "([-+])?(" NUMBER ")?[iIjJ]" WS
 
#define PATTERN2   "\\A" WS "(" NUMBER ")(([-+])(" NUMBERNOS ")?[iIjJ])?" WS
 
#define id_match   rb_intern("match")
 
#define f_match(x, y)   rb_funcall((x), id_match, 1, (y))
 
#define id_gsub_bang   rb_intern("gsub!")
 
#define f_gsub_bang(x, y, z)   rb_funcall((x), id_gsub_bang, 2, (y), (z))
 
#define id_gsub   rb_intern("gsub")
 
#define f_gsub(x, y, z)   rb_funcall((x), id_gsub, 2, (y), (z))
 
#define id_PI   rb_intern("PI")
 
#define rb_intern(str)   rb_intern_const(str)
 

Functions

static VALUE f_add (VALUE x, VALUE y)
 
static VALUE f_cmp (VALUE x, VALUE y)
 
static VALUE f_div (VALUE x, VALUE y)
 
static VALUE f_gt_p (VALUE x, VALUE y)
 
static VALUE f_lt_p (VALUE x, VALUE y)
 
static VALUE f_mul (VALUE x, VALUE y)
 
static VALUE f_sub (VALUE x, VALUE y)
 
static VALUE f_to_i (VALUE x)
 
static VALUE f_to_f (VALUE x)
 
static VALUE f_eqeq_p (VALUE x, VALUE y)
 
static VALUE f_negative_p (VALUE x)
 
static VALUE f_zero_p (VALUE x)
 
static VALUE f_one_p (VALUE x)
 
static VALUE f_kind_of_p (VALUE x, VALUE c)
 
static VALUE k_numeric_p (VALUE x)
 
static VALUE k_integer_p (VALUE x)
 
static VALUE k_fixnum_p (VALUE x)
 
static VALUE k_bignum_p (VALUE x)
 
static VALUE k_float_p (VALUE x)
 
static VALUE k_rational_p (VALUE x)
 
static VALUE k_complex_p (VALUE x)
 
static VALUE nucomp_s_new_internal (VALUE klass, VALUE real, VALUE imag)
 
static VALUE nucomp_s_alloc (VALUE klass)
 
static VALUE f_complex_new_bang1 (VALUE klass, VALUE x)
 
static VALUE f_complex_new_bang2 (VALUE klass, VALUE x, VALUE y)
 
static void nucomp_real_check (VALUE num)
 
static VALUE nucomp_s_canonicalize_internal (VALUE klass, VALUE real, VALUE imag)
 
static VALUE nucomp_s_new (int argc, VALUE *argv, VALUE klass)
 
static VALUE f_complex_new1 (VALUE klass, VALUE x)
 
static VALUE f_complex_new2 (VALUE klass, VALUE x, VALUE y)
 
static VALUE nucomp_f_complex (int argc, VALUE *argv, VALUE klass)
 
static VALUE m_log_bang (VALUE x)
 
static VALUE m_cos (VALUE x)
 
static VALUE m_sin (VALUE x)
 
static VALUE f_complex_polar (VALUE klass, VALUE x, VALUE y)
 
static VALUE nucomp_s_polar (int argc, VALUE *argv, VALUE klass)
 
static VALUE nucomp_real (VALUE self)
 
static VALUE nucomp_imag (VALUE self)
 
static VALUE nucomp_negate (VALUE self)
 
static VALUE f_addsub (VALUE self, VALUE other, VALUE(*func)(VALUE, VALUE), ID id)
 
static VALUE nucomp_add (VALUE self, VALUE other)
 
static VALUE nucomp_sub (VALUE self, VALUE other)
 
static VALUE nucomp_mul (VALUE self, VALUE other)
 
static VALUE f_divide (VALUE self, VALUE other, VALUE(*func)(VALUE, VALUE), ID id)
 
static VALUE nucomp_div (VALUE self, VALUE other)
 
static VALUE nucomp_fdiv (VALUE self, VALUE other)
 
static VALUE f_reciprocal (VALUE x)
 
static VALUE nucomp_expt (VALUE self, VALUE other)
 
static VALUE nucomp_eqeq_p (VALUE self, VALUE other)
 
static VALUE nucomp_coerce (VALUE self, VALUE other)
 
static VALUE nucomp_abs (VALUE self)
 
static VALUE nucomp_abs2 (VALUE self)
 
static VALUE nucomp_arg (VALUE self)
 
static VALUE nucomp_rect (VALUE self)
 
static VALUE nucomp_polar (VALUE self)
 
static VALUE nucomp_conj (VALUE self)
 
static VALUE nucomp_false (VALUE self)
 
static VALUE nucomp_denominator (VALUE self)
 
static VALUE nucomp_numerator (VALUE self)
 
static VALUE nucomp_hash (VALUE self)
 
static VALUE nucomp_eql_p (VALUE self, VALUE other)
 
static VALUE f_signbit (VALUE x)
 
static VALUE f_tpositive_p (VALUE x)
 
static VALUE f_format (VALUE self, VALUE(*func)(VALUE))
 
static VALUE nucomp_to_s (VALUE self)
 
static VALUE nucomp_inspect (VALUE self)
 
static VALUE nucomp_marshal_dump (VALUE self)
 
static VALUE nucomp_marshal_load (VALUE self, VALUE a)
 
VALUE rb_complex_raw (VALUE x, VALUE y)
 
VALUE rb_complex_new (VALUE x, VALUE y)
 
VALUE rb_complex_polar (VALUE x, VALUE y)
 
static VALUE nucomp_s_convert (int argc, VALUE *argv, VALUE klass)
 
VALUE rb_Complex (VALUE x, VALUE y)
 
static VALUE nucomp_to_i (VALUE self)
 
static VALUE nucomp_to_f (VALUE self)
 
static VALUE nucomp_to_r (VALUE self)
 
static VALUE nucomp_rationalize (int argc, VALUE *argv, VALUE self)
 
static VALUE nilclass_to_c (VALUE self)
 
static VALUE numeric_to_c (VALUE self)
 
static void make_patterns (void)
 
static VALUE string_to_c_internal (VALUE self)
 
static VALUE string_to_c_strict (VALUE self)
 
static VALUE string_to_c (VALUE self)
 
static VALUE numeric_real (VALUE self)
 
static VALUE numeric_imag (VALUE self)
 
static VALUE numeric_abs2 (VALUE self)
 
static VALUE numeric_arg (VALUE self)
 
static VALUE numeric_rect (VALUE self)
 
static VALUE numeric_polar (VALUE self)
 
static VALUE numeric_conj (VALUE self)
 
static VALUE float_arg (VALUE self)
 
void Init_Complex (void)
 

Variables

VALUE rb_cComplex
 
static ID id_abs
 
static ID id_abs2
 
static ID id_arg
 
static ID id_cmp
 
static ID id_conj
 
static ID id_convert
 
static ID id_denominator
 
static ID id_divmod
 
static ID id_eqeq_p
 
static ID id_expt
 
static ID id_fdiv
 
static ID id_floor
 
static ID id_idiv
 
static ID id_imag
 
static ID id_inspect
 
static ID id_negate
 
static ID id_numerator
 
static ID id_quo
 
static ID id_real
 
static ID id_real_p
 
static ID id_to_f
 
static ID id_to_i
 
static ID id_to_r
 
static ID id_to_s
 
static VALUE comp_pat0
 
static VALUE comp_pat1
 
static VALUE comp_pat2
 
static VALUE a_slash
 
static VALUE a_dot_and_an_e
 
static VALUE null_string
 
static VALUE underscores_pat
 
static VALUE an_underscore
 

Macro Definition Documentation

#define binop (   n,
  op 
)
Value:
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
return rb_funcall(x, (op), 1, y);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
return
Definition: name2ctype.h:23857
return rb_funcall(q->proc, ID_call, 0)

Definition at line 28 of file complex.c.

#define DENOMINATOR   DIGITS

Definition at line 1412 of file complex.c.

#define DIGITS   "(?:[0-9](?:_[0-9]|[0-9])*)"

Definition at line 1410 of file complex.c.

#define f_boolcast (   x)    ((x) ? Qtrue : Qfalse)
#define f_gsub (   x,
  y,
 
)    rb_funcall((x), id_gsub, 2, (y), (z))

Definition at line 1558 of file complex.c.

Referenced by string_to_c().

#define f_gsub_bang (   x,
  y,
 
)    rb_funcall((x), id_gsub_bang, 2, (y), (z))

Definition at line 1459 of file complex.c.

#define f_match (   x,
 
)    rb_funcall((x), id_match, 1, (y))

Definition at line 1456 of file complex.c.

Referenced by string_to_c_internal().

#define f_nonzero_p (   x)    (!f_zero_p(x))

Definition at line 227 of file complex.c.

Referenced by nucomp_rationalize(), nucomp_to_f(), nucomp_to_i(), and nucomp_to_r().

#define f_positive_p (   x)    (!f_negative_p(x))

Definition at line 207 of file complex.c.

Referenced by numeric_arg().

#define fun1 (   n)
Value:
inline static VALUE \
f_##n(VALUE x)\
{\
return rb_funcall(x, id_##n, 0);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
return
Definition: name2ctype.h:23857
return rb_funcall(q->proc, ID_call, 0)

Definition at line 35 of file complex.c.

#define fun2 (   n)
Value:
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
return rb_funcall(x, id_##n, 1, y);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
return
Definition: name2ctype.h:23857
return rb_funcall(q->proc, ID_call, 0)

Definition at line 42 of file complex.c.

#define get_dat1 (   x)
#define get_dat2 (   x,
 
)
Value:
struct RComplex *adat, *bdat;\
adat = ((struct RComplex *)(x));\
bdat = ((struct RComplex *)(y))
Definition: ruby.h:755

Definition at line 307 of file complex.c.

Referenced by f_addsub(), f_divide(), nucomp_eqeq_p(), nucomp_eql_p(), nucomp_mul(), and nucomp_s_canonicalize_internal().

#define id_gsub   rb_intern("gsub")

Definition at line 1557 of file complex.c.

#define id_gsub_bang   rb_intern("gsub!")

Definition at line 1458 of file complex.c.

#define id_match   rb_intern("match")

Definition at line 1455 of file complex.c.

#define id_PI   rb_intern("PI")

Definition at line 1724 of file complex.c.

Referenced by float_arg(), and numeric_arg().

#define imp1 (   n)
Value:
inline static VALUE \
m_##n##_bang(VALUE x)\
{\
return rb_math_##n(x);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
return
Definition: name2ctype.h:23857

Definition at line 488 of file complex.c.

#define imp2 (   n)
Value:
inline static VALUE \
m_##n##_bang(VALUE x, VALUE y)\
{\
return rb_math_##n(x, y);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
return
Definition: name2ctype.h:23857

Definition at line 495 of file complex.c.

#define k_exact_one_p (   x)    (k_exact_p(x) && f_one_p(x))

Definition at line 301 of file complex.c.

#define k_exact_p (   x)    (!k_float_p(x))

Definition at line 297 of file complex.c.

#define k_exact_zero_p (   x)    (k_exact_p(x) && f_zero_p(x))

Definition at line 300 of file complex.c.

Referenced by nucomp_expt(), nucomp_s_canonicalize_internal(), and nucomp_s_convert().

#define k_inexact_p (   x)    k_float_p(x)

Definition at line 298 of file complex.c.

Referenced by nucomp_rationalize(), nucomp_to_f(), nucomp_to_i(), and nucomp_to_r().

#define m_hypot (   x,
 
)    m_hypot_bang((x),(y))

Definition at line 508 of file complex.c.

Referenced by nucomp_abs().

#define math1 (   n)
Value:
inline static VALUE \
m_##n(VALUE x)\
{\
return rb_funcall(rb_mMath, id_##n, 1, x);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
RUBY_EXTERN VALUE rb_mMath
Definition: ruby.h:1240
return
Definition: name2ctype.h:23857
return rb_funcall(q->proc, ID_call, 0)

Definition at line 49 of file complex.c.

#define math2 (   n)
Value:
inline static VALUE \
m_##n(VALUE x, VALUE y)\
{\
return rb_funcall(rb_mMath, id_##n, 2, x, y);\
}
ssize_t n
Definition: bigdecimal.c:5519
unsigned long VALUE
Definition: ruby.h:88
RUBY_EXTERN VALUE rb_mMath
Definition: ruby.h:1240
return
Definition: name2ctype.h:23857
return rb_funcall(q->proc, ID_call, 0)

Definition at line 56 of file complex.c.

#define NDEBUG

Definition at line 12 of file complex.c.

#define nucomp_quo   nucomp_div

Definition at line 804 of file complex.c.

Referenced by Init_Complex().

#define NUMBER   "[-+]?" NUMERATOR "(?:\\/" DENOMINATOR ")?"

Definition at line 1413 of file complex.c.

#define NUMBERNOS   NUMERATOR "(?:\\/" DENOMINATOR ")?"

Definition at line 1414 of file complex.c.

#define NUMERATOR   "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?"

Definition at line 1411 of file complex.c.

#define ONE   INT2FIX(1)

Definition at line 16 of file complex.c.

Referenced by f_divide(), f_one_p(), f_reciprocal(), Init_Complex(), nucomp_expt(), and nucomp_s_convert().

#define PATTERN0   "\\A" WS "(" NUMBER ")@(" NUMBER ")" WS

Definition at line 1415 of file complex.c.

Referenced by make_patterns().

#define PATTERN1   "\\A" WS "([-+])?(" NUMBER ")?[iIjJ]" WS

Definition at line 1416 of file complex.c.

Referenced by make_patterns().

#define PATTERN2   "\\A" WS "(" NUMBER ")(([-+])(" NUMBERNOS ")?[iIjJ])?" WS

Definition at line 1417 of file complex.c.

Referenced by make_patterns().

#define PRESERVE_SIGNEDZERO

Definition at line 63 of file complex.c.

#define rb_intern (   str)    rb_intern_const(str)
#define rb_raise_zerodiv ( )    rb_raise(rb_eZeroDivError, "divided by 0")

Definition at line 784 of file complex.c.

#define TWO   INT2FIX(2)

Definition at line 17 of file complex.c.

Referenced by nucomp_expt().

#define WS   "\\s*"

Definition at line 1409 of file complex.c.

#define ZERO   INT2FIX(0)

Function Documentation

static VALUE f_add ( VALUE  x,
VALUE  y 
)
inlinestatic
static VALUE f_addsub ( VALUE  self,
VALUE  other,
VALUE(*)(VALUE, VALUE func,
ID  id 
)
inlinestatic

Definition at line 655 of file complex.c.

References CLASS_OF, f_complex_new2(), func, get_dat1, get_dat2, k_complex_p(), k_numeric_p(), and rb_num_coerce_bin().

Referenced by nucomp_add(), and nucomp_sub().

static VALUE f_cmp ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 78 of file complex.c.

References c, FIX2LONG, FIXNUM_P, id_cmp, INT2FIX, and rb_funcall().

static VALUE f_complex_new1 ( VALUE  klass,
VALUE  x 
)
inlinestatic

Definition at line 463 of file complex.c.

References assert, k_complex_p(), nucomp_s_canonicalize_internal(), and ZERO.

static VALUE f_complex_new2 ( VALUE  klass,
VALUE  x,
VALUE  y 
)
inlinestatic
static VALUE f_complex_new_bang1 ( VALUE  klass,
VALUE  x 
)
inlinestatic

Definition at line 355 of file complex.c.

References assert, k_complex_p(), nucomp_s_new_internal(), and ZERO.

Referenced by nucomp_coerce(), and nucomp_expt().

static VALUE f_complex_new_bang2 ( VALUE  klass,
VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 362 of file complex.c.

References assert, k_complex_p(), and nucomp_s_new_internal().

Referenced by Init_Complex(), and nucomp_s_convert().

static VALUE f_complex_polar ( VALUE  klass,
VALUE  x,
VALUE  y 
)
inlinestatic
static VALUE f_div ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 92 of file complex.c.

References FIX2LONG, FIXNUM_P, and rb_funcall().

Referenced by nucomp_numerator().

static VALUE f_divide ( VALUE  self,
VALUE  other,
VALUE(*)(VALUE, VALUE func,
ID  id 
)
inlinestatic
static VALUE f_eqeq_p ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 187 of file complex.c.

References f_boolcast, FIX2LONG, FIXNUM_P, id_eqeq_p, and rb_funcall().

Referenced by nucomp_eqeq_p(), and nucomp_eql_p().

static VALUE f_format ( VALUE  self,
VALUE(*)(VALUE func 
)
static
static VALUE f_gt_p ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 100 of file complex.c.

References f_boolcast, FIX2LONG, FIXNUM_P, and rb_funcall().

Referenced by f_divide(), and nucomp_expt().

static VALUE f_kind_of_p ( VALUE  x,
VALUE  c 
)
inlinestatic
static VALUE f_lt_p ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 108 of file complex.c.

References f_boolcast, FIX2LONG, FIXNUM_P, and rb_funcall().

static VALUE f_mul ( VALUE  x,
VALUE  y 
)
inlinestatic
static VALUE f_negative_p ( VALUE  x)
inlinestatic

Definition at line 200 of file complex.c.

References f_boolcast, FIX2LONG, FIXNUM_P, rb_funcall(), and ZERO.

Referenced by f_signbit().

static VALUE f_one_p ( VALUE  x)
inlinestatic

Definition at line 230 of file complex.c.

References f_boolcast, FIX2LONG, FIXNUM_P, id_eqeq_p, ONE, Qfalse, rb_funcall(), RRATIONAL, T_BIGNUM, T_FIXNUM, T_RATIONAL, and TYPE.

Referenced by nucomp_expt().

static VALUE f_reciprocal ( VALUE  x)
inlinestatic

Definition at line 823 of file complex.c.

References f_quo, and ONE.

Referenced by nucomp_expt().

static VALUE f_signbit ( VALUE  x)
inlinestatic

Definition at line 1174 of file complex.c.

References f_boolcast, f_negative_p(), isnan, RFLOAT_VALUE, signbit(), T_FLOAT, and TYPE.

Referenced by f_tpositive_p().

static VALUE f_sub ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 144 of file complex.c.

References FIX2LONG, FIXNUM_P, and rb_funcall().

Referenced by f_divide(), nucomp_expt(), nucomp_mul(), nucomp_s_canonicalize_internal(), and nucomp_sub().

static VALUE f_to_f ( VALUE  x)
inlinestatic

Definition at line 174 of file complex.c.

References DBL2NUM, id_to_f, rb_funcall(), rb_str_to_dbl(), T_STRING, and TYPE.

Referenced by nucomp_abs(), nucomp_to_f(), and string_to_c_internal().

static VALUE f_to_i ( VALUE  x)
inlinestatic

Definition at line 167 of file complex.c.

References id_to_i, rb_funcall(), rb_str_to_inum(), T_STRING, and TYPE.

Referenced by nucomp_to_i(), and string_to_c_internal().

static VALUE f_tpositive_p ( VALUE  x)
inlinestatic

Definition at line 1190 of file complex.c.

References f_boolcast, and f_signbit().

Referenced by f_format(), and float_arg().

static VALUE f_zero_p ( VALUE  x)
inlinestatic
static VALUE float_arg ( VALUE  self)
static

Definition at line 1788 of file complex.c.

References f_tpositive_p(), id_PI, INT2FIX, isnan, rb_const_get(), rb_mMath, and RFLOAT_VALUE.

Referenced by Init_Complex().

void Init_Complex ( void  )
static VALUE k_bignum_p ( VALUE  x)
inlinestatic

Definition at line 274 of file complex.c.

References f_kind_of_p(), and rb_cBignum.

Referenced by nucomp_expt().

static VALUE k_complex_p ( VALUE  x)
inlinestatic
static VALUE k_fixnum_p ( VALUE  x)
inlinestatic

Definition at line 268 of file complex.c.

References f_kind_of_p(), and rb_cFixnum.

Referenced by nucomp_expt().

static VALUE k_float_p ( VALUE  x)
inlinestatic

Definition at line 280 of file complex.c.

References f_kind_of_p(), and rb_cFloat.

Referenced by f_divide(), and nucomp_abs().

static VALUE k_integer_p ( VALUE  x)
inlinestatic

Definition at line 262 of file complex.c.

References f_kind_of_p(), and rb_cInteger.

static VALUE k_numeric_p ( VALUE  x)
inlinestatic
static VALUE k_rational_p ( VALUE  x)
inlinestatic

Definition at line 286 of file complex.c.

References f_kind_of_p(), and rb_cRational.

Referenced by nucomp_expt().

static VALUE m_cos ( VALUE  x)
static

Definition at line 521 of file complex.c.

References f_complex_new2(), f_mul(), f_negate, get_dat1, and rb_cComplex.

Referenced by f_complex_polar().

static VALUE m_log_bang ( VALUE  x)
static

Definition at line 511 of file complex.c.

References rb_math_log().

Referenced by nucomp_expt().

static VALUE m_sin ( VALUE  x)
static

Definition at line 536 of file complex.c.

References f_complex_new2(), f_mul(), get_dat1, and rb_cComplex.

Referenced by f_complex_polar().

static void make_patterns ( void  )
static
static VALUE nilclass_to_c ( VALUE  self)
static

Definition at line 1389 of file complex.c.

References INT2FIX, and rb_complex_new1.

Referenced by Init_Complex().

static VALUE nucomp_abs ( VALUE  self)
static

Definition at line 963 of file complex.c.

References a, f_abs, f_to_f(), f_zero_p(), get_dat1, k_float_p(), and m_hypot.

Referenced by Init_Complex().

static VALUE nucomp_abs2 ( VALUE  self)
static

Definition at line 989 of file complex.c.

References f_add(), f_mul(), and get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_add ( VALUE  self,
VALUE  other 
)
static

Definition at line 684 of file complex.c.

References f_add(), and f_addsub().

Referenced by Init_Complex().

static VALUE nucomp_arg ( VALUE  self)
static

Definition at line 1008 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_coerce ( VALUE  self,
VALUE  other 
)
static
static VALUE nucomp_conj ( VALUE  self)
static

Definition at line 1048 of file complex.c.

References CLASS_OF, f_complex_new2(), f_negate, and get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_denominator ( VALUE  self)
static

Definition at line 1101 of file complex.c.

References f_denominator, get_dat1, and rb_lcm().

Referenced by Init_Complex().

static VALUE nucomp_div ( VALUE  self,
VALUE  other 
)
static

Definition at line 799 of file complex.c.

References f_divide(), f_quo, and id_quo.

Referenced by Init_Complex().

static VALUE nucomp_eqeq_p ( VALUE  self,
VALUE  other 
)
static

Definition at line 925 of file complex.c.

References f_boolcast, f_eqeq_p(), f_zero_p(), get_dat1, get_dat2, k_complex_p(), and k_numeric_p().

Referenced by Init_Complex().

static VALUE nucomp_eql_p ( VALUE  self,
VALUE  other 
)
static

Definition at line 1160 of file complex.c.

References CLASS_OF, f_boolcast, f_eqeq_p(), get_dat2, k_complex_p(), and Qfalse.

Referenced by Init_Complex().

static VALUE nucomp_expt ( VALUE  self,
VALUE  other 
)
static
static VALUE nucomp_f_complex ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 483 of file complex.c.

References id_convert, rb_cComplex, and rb_funcall2().

Referenced by Init_Complex().

static VALUE nucomp_false ( VALUE  self)
static

Definition at line 1070 of file complex.c.

References Qfalse.

Referenced by Init_Complex().

static VALUE nucomp_fdiv ( VALUE  self,
VALUE  other 
)
static

Definition at line 817 of file complex.c.

References f_divide(), and id_fdiv.

Referenced by Init_Complex().

static VALUE nucomp_hash ( VALUE  self)
static

Definition at line 1144 of file complex.c.

References get_dat1, LONG2FIX, n, NUM2LONG(), rb_hash(), rb_memhash(), and v.

Referenced by Init_Complex().

static VALUE nucomp_imag ( VALUE  self)
static

Definition at line 634 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_inspect ( VALUE  self)
static

Definition at line 1234 of file complex.c.

References f_format(), f_inspect, rb_str_cat2(), rb_str_concat(), rb_usascii_str_new2(), and s.

Referenced by Init_Complex().

static VALUE nucomp_marshal_dump ( VALUE  self)
static

Definition at line 1247 of file complex.c.

References a, get_dat1, rb_assoc_new(), and rb_copy_generic_ivar().

Referenced by Init_Complex().

static VALUE nucomp_marshal_load ( VALUE  self,
VALUE  a 
)
static
static VALUE nucomp_mul ( VALUE  self,
VALUE  other 
)
static
static VALUE nucomp_negate ( VALUE  self)
static

Definition at line 647 of file complex.c.

References CLASS_OF, f_complex_new2(), f_negate, and get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_numerator ( VALUE  self)
static

Definition at line 1128 of file complex.c.

References CLASS_OF, f_complex_new2(), f_denominator, f_div(), f_mul(), f_numerator, and get_dat1.

Referenced by Init_Complex().

static VALUE nucomp_polar ( VALUE  self)
static

Definition at line 1035 of file complex.c.

References f_abs, and rb_assoc_new().

Referenced by Init_Complex().

static VALUE nucomp_rationalize ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE nucomp_real ( VALUE  self)
static

Definition at line 620 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

static void nucomp_real_check ( VALUE  num)
inlinestatic

Definition at line 384 of file complex.c.

References k_numeric_p(), rb_eTypeError, rb_raise(), T_BIGNUM, T_FIXNUM, T_FLOAT, T_RATIONAL, and TYPE.

Referenced by nucomp_s_new(), and nucomp_s_polar().

static VALUE nucomp_rect ( VALUE  self)
static

Definition at line 1022 of file complex.c.

References get_dat1, and rb_assoc_new().

Referenced by Init_Complex().

static VALUE nucomp_s_alloc ( VALUE  klass)
static

Definition at line 325 of file complex.c.

References nucomp_s_new_internal(), and ZERO.

Referenced by Init_Complex().

static VALUE nucomp_s_canonicalize_internal ( VALUE  klass,
VALUE  real,
VALUE  imag 
)
inlinestatic
static VALUE nucomp_s_convert ( int  argc,
VALUE argv,
VALUE  klass 
)
static
static VALUE nucomp_s_new ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 444 of file complex.c.

References nucomp_real_check(), nucomp_s_canonicalize_internal(), rb_scan_args(), and ZERO.

Referenced by Init_Complex(), and nucomp_s_convert().

static VALUE nucomp_s_new_internal ( VALUE  klass,
VALUE  real,
VALUE  imag 
)
inlinestatic
static VALUE nucomp_s_polar ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 596 of file complex.c.

References arg, f_complex_polar(), nucomp_real_check(), rb_scan_args(), and ZERO.

Referenced by Init_Complex().

static VALUE nucomp_sub ( VALUE  self,
VALUE  other 
)
static

Definition at line 696 of file complex.c.

References f_addsub(), and f_sub().

Referenced by Init_Complex().

static VALUE nucomp_to_f ( VALUE  self)
static

Definition at line 1328 of file complex.c.

References f_nonzero_p, f_to_f(), f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), s, and StringValuePtr.

Referenced by Init_Complex().

static VALUE nucomp_to_i ( VALUE  self)
static

Definition at line 1309 of file complex.c.

References f_nonzero_p, f_to_i(), f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), s, and StringValuePtr.

Referenced by Init_Complex().

static VALUE nucomp_to_r ( VALUE  self)
static

Definition at line 1348 of file complex.c.

References f_nonzero_p, f_to_r, f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), s, and StringValuePtr.

Referenced by Init_Complex().

static VALUE nucomp_to_s ( VALUE  self)
static

Definition at line 1222 of file complex.c.

References f_format(), and f_to_s.

Referenced by Init_Complex().

static VALUE numeric_abs2 ( VALUE  self)
static

Definition at line 1719 of file complex.c.

References f_mul().

Referenced by Init_Complex().

static VALUE numeric_arg ( VALUE  self)
static

Definition at line 1735 of file complex.c.

References f_positive_p, id_PI, INT2FIX, rb_const_get(), and rb_mMath.

Referenced by Init_Complex().

static VALUE numeric_conj ( VALUE  self)
static

Definition at line 1774 of file complex.c.

Referenced by Init_Complex().

static VALUE numeric_imag ( VALUE  self)
static

Definition at line 1707 of file complex.c.

References INT2FIX.

Referenced by Init_Complex().

static VALUE numeric_polar ( VALUE  self)
static

Definition at line 1761 of file complex.c.

References f_abs, and rb_assoc_new().

Referenced by Init_Complex().

static VALUE numeric_real ( VALUE  self)
static

Definition at line 1694 of file complex.c.

Referenced by Init_Complex().

static VALUE numeric_rect ( VALUE  self)
static

Definition at line 1749 of file complex.c.

References INT2FIX, and rb_assoc_new().

Referenced by Init_Complex().

static VALUE numeric_to_c ( VALUE  self)
static

Definition at line 1401 of file complex.c.

References rb_complex_new1.

Referenced by Init_Complex().

VALUE rb_Complex ( VALUE  x,
VALUE  y 
)

Definition at line 1294 of file complex.c.

References nucomp_s_convert(), and rb_cComplex.

Referenced by nurat_coerce().

VALUE rb_complex_new ( VALUE  x,
VALUE  y 
)

Definition at line 1280 of file complex.c.

References nucomp_s_canonicalize_internal(), and rb_cComplex.

Referenced by num_imaginary().

VALUE rb_complex_polar ( VALUE  x,
VALUE  y 
)

Definition at line 1286 of file complex.c.

References f_complex_polar(), and rb_cComplex.

Referenced by string_to_c_internal().

VALUE rb_complex_raw ( VALUE  x,
VALUE  y 
)

Definition at line 1274 of file complex.c.

References nucomp_s_new_internal(), and rb_cComplex.

static VALUE string_to_c ( VALUE  self)
static
static VALUE string_to_c_internal ( VALUE  self)
static
static VALUE string_to_c_strict ( VALUE  self)
static

Variable Documentation

VALUE a_dot_and_an_e
static

Definition at line 1406 of file complex.c.

VALUE a_slash
static

Definition at line 1406 of file complex.c.

VALUE an_underscore
static

Definition at line 1406 of file complex.c.

VALUE comp_pat0
static

Definition at line 1406 of file complex.c.

VALUE comp_pat1
static

Definition at line 1406 of file complex.c.

VALUE comp_pat2
static

Definition at line 1406 of file complex.c.

ID id_abs
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_abs2
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_arg
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_cmp
static

Definition at line 21 of file complex.c.

Referenced by f_cmp(), and Init_Complex().

ID id_conj
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_convert
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_f_complex().

ID id_denominator
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_divmod
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_eqeq_p
static

Definition at line 21 of file complex.c.

Referenced by f_eqeq_p(), f_one_p(), f_zero_p(), and Init_Complex().

ID id_expt
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_expt().

ID id_fdiv
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_fdiv().

ID id_floor
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_idiv
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_imag
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_inspect
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_negate
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_numerator
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_quo
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_div().

ID id_real
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_real_p
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_to_f
static

Definition at line 21 of file complex.c.

Referenced by f_to_f(), and Init_Complex().

ID id_to_i
static

Definition at line 21 of file complex.c.

Referenced by f_to_i(), and Init_Complex().

ID id_to_r
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

ID id_to_s
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

VALUE null_string
static

Definition at line 1406 of file complex.c.

VALUE rb_cComplex
VALUE underscores_pat
static

Definition at line 1406 of file complex.c.