Ruby  2.1.10p492(2016-04-01revision54464)
Macros | Functions | Variables
complex.c File Reference
#include "ruby.h"
#include "internal.h"
#include <math.h>
#include <assert.h>
#include <ctype.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 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_div (VALUE x, VALUE y)
 
static VALUE f_gt_p (VALUE x, VALUE y)
 
static VALUE f_mul (VALUE x, VALUE y)
 
static VALUE f_sub (VALUE x, VALUE y)
 
 fun1 (abs)
 
static VALUE f_to_f (VALUE x)
 
 fun1 (to_r)
 
 fun2 (expt)
 
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_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_new2 (VALUE klass, VALUE x, VALUE y)
 
static VALUE nucomp_f_complex (int argc, VALUE *argv, VALUE klass)
 
 imp2 (atan2)
 
 imp1 (sin)
 
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_dumper (VALUE self)
 
static VALUE nucomp_loader (VALUE self, VALUE a)
 
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 nucomp_to_c (VALUE self)
 
static VALUE nilclass_to_c (VALUE self)
 
static VALUE numeric_to_c (VALUE self)
 
static int issign (int c)
 
static int read_sign (const char **s, char **b)
 
static int isdecimal (int c)
 
static int read_digits (const char **s, int strict, char **b)
 
static int islettere (int c)
 
static int read_num (const char **s, int strict, char **b)
 
static int read_den (const char **s, int strict, char **b)
 
static int read_rat_nos (const char **s, int strict, char **b)
 
static int read_rat (const char **s, int strict, char **b)
 
static int isimagunit (int c)
 
VALUE rb_cstr_to_rat (const char *, int)
 
static VALUE str2num (char *s)
 
static int read_comp (const char **s, int strict, VALUE *ret, char **b)
 
static void skip_ws (const char **s)
 
static int parse_comp (const char *s, int strict, VALUE *num)
 
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_arg
 
static ID id_convert
 
static ID id_denominator
 
static ID id_eqeq_p
 
static ID id_expt
 
static ID id_fdiv
 
static ID id_inspect
 
static ID id_negate
 
static ID id_numerator
 
static ID id_quo
 
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 ID id_i_real
 
static ID id_i_imag
 

Macro Definition Documentation

◆ binop

#define binop (   n,
  op 
)
Value:
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
return rb_funcall(x, (op), 1, y);\
}
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:781
unsigned long VALUE
Definition: ruby.h:88

Definition at line 29 of file complex.c.

◆ f_boolcast

#define f_boolcast (   x)    ((x) ? Qtrue : Qfalse)

◆ f_nonzero_p

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

Definition at line 195 of file complex.c.

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

◆ f_positive_p

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

Definition at line 176 of file complex.c.

Referenced by numeric_arg().

◆ fun1

#define fun1 (   n)
Value:
inline static VALUE \
f_##n(VALUE x)\
{\
return rb_funcall(x, id_##n, 0);\
}
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:781
unsigned long VALUE
Definition: ruby.h:88

Definition at line 36 of file complex.c.

◆ fun2

#define fun2 (   n)
Value:
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
return rb_funcall(x, id_##n, 1, y);\
}
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:781
unsigned long VALUE
Definition: ruby.h:88

Definition at line 43 of file complex.c.

◆ get_dat1

#define get_dat1 (   x)

◆ get_dat2

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

Definition at line 268 of file complex.c.

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

◆ id_PI

#define id_PI   rb_intern("PI")

Definition at line 1943 of file complex.c.

Referenced by float_arg(), and numeric_arg().

◆ imp1

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

Definition at line 467 of file complex.c.

◆ imp2

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

Definition at line 474 of file complex.c.

◆ k_exact_one_p

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

Definition at line 262 of file complex.c.

◆ k_exact_p

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

Definition at line 258 of file complex.c.

◆ k_exact_zero_p

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

Definition at line 261 of file complex.c.

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

◆ k_inexact_p

#define k_inexact_p (   x)    k_float_p(x)

Definition at line 259 of file complex.c.

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

◆ m_hypot

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

Referenced by nucomp_abs().

◆ math1

#define math1 (   n)
Value:
inline static VALUE \
m_##n(VALUE x)\
{\
return rb_funcall(rb_mMath, id_##n, 1, x);\
}
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:781
RUBY_EXTERN VALUE rb_mMath
Definition: ruby.h:1555
unsigned long VALUE
Definition: ruby.h:88

Definition at line 50 of file complex.c.

◆ math2

#define math2 (   n)
Value:
inline static VALUE \
m_##n(VALUE x, VALUE y)\
{\
return rb_funcall(rb_mMath, id_##n, 2, x, y);\
}
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:781
RUBY_EXTERN VALUE rb_mMath
Definition: ruby.h:1555
unsigned long VALUE
Definition: ruby.h:88

Definition at line 57 of file complex.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file complex.c.

◆ nucomp_quo

#define nucomp_quo   nucomp_div

Definition at line 811 of file complex.c.

Referenced by Init_Complex().

◆ ONE

#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().

◆ PRESERVE_SIGNEDZERO

#define PRESERVE_SIGNEDZERO

Definition at line 64 of file complex.c.

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

Referenced by Init_Complex(), and nucomp_rationalize().

◆ rb_raise_zerodiv

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

Definition at line 790 of file complex.c.

◆ TWO

#define TWO   INT2FIX(2)

Definition at line 17 of file complex.c.

Referenced by nucomp_expt().

◆ ZERO

#define ZERO   INT2FIX(0)

Function Documentation

◆ f_add()

static VALUE f_add ( VALUE  x,
VALUE  y 
)
inlinestatic

◆ f_addsub()

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

Definition at line 643 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().

◆ f_complex_new2()

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

◆ f_complex_new_bang1()

static VALUE f_complex_new_bang1 ( VALUE  klass,
VALUE  x 
)
inlinestatic

Definition at line 315 of file complex.c.

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

Referenced by nucomp_coerce(), and nucomp_expt().

◆ f_complex_new_bang2()

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

Definition at line 322 of file complex.c.

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

Referenced by Init_Complex(), and nucomp_s_convert().

◆ f_complex_polar()

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

◆ f_div()

static VALUE f_div ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 79 of file complex.c.

References FIX2LONG, FIXNUM_P, and rb_funcall().

Referenced by nucomp_numerator().

◆ f_divide()

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

◆ f_format()

static VALUE f_format ( VALUE  self,
VALUE(*)(VALUE func 
)
static

◆ f_gt_p()

static VALUE f_gt_p ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 87 of file complex.c.

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

Referenced by f_divide(), and nucomp_expt().

◆ f_kind_of_p()

static VALUE f_kind_of_p ( VALUE  x,
VALUE  c 
)
inlinestatic

Definition at line 217 of file complex.c.

References rb_obj_is_kind_of().

Referenced by k_bignum_p(), k_complex_p(), k_fixnum_p(), k_float_p(), k_numeric_p(), and k_rational_p().

◆ f_mul()

static VALUE f_mul ( VALUE  x,
VALUE  y 
)
inlinestatic

◆ f_one_p()

static VALUE f_one_p ( VALUE  x)
inlinestatic

Definition at line 198 of file complex.c.

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

Referenced by nucomp_expt().

◆ f_reciprocal()

static VALUE f_reciprocal ( VALUE  x)
inlinestatic

Definition at line 828 of file complex.c.

References f_quo, and ONE.

Referenced by nucomp_expt().

◆ f_signbit()

static VALUE f_signbit ( VALUE  x)
inlinestatic

Definition at line 1192 of file complex.c.

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

Referenced by f_tpositive_p().

◆ f_sub()

static VALUE f_sub ( VALUE  x,
VALUE  y 
)
inlinestatic

Definition at line 121 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().

◆ f_to_f()

static VALUE f_to_f ( VALUE  x)
inlinestatic

Definition at line 146 of file complex.c.

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

Referenced by nucomp_abs(), and nucomp_to_f().

◆ f_tpositive_p()

static VALUE f_tpositive_p ( VALUE  x)
inlinestatic

Definition at line 1206 of file complex.c.

References f_boolcast, and f_signbit().

Referenced by f_format(), and float_arg().

◆ f_zero_p()

static VALUE f_zero_p ( VALUE  x)
inlinestatic

◆ float_arg()

static VALUE float_arg ( VALUE  self)
static

Definition at line 2008 of file complex.c.

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

Referenced by Init_Complex().

◆ fun1() [1/2]

fun1 ( abs  )

Definition at line 130 of file complex.c.

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

◆ fun1() [2/2]

fun1 ( to_r  )

Definition at line 153 of file complex.c.

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

◆ fun2()

fun2 ( expt  )

Definition at line 164 of file complex.c.

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

◆ imp1()

imp1 ( sin  )

Definition at line 495 of file complex.c.

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

◆ imp2()

imp2 ( atan2  )

Definition at line 481 of file complex.c.

References rb_math_log().

◆ Init_Complex()

void Init_Complex ( void  )

◆ isdecimal()

static int isdecimal ( int  c)
inlinestatic

Definition at line 1511 of file complex.c.

Referenced by read_comp(), and read_digits().

◆ isimagunit()

static int isimagunit ( int  c)
inlinestatic

Definition at line 1623 of file complex.c.

Referenced by read_comp().

◆ islettere()

static int islettere ( int  c)
inlinestatic

Definition at line 1548 of file complex.c.

Referenced by read_num().

◆ issign()

static int issign ( int  c)
inlinestatic

Definition at line 1491 of file complex.c.

Referenced by read_comp(), and read_sign().

◆ k_bignum_p()

static VALUE k_bignum_p ( VALUE  x)
inlinestatic

Definition at line 235 of file complex.c.

References f_kind_of_p(), and rb_cBignum.

Referenced by nucomp_expt().

◆ k_complex_p()

static VALUE k_complex_p ( VALUE  x)
inlinestatic

◆ k_fixnum_p()

static VALUE k_fixnum_p ( VALUE  x)
inlinestatic

Definition at line 229 of file complex.c.

References f_kind_of_p(), and rb_cFixnum.

Referenced by nucomp_expt().

◆ k_float_p()

static VALUE k_float_p ( VALUE  x)
inlinestatic

Definition at line 241 of file complex.c.

References f_kind_of_p(), and rb_cFloat.

Referenced by f_divide(), and nucomp_abs().

◆ k_numeric_p()

static VALUE k_numeric_p ( VALUE  x)
inlinestatic

◆ k_rational_p()

static VALUE k_rational_p ( VALUE  x)
inlinestatic

Definition at line 247 of file complex.c.

References f_kind_of_p(), and rb_cRational.

Referenced by nucomp_expt().

◆ m_sin()

static VALUE m_sin ( VALUE  x)
static

Definition at line 514 of file complex.c.

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

Referenced by f_complex_polar().

◆ nilclass_to_c()

static VALUE nilclass_to_c ( VALUE  self)
static

Definition at line 1471 of file complex.c.

References INT2FIX, and rb_complex_new1.

Referenced by Init_Complex().

◆ nucomp_abs()

static VALUE nucomp_abs ( VALUE  self)
static

Definition at line 975 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_abs2()

static VALUE nucomp_abs2 ( VALUE  self)
static

Definition at line 1004 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_add()

static VALUE nucomp_add ( VALUE  self,
VALUE  other 
)
static

Definition at line 678 of file complex.c.

References f_add(), and f_addsub().

Referenced by Init_Complex().

◆ nucomp_arg()

static VALUE nucomp_arg ( VALUE  self)
static

Definition at line 1022 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

◆ nucomp_coerce()

static VALUE nucomp_coerce ( VALUE  self,
VALUE  other 
)
static

◆ nucomp_conj()

static VALUE nucomp_conj ( VALUE  self)
static

Definition at line 1068 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_denominator()

static VALUE nucomp_denominator ( VALUE  self)
static

Definition at line 1121 of file complex.c.

References f_denominator, get_dat1, and rb_lcm().

Referenced by Init_Complex().

◆ nucomp_div()

static VALUE nucomp_div ( VALUE  self,
VALUE  other 
)
static

Definition at line 806 of file complex.c.

References f_divide(), f_quo, and id_quo.

Referenced by Init_Complex().

◆ nucomp_dumper()

static VALUE nucomp_dumper ( VALUE  self)
static

Definition at line 1275 of file complex.c.

Referenced by Init_Complex().

◆ nucomp_eqeq_p()

static VALUE nucomp_eqeq_p ( VALUE  self,
VALUE  other 
)
static

Definition at line 934 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().

◆ nucomp_eql_p()

static VALUE nucomp_eql_p ( VALUE  self,
VALUE  other 
)
static

Definition at line 1178 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_expt()

static VALUE nucomp_expt ( VALUE  self,
VALUE  other 
)
static

◆ nucomp_f_complex()

static VALUE nucomp_f_complex ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 462 of file complex.c.

References argc, argv, id_convert, rb_cComplex, and rb_funcall2.

Referenced by Init_Complex().

◆ nucomp_false()

static VALUE nucomp_false ( VALUE  self)
static

Definition at line 1090 of file complex.c.

References Qfalse.

Referenced by Init_Complex().

◆ nucomp_fdiv()

static VALUE nucomp_fdiv ( VALUE  self,
VALUE  other 
)
static

Definition at line 822 of file complex.c.

References f_divide(), and id_fdiv.

Referenced by Init_Complex().

◆ nucomp_hash()

static VALUE nucomp_hash ( VALUE  self)
static

Definition at line 1162 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_imag()

static VALUE nucomp_imag ( VALUE  self)
static

Definition at line 620 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

◆ nucomp_inspect()

static VALUE nucomp_inspect ( VALUE  self)
static

Definition at line 1262 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_loader()

static VALUE nucomp_loader ( VALUE  self,
VALUE  a 
)
static

Definition at line 1282 of file complex.c.

References get_dat1, id_i_imag, id_i_real, rb_ivar_get(), RCOMPLEX_SET_IMAG, and RCOMPLEX_SET_REAL.

Referenced by Init_Complex().

◆ nucomp_marshal_dump()

static VALUE nucomp_marshal_dump ( VALUE  self)
static

Definition at line 1294 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_marshal_load()

static VALUE nucomp_marshal_load ( VALUE  self,
VALUE  a 
)
static

Definition at line 1306 of file complex.c.

References Check_Type, id_i_imag, id_i_real, RARRAY_AREF, RARRAY_LEN, rb_eArgError, rb_ivar_set(), rb_raise(), and T_ARRAY.

Referenced by Init_Complex().

◆ nucomp_mul()

static VALUE nucomp_mul ( VALUE  self,
VALUE  other 
)
static

◆ nucomp_negate()

static VALUE nucomp_negate ( VALUE  self)
static

Definition at line 635 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_numerator()

static VALUE nucomp_numerator ( VALUE  self)
static

Definition at line 1146 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().

◆ nucomp_polar()

static VALUE nucomp_polar ( VALUE  self)
static

Definition at line 1053 of file complex.c.

References f_abs, and rb_assoc_new().

Referenced by Init_Complex().

◆ nucomp_rationalize()

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

◆ nucomp_real()

static VALUE nucomp_real ( VALUE  self)
static

Definition at line 603 of file complex.c.

References get_dat1.

Referenced by Init_Complex().

◆ nucomp_real_check()

static void nucomp_real_check ( VALUE  num)
inlinestatic

Definition at line 344 of file complex.c.

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

Referenced by nucomp_s_new(), and nucomp_s_polar().

◆ nucomp_rect()

static VALUE nucomp_rect ( VALUE  self)
static

Definition at line 1038 of file complex.c.

References get_dat1, and rb_assoc_new().

Referenced by Init_Complex().

◆ nucomp_s_alloc()

static VALUE nucomp_s_alloc ( VALUE  klass)
static

Definition at line 285 of file complex.c.

References nucomp_s_new_internal(), and ZERO.

Referenced by Init_Complex().

◆ nucomp_s_canonicalize_internal()

static VALUE nucomp_s_canonicalize_internal ( VALUE  klass,
VALUE  real,
VALUE  imag 
)
inlinestatic

◆ nucomp_s_convert()

static VALUE nucomp_s_convert ( int  argc,
VALUE argv,
VALUE  klass 
)
static

◆ nucomp_s_new()

static VALUE nucomp_s_new ( int  argc,
VALUE argv,
VALUE  klass 
)
static

◆ nucomp_s_new_internal()

static VALUE nucomp_s_new_internal ( VALUE  klass,
VALUE  real,
VALUE  imag 
)
inlinestatic

◆ nucomp_s_polar()

static VALUE nucomp_s_polar ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 576 of file complex.c.

References argc, argv, f_complex_polar(), nucomp_real_check(), rb_scan_args(), and ZERO.

Referenced by Init_Complex().

◆ nucomp_sub()

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().

◆ nucomp_to_c()

static VALUE nucomp_to_c ( VALUE  self)
static

Definition at line 1459 of file complex.c.

Referenced by Init_Complex().

◆ nucomp_to_f()

static VALUE nucomp_to_f ( VALUE  self)
static

Definition at line 1383 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_to_i()

static VALUE nucomp_to_i ( VALUE  self)
static

Definition at line 1359 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_to_r()

static VALUE nucomp_to_r ( VALUE  self)
static

Definition at line 1409 of file complex.c.

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

Referenced by Init_Complex().

◆ nucomp_to_s()

static VALUE nucomp_to_s ( VALUE  self)
static

Definition at line 1244 of file complex.c.

References f_format(), and f_to_s.

Referenced by Init_Complex().

◆ numeric_abs2()

static VALUE numeric_abs2 ( VALUE  self)
static

Definition at line 1938 of file complex.c.

References f_mul().

Referenced by Init_Complex().

◆ numeric_arg()

static VALUE numeric_arg ( VALUE  self)
static

Definition at line 1954 of file complex.c.

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

Referenced by Init_Complex().

◆ numeric_conj()

static VALUE numeric_conj ( VALUE  self)
static

Definition at line 1994 of file complex.c.

Referenced by Init_Complex().

◆ numeric_imag()

static VALUE numeric_imag ( VALUE  self)
static

Definition at line 1926 of file complex.c.

References INT2FIX.

Referenced by Init_Complex().

◆ numeric_polar()

static VALUE numeric_polar ( VALUE  self)
static

Definition at line 1981 of file complex.c.

References f_abs, and rb_assoc_new().

Referenced by Init_Complex().

◆ numeric_real()

static VALUE numeric_real ( VALUE  self)
static

Definition at line 1913 of file complex.c.

Referenced by Init_Complex().

◆ numeric_rect()

static VALUE numeric_rect ( VALUE  self)
static

Definition at line 1969 of file complex.c.

References INT2FIX, and rb_assoc_new().

Referenced by Init_Complex().

◆ numeric_to_c()

static VALUE numeric_to_c ( VALUE  self)
static

Definition at line 1483 of file complex.c.

References rb_complex_new1.

Referenced by Init_Complex().

◆ parse_comp()

static int parse_comp ( const char *  s,
int  strict,
VALUE num 
)
static

Definition at line 1731 of file complex.c.

References ALLOCV_END, ALLOCV_N, buf, read_comp(), skip_ws(), and strlen().

Referenced by string_to_c(), and string_to_c_strict().

◆ rb_Complex()

VALUE rb_Complex ( VALUE  x,
VALUE  y 
)

Definition at line 1339 of file complex.c.

References nucomp_s_convert(), and rb_cComplex.

Referenced by nurat_coerce().

◆ rb_complex_new()

VALUE rb_complex_new ( VALUE  x,
VALUE  y 
)

Definition at line 1325 of file complex.c.

References nucomp_s_canonicalize_internal(), and rb_cComplex.

Referenced by num_imaginary().

◆ rb_complex_polar()

VALUE rb_complex_polar ( VALUE  x,
VALUE  y 
)

Definition at line 1331 of file complex.c.

References f_complex_polar(), and rb_cComplex.

Referenced by read_comp().

◆ rb_complex_raw()

VALUE rb_complex_raw ( VALUE  x,
VALUE  y 
)

Definition at line 1319 of file complex.c.

References nucomp_s_new_internal(), and rb_cComplex.

Referenced by parser_set_number_literal().

◆ rb_cstr_to_rat()

VALUE rb_cstr_to_rat ( const char *  ,
int   
)

Definition at line 2376 of file rational.c.

References parse_rat(), rb_eFloatDomainError, rb_raise(), RB_TYPE_P, and T_FLOAT.

Referenced by str2num().

◆ read_comp()

static int read_comp ( const char **  s,
int  strict,
VALUE ret,
char **  b 
)
static

◆ read_den()

static int read_den ( const char **  s,
int  strict,
char **  b 
)
inlinestatic

Definition at line 1586 of file complex.c.

References read_digits().

Referenced by read_rat_nos().

◆ read_digits()

static int read_digits ( const char **  s,
int  strict,
char **  b 
)
static

Definition at line 1517 of file complex.c.

References isdecimal().

Referenced by read_den(), and read_num().

◆ read_num()

static int read_num ( const char **  s,
int  strict,
char **  b 
)
static

Definition at line 1554 of file complex.c.

References islettere(), read_digits(), and read_sign().

Referenced by read_rat_nos().

◆ read_rat()

static int read_rat ( const char **  s,
int  strict,
char **  b 
)
static

Definition at line 1613 of file complex.c.

References read_rat_nos(), and read_sign().

Referenced by read_comp().

◆ read_rat_nos()

static int read_rat_nos ( const char **  s,
int  strict,
char **  b 
)
static

Definition at line 1595 of file complex.c.

References read_den(), and read_num().

Referenced by read_comp(), and read_rat().

◆ read_sign()

static int read_sign ( const char **  s,
char **  b 
)
static

Definition at line 1497 of file complex.c.

References issign().

Referenced by read_comp(), read_num(), and read_rat().

◆ skip_ws()

static void skip_ws ( const char **  s)
inlinestatic

Definition at line 1724 of file complex.c.

Referenced by parse_comp().

◆ str2num()

static VALUE str2num ( char *  s)
static

Definition at line 1632 of file complex.c.

References DBL2NUM, rb_cstr_to_dbl(), rb_cstr_to_inum(), rb_cstr_to_rat(), and strchr().

Referenced by read_comp().

◆ string_to_c()

static VALUE string_to_c ( VALUE  self)
static

Definition at line 1812 of file complex.c.

References parse_comp(), rb_must_asciicompat(), rb_str_modify(), RSTRING_LEN, and RSTRING_PTR.

Referenced by Init_Complex().

◆ string_to_c_strict()

static VALUE string_to_c_strict ( VALUE  self)
static

Variable Documentation

◆ id_abs

ID id_abs
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_arg

ID id_arg
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_convert

ID id_convert
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_f_complex().

◆ id_denominator

ID id_denominator
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_eqeq_p

ID id_eqeq_p
static

Definition at line 21 of file complex.c.

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

◆ id_expt

ID id_expt
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_expt().

◆ id_fdiv

ID id_fdiv
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_fdiv().

◆ id_i_imag

ID id_i_imag
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), nucomp_loader(), and nucomp_marshal_load().

◆ id_i_real

ID id_i_real
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), nucomp_loader(), and nucomp_marshal_load().

◆ id_inspect

ID id_inspect
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_negate

ID id_negate
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_numerator

ID id_numerator
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_quo

ID id_quo
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex(), and nucomp_div().

◆ id_real_p

ID id_real_p
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_to_f

ID id_to_f
static

Definition at line 21 of file complex.c.

Referenced by f_to_f(), and Init_Complex().

◆ id_to_i

ID id_to_i
static

Definition at line 21 of file complex.c.

Referenced by fun1(), and Init_Complex().

◆ id_to_r

ID id_to_r
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ id_to_s

ID id_to_s
static

Definition at line 21 of file complex.c.

Referenced by Init_Complex().

◆ rb_cComplex

VALUE rb_cComplex