#include "ruby.h"#include "internal.h"#include <math.h>#include <assert.h>#include <ctype.h>Go to the source code of this file.
Defines | |
| #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 |
| #define binop | ( | n, | |||
| op | ) |
| #define f_boolcast | ( | x | ) | ((x) ? Qtrue : Qfalse) |
Definition at line 27 of file complex.c.
Referenced by d_lite_friday_p(), d_lite_julian_p(), d_lite_monday_p(), d_lite_sunday_p(), d_lite_thursday_p(), d_lite_tuesday_p(), d_lite_wday(), d_lite_wednesday_p(), d_lite_zone(), f_eqeq_p(), f_gt_p(), f_lt_p(), f_minus_one_p(), f_one_p(), f_signbit(), f_tpositive_p(), f_zero_p(), fun1(), fun2(), nucomp_eqeq_p(), nucomp_eql_p(), and nurat_eqeq_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().
| #define f_positive_p | ( | x | ) | (!f_negative_p(x)) |
| #define fun1 | ( | n | ) |
Value:
inline static VALUE \ f_##n(VALUE x)\ {\ return rb_funcall(x, id_##n, 0);\ }
| #define fun2 | ( | n | ) |
| #define get_dat1 | ( | x | ) |
Value:
Definition at line 264 of file complex.c.
Referenced by f_addsub(), f_divide(), f_format(), imp1(), m_sin(), nucomp_abs(), nucomp_abs2(), nucomp_arg(), nucomp_conj(), nucomp_denominator(), nucomp_eqeq_p(), nucomp_expt(), nucomp_hash(), nucomp_imag(), nucomp_loader(), nucomp_marshal_dump(), nucomp_mul(), nucomp_negate(), nucomp_numerator(), nucomp_rationalize(), nucomp_real(), nucomp_rect(), nucomp_s_canonicalize_internal(), nucomp_s_convert(), nucomp_to_f(), nucomp_to_i(), nucomp_to_r(), nurat_add(), nurat_ceil(), nurat_cmp(), nurat_denominator(), nurat_div(), nurat_eqeq_p(), nurat_expt(), nurat_floor(), nurat_hash(), nurat_loader(), nurat_marshal_dump(), nurat_mul(), nurat_numerator(), nurat_round(), nurat_sub(), nurat_to_f(), nurat_truncate(), and rb_rational_reciprocal().
| #define get_dat2 | ( | x, | |||
| y | ) |
Value:
Definition at line 268 of file complex.c.
Referenced by f_addsub(), f_divide(), nucomp_eqeq_p(), nucomp_eql_p(), nucomp_mul(), nucomp_s_canonicalize_internal(), nurat_add(), nurat_cmp(), nurat_div(), nurat_eqeq_p(), nurat_mul(), and nurat_sub().
| #define id_PI rb_intern("PI") |
| #define imp1 | ( | n | ) |
| #define imp2 | ( | n | ) |
| #define k_exact_one_p | ( | x | ) | (k_exact_p(x) && f_one_p(x)) |
| #define k_exact_p | ( | x | ) | (!k_float_p(x)) |
| #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(), nucomp_s_convert(), nurat_coerce(), nurat_expt(), and nurat_s_convert().
| #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().
| #define m_hypot | ( | x, | |||
| y | ) | m_hypot_bang((x),(y)) |
Referenced by nucomp_abs().
| #define math1 | ( | n | ) |
| #define math2 | ( | n | ) |
| #define nucomp_quo nucomp_div |
| #define ONE INT2FIX(1) |
Definition at line 16 of file complex.c.
Referenced by f_divide(), f_one_p(), f_rational_new_bang1(), f_reciprocal(), f_round_common(), float_to_r(), Init_Complex(), nucomp_expt(), nucomp_s_convert(), nurat_add(), nurat_div(), nurat_expt(), nurat_mul(), nurat_rationalize_internal(), nurat_s_alloc(), nurat_s_new(), nurat_sub(), rb_flt_rationalize(), and read_num().
| #define rb_intern | ( | str | ) | rb_intern_const(str) |
| #define rb_raise_zerodiv | ( | ) | rb_raise(rb_eZeroDivError, "divided by 0") |
Definition at line 788 of file complex.c.
Referenced by nurat_div(), nurat_expt(), nurat_marshal_load(), nurat_s_canonicalize_internal(), and nurat_s_canonicalize_internal_no_reduce().
| #define TWO INT2FIX(2) |
Definition at line 17 of file complex.c.
Referenced by nucomp_expt(), nurat_round(), and rb_flt_rationalize().
| #define ZERO INT2FIX(0) |
Definition at line 15 of file complex.c.
Referenced by binop(), f_complex_new_bang1(), f_imul(), f_lcm(), f_mul(), f_round_common(), f_zero_p(), fun2(), Init_Complex(), nucomp_expt(), nucomp_s_alloc(), nucomp_s_canonicalize_internal(), nucomp_s_convert(), nucomp_s_new(), nucomp_s_polar(), nurat_cmp(), nurat_expt(), nurat_rationalize_internal(), nurat_s_alloc(), nurat_s_canonicalize_internal(), nurat_s_canonicalize_internal_no_reduce(), permute(), read_comp(), read_digits(), and read_num().
| static VALUE f_add | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [inline, static] |
| static VALUE f_addsub | ( | VALUE | self, | |
| VALUE | other, | |||
| VALUE(*)(VALUE, VALUE) | func, | |||
| ID | id | |||
| ) | [inline, static] |
Definition at line 641 of file complex.c.
References CLASS_OF, f_complex_new2(), get_dat1, get_dat2, k_complex_p(), k_numeric_p(), and rb_num_coerce_bin().
Referenced by nucomp_add(), nucomp_sub(), nurat_add(), and nurat_sub().
| static VALUE f_complex_new2 | ( | VALUE | klass, | |
| VALUE | x, | |||
| VALUE | y | |||
| ) | [inline, static] |
Definition at line 422 of file complex.c.
References assert, k_complex_p(), and nucomp_s_canonicalize_internal().
Referenced by f_addsub(), f_divide(), imp1(), m_sin(), nucomp_conj(), nucomp_mul(), nucomp_negate(), and nucomp_numerator().
| static VALUE f_complex_new_bang1 | ( | VALUE | klass, | |
| VALUE | x | |||
| ) | [inline, static] |
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().
| static VALUE f_complex_new_bang2 | ( | VALUE | klass, | |
| VALUE | x, | |||
| VALUE | y | |||
| ) | [inline, static] |
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().
| static VALUE f_complex_polar | ( | VALUE | klass, | |
| VALUE | x, | |||
| VALUE | y | |||
| ) | [inline, static] |
Definition at line 553 of file complex.c.
References assert, f_mul, k_complex_p(), m_sin(), and nucomp_s_canonicalize_internal().
Referenced by nucomp_expt(), nucomp_s_polar(), and rb_complex_polar().
| static VALUE f_div | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [inline, static] |
| static VALUE f_divide | ( | VALUE | self, | |
| VALUE | other, | |||
| VALUE(*)(VALUE, VALUE) | func, | |||
| ID | id | |||
| ) | [inline, static] |
Definition at line 737 of file complex.c.
References CLASS_OF, f_abs, f_add, f_complex_new2(), f_gt_p, f_mul, f_negate, f_sub, get_dat1, get_dat2, k_complex_p(), k_float_p(), k_numeric_p(), ONE, and rb_num_coerce_bin().
Referenced by nucomp_div(), and nucomp_fdiv().
| static VALUE f_format | ( | VALUE | self, | |
| VALUE(*)(VALUE) | func | |||
| ) | [static] |
Definition at line 1210 of file complex.c.
References f_abs, f_tpositive_p(), get_dat1, rb_isdigit(), rb_str_cat2(), rb_str_concat(), RSTRING_LEN, and RSTRING_PTR.
Referenced by nucomp_inspect(), nucomp_to_s(), nurat_inspect(), and nurat_to_s().
| static VALUE f_gt_p | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [inline, static] |
Definition at line 87 of file complex.c.
References f_boolcast, FIX2LONG, FIXNUM_P, and rb_funcall().
| static VALUE f_kind_of_p | ( | VALUE | x, | |
| VALUE | c | |||
| ) | [inline, static] |
Definition at line 217 of file complex.c.
References rb_obj_is_kind_of().
Referenced by f_kind_of_p(), k_bignum_p(), k_complex_p(), k_date_p(), k_fixnum_p(), k_float_p(), k_integer_p(), k_numeric_p(), and k_rational_p().
| static VALUE f_mul | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [inline, static] |
| static VALUE f_one_p | ( | VALUE | x | ) | [inline, static] |
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, T_RATIONAL, and VALUE.
Referenced by nucomp_expt(), nurat_div(), nurat_expt(), nurat_s_canonicalize_internal(), and nurat_s_canonicalize_internal_no_reduce().
| static VALUE f_reciprocal | ( | VALUE | x | ) | [inline, static] |
| static VALUE f_signbit | ( | VALUE | x | ) | [inline, static] |
Definition at line 1190 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().
| static VALUE f_sub | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [inline, static] |
| static VALUE f_to_f | ( | VALUE | x | ) | [inline, static] |
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(), nucomp_to_f(), nurat_add(), nurat_cmp(), nurat_coerce(), nurat_div(), nurat_eqeq_p(), nurat_expt(), nurat_fdiv(), nurat_mul(), and nurat_sub().
| static VALUE f_tpositive_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 1204 of file complex.c.
References f_boolcast, and f_signbit().
Referenced by f_format(), and float_arg().
| static VALUE f_zero_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 179 of file complex.c.
References f_boolcast, FIX2LONG, FIXNUM_P, id_eqeq_p, Qfalse, rb_funcall(), RB_TYPE_P, RRATIONAL, T_BIGNUM, T_FIXNUM, T_RATIONAL, VALUE, and ZERO.
Referenced by f_gcd_normal(), f_lcm(), k_rational_p(), nucomp_abs(), nucomp_eqeq_p(), nucomp_s_canonicalize_internal(), nurat_div(), nurat_eqeq_p(), nurat_expt(), nurat_fdiv(), nurat_marshal_load(), and rb_flt_rationalize().
| static VALUE float_arg | ( | VALUE | self | ) | [static] |
Definition at line 2006 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 | ( | to_r | ) |
Definition at line 153 of file complex.c.
References f_boolcast, FIX2LONG, FIXNUM_P, id_eqeq_p, and rb_funcall().
| 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.
| fun2 | ( | expt | ) |
Definition at line 164 of file complex.c.
References f_boolcast, FIX2LONG, FIXNUM_P, rb_funcall(), and ZERO.
| imp1 | ( | sin | ) |
Definition at line 493 of file complex.c.
References f_complex_new2(), f_mul, f_negate, get_dat1, and rb_cComplex.
| imp2 | ( | atan2 | ) |
| void Init_Complex | ( | void | ) |
Definition at line 2048 of file complex.c.
References assert, CLASS_OF, f_complex_new_bang2(), float_arg(), id_abs, id_arg, id_convert, id_denominator, id_eqeq_p, id_expt, id_fdiv, id_i_imag, id_i_real, id_inspect, id_negate, id_numerator, id_quo, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s, nilclass_to_c(), nucomp_abs(), nucomp_abs2(), nucomp_add(), nucomp_arg(), nucomp_coerce(), nucomp_conj(), nucomp_denominator(), nucomp_div(), nucomp_dumper(), nucomp_eqeq_p(), nucomp_eql_p(), nucomp_expt(), nucomp_f_complex(), nucomp_false(), nucomp_fdiv(), nucomp_hash(), nucomp_imag(), nucomp_inspect(), nucomp_loader(), nucomp_marshal_dump(), nucomp_marshal_load(), nucomp_mul(), nucomp_negate(), nucomp_numerator(), nucomp_polar(), nucomp_quo, nucomp_rationalize(), nucomp_real(), nucomp_rect(), nucomp_s_alloc(), nucomp_s_convert(), nucomp_s_new(), nucomp_s_polar(), nucomp_sub(), nucomp_to_c(), nucomp_to_f(), nucomp_to_i(), nucomp_to_r(), nucomp_to_s(), numeric_abs2(), numeric_arg(), numeric_conj(), numeric_imag(), numeric_polar(), numeric_real(), numeric_rect(), numeric_to_c(), ONE, rb_cComplex, rb_cFloat, rb_cNilClass, rb_cNumeric, rb_cObject, rb_cString, rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_const(), rb_define_global_function(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_intern, rb_marshal_define_compat(), rb_undef_method(), string_to_c(), VALUE, and ZERO.
| static int isdecimal | ( | int | c | ) | [inline, static] |
| static int isimagunit | ( | int | c | ) | [inline, static] |
| static int islettere | ( | int | c | ) | [inline, static] |
| static VALUE k_bignum_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 235 of file complex.c.
References f_kind_of_p(), and rb_cBignum.
Referenced by nucomp_expt().
| static VALUE k_complex_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 253 of file complex.c.
References f_kind_of_p(), and rb_cComplex.
Referenced by f_addsub(), f_complex_new2(), f_complex_new_bang1(), f_complex_new_bang2(), f_complex_polar(), f_divide(), nucomp_eqeq_p(), nucomp_eql_p(), nucomp_expt(), and nucomp_mul().
| static VALUE k_fixnum_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 229 of file complex.c.
References f_kind_of_p(), and rb_cFixnum.
Referenced by nucomp_expt().
| static VALUE k_float_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 241 of file complex.c.
References f_kind_of_p(), and rb_cFloat.
Referenced by f_divide(), f_round_common(), and nucomp_abs().
| static VALUE k_numeric_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 223 of file complex.c.
References f_kind_of_p(), and rb_cNumeric.
Referenced by d_lite_minus(), f_addsub(), f_divide(), nucomp_coerce(), nucomp_eqeq_p(), nucomp_expt(), nucomp_mul(), nucomp_real_check(), nucomp_s_convert(), nurat_expt(), nurat_int_check(), and nurat_s_convert().
| static VALUE k_rational_p | ( | VALUE | x | ) | [inline, static] |
Definition at line 247 of file complex.c.
References f_kind_of_p(), and rb_cRational.
Referenced by f_rational_new2(), f_rational_new_no_reduce2(), f_round_common(), nucomp_expt(), and nurat_expt().
| static VALUE m_sin | ( | VALUE | x | ) | [static] |
Definition at line 512 of file complex.c.
References f_complex_new2(), f_mul, get_dat1, and rb_cComplex.
Referenced by f_complex_polar().
| static VALUE nilclass_to_c | ( | VALUE | self | ) | [static] |
Definition at line 1469 of file complex.c.
References INT2FIX, and rb_complex_new1.
Referenced by Init_Complex().
| static VALUE nucomp_abs | ( | VALUE | self | ) | [static] |
Definition at line 973 of file complex.c.
References f_abs, f_to_f(), f_zero_p(), get_dat1, k_float_p(), m_hypot, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_abs2 | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_add | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 676 of file complex.c.
References f_add, and f_addsub().
Referenced by Init_Complex().
| static VALUE nucomp_arg | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_coerce | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 950 of file complex.c.
References CLASS_OF, f_complex_new_bang1(), k_numeric_p(), Qnil, rb_assoc_new(), rb_eTypeError, rb_obj_classname(), rb_raise(), RB_TYPE_P, and T_COMPLEX.
Referenced by Init_Complex().
| static VALUE nucomp_conj | ( | VALUE | self | ) | [static] |
Definition at line 1066 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 1119 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 804 of file complex.c.
References f_divide(), f_quo, and id_quo.
Referenced by Init_Complex().
| static VALUE nucomp_dumper | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_eqeq_p | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 932 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 1176 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] |
Definition at line 841 of file complex.c.
References CLASS_OF, f_abs, f_add, f_arg, f_complex_new_bang1(), f_complex_polar(), f_denominator, f_expt, f_gt_p, f_mul, f_negate, f_numerator, f_one_p(), f_reciprocal, f_sub, FIX2LONG, get_dat1, id_expt, k_bignum_p(), k_complex_p(), k_exact_zero_p, k_fixnum_p(), k_numeric_p(), k_rational_p(), nucomp_s_new_internal(), ONE, rb_num_coerce_bin(), rb_warn(), TWO, VALUE, and ZERO.
Referenced by Init_Complex().
| static VALUE nucomp_f_complex | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | klass | |||
| ) | [static] |
Definition at line 460 of file complex.c.
References id_convert, rb_cComplex, and rb_funcall2.
Referenced by Init_Complex().
| static VALUE nucomp_false | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_fdiv | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 820 of file complex.c.
References f_divide(), and id_fdiv.
Referenced by Init_Complex().
| static VALUE nucomp_hash | ( | VALUE | self | ) | [static] |
Definition at line 1160 of file complex.c.
References get_dat1, LONG2FIX, NUM2LONG, rb_hash(), rb_memhash(), and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_imag | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_inspect | ( | VALUE | self | ) | [static] |
Definition at line 1260 of file complex.c.
References f_format(), f_inspect, rb_str_cat2(), rb_str_concat(), rb_usascii_str_new2, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_loader | ( | VALUE | self, | |
| VALUE | a | |||
| ) | [static] |
Definition at line 1280 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().
| static VALUE nucomp_marshal_dump | ( | VALUE | self | ) | [static] |
Definition at line 1292 of file complex.c.
References get_dat1, rb_assoc_new(), rb_copy_generic_ivar(), and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_marshal_load | ( | VALUE | self, | |
| VALUE | a | |||
| ) | [static] |
Definition at line 1304 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().
| static VALUE nucomp_mul | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 712 of file complex.c.
References CLASS_OF, f_add, f_complex_new2(), f_mul, f_sub, get_dat1, get_dat2, k_complex_p(), k_numeric_p(), rb_num_coerce_bin(), and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_negate | ( | VALUE | self | ) | [static] |
Definition at line 633 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 1144 of file complex.c.
References CLASS_OF, f_complex_new2(), f_denominator, f_div, f_mul, f_numerator, get_dat1, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_polar | ( | VALUE | self | ) | [static] |
Definition at line 1051 of file complex.c.
References f_abs, f_arg, and rb_assoc_new().
Referenced by Init_Complex().
| static VALUE nucomp_rationalize | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
Definition at line 1433 of file complex.c.
References f_nonzero_p, f_to_s, get_dat1, k_inexact_p, NULL, rb_eRangeError, rb_funcall2, rb_intern, rb_raise(), rb_scan_args(), StringValuePtr, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_real | ( | VALUE | self | ) | [static] |
| static void nucomp_real_check | ( | VALUE | num | ) | [inline, static] |
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().
| static VALUE nucomp_rect | ( | VALUE | self | ) | [static] |
Definition at line 1036 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 285 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 | |||
| ) | [inline, static] |
Definition at line 356 of file complex.c.
References f_add, f_sub, f_zero_p(), get_dat1, get_dat2, k_exact_zero_p, nucomp_s_new_internal(), and ZERO.
Referenced by f_complex_new2(), f_complex_polar(), nucomp_s_new(), and rb_complex_new().
| static VALUE nucomp_s_convert | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | klass | |||
| ) | [static] |
Definition at line 1834 of file complex.c.
References f_add, f_complex_new_bang2(), f_mul, get_dat1, k_exact_zero_p, k_numeric_p(), NIL_P, nucomp_s_new(), ONE, rb_backref_get(), rb_backref_set(), rb_cComplex, rb_convert_type(), rb_eTypeError, rb_match_busy(), rb_raise(), rb_scan_args(), RB_TYPE_P, string_to_c_strict(), T_COMPLEX, T_STRING, VALUE, and ZERO.
Referenced by Init_Complex(), and rb_Complex().
| static VALUE nucomp_s_new | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | klass | |||
| ) | [static] |
Definition at line 403 of file complex.c.
References nucomp_real_check(), nucomp_s_canonicalize_internal(), rb_scan_args(), VALUE, and ZERO.
Referenced by Init_Complex(), and nucomp_s_convert().
| static VALUE nucomp_s_new_internal | ( | VALUE | klass, | |
| VALUE | real, | |||
| VALUE | imag | |||
| ) | [inline, static] |
Definition at line 274 of file complex.c.
References FL_WB_PROTECTED, NEWOBJ_OF, RCOMPLEX_SET_IMAG, RCOMPLEX_SET_REAL, RGENGC_WB_PROTECTED_COMPLEX, T_COMPLEX, and VALUE.
Referenced by f_complex_new_bang1(), f_complex_new_bang2(), nucomp_expt(), nucomp_s_alloc(), nucomp_s_canonicalize_internal(), and rb_complex_raw().
| static VALUE nucomp_s_polar | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | klass | |||
| ) | [static] |
Definition at line 574 of file complex.c.
References f_complex_polar(), nucomp_real_check(), rb_scan_args(), VALUE, and ZERO.
Referenced by Init_Complex().
| static VALUE nucomp_sub | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 694 of file complex.c.
References f_addsub(), and f_sub.
Referenced by Init_Complex().
| static VALUE nucomp_to_c | ( | VALUE | self | ) | [static] |
| static VALUE nucomp_to_f | ( | VALUE | self | ) | [static] |
Definition at line 1381 of file complex.c.
References f_nonzero_p, f_to_f(), f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), StringValuePtr, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_to_i | ( | VALUE | self | ) | [static] |
Definition at line 1357 of file complex.c.
References f_nonzero_p, f_to_i, f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), StringValuePtr, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_to_r | ( | VALUE | self | ) | [static] |
Definition at line 1407 of file complex.c.
References f_nonzero_p, f_to_r, f_to_s, get_dat1, k_inexact_p, rb_eRangeError, rb_raise(), StringValuePtr, and VALUE.
Referenced by Init_Complex().
| static VALUE nucomp_to_s | ( | VALUE | self | ) | [static] |
Definition at line 1242 of file complex.c.
References f_format(), and f_to_s.
Referenced by Init_Complex().
| static VALUE numeric_abs2 | ( | VALUE | self | ) | [static] |
| static VALUE numeric_arg | ( | VALUE | self | ) | [static] |
Definition at line 1952 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] |
| static VALUE numeric_imag | ( | VALUE | self | ) | [static] |
| static VALUE numeric_polar | ( | VALUE | self | ) | [static] |
Definition at line 1979 of file complex.c.
References f_abs, f_arg, and rb_assoc_new().
Referenced by Init_Complex().
| static VALUE numeric_real | ( | VALUE | self | ) | [static] |
| static VALUE numeric_rect | ( | VALUE | self | ) | [static] |
Definition at line 1967 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 1481 of file complex.c.
References rb_complex_new1.
Referenced by Init_Complex().
| static int parse_comp | ( | const char * | s, | |
| int | strict, | |||
| VALUE * | num | |||
| ) | [static] |
Definition at line 1729 of file complex.c.
References ALLOCV_END, ALLOCV_N, buf, read_comp(), skip_ws(), strlen(), and VALUE.
Referenced by string_to_c(), and string_to_c_strict().
| VALUE rb_Complex | ( | VALUE | x, | |
| VALUE | y | |||
| ) |
Definition at line 1337 of file complex.c.
References nucomp_s_convert(), rb_cComplex, and VALUE.
Referenced by nurat_coerce().
| VALUE rb_complex_new | ( | VALUE | x, | |
| VALUE | y | |||
| ) |
Definition at line 1323 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 1329 of file complex.c.
References f_complex_polar(), and rb_cComplex.
Referenced by read_comp().
| VALUE rb_complex_raw | ( | VALUE | x, | |
| VALUE | y | |||
| ) |
Definition at line 1317 of file complex.c.
References nucomp_s_new_internal(), and rb_cComplex.
Referenced by parser_set_number_literal().
| VALUE rb_cstr_to_rat | ( | const char * | , | |
| int | ||||
| ) |
Definition at line 2374 of file rational.c.
References parse_rat(), rb_eFloatDomainError, rb_raise(), RB_TYPE_P, T_FLOAT, and VALUE.
Referenced by str2num().
| static int read_comp | ( | const char ** | s, | |
| int | strict, | |||
| VALUE * | ret, | |||
| char ** | b | |||
| ) | [static] |
Definition at line 1640 of file complex.c.
References INT2FIX, isdecimal(), isimagunit(), issign, rb_complex_new2, rb_complex_polar(), read_rat(), read_rat_nos(), read_sign(), str2num, strlen(), VALUE, and ZERO.
Referenced by parse_comp().
| static int read_den | ( | const char ** | s, | |
| int | strict, | |||
| char ** | b | |||
| ) | [inline, static] |
| static int read_digits | ( | const char ** | s, | |
| int | strict, | |||
| char ** | b | |||
| ) | [static] |
Definition at line 1515 of file complex.c.
References isdecimal().
Referenced by read_den(), and read_num().
| static int read_num | ( | const char ** | s, | |
| int | strict, | |||
| char ** | b | |||
| ) | [static] |
Definition at line 1552 of file complex.c.
References islettere(), read_digits(), and read_sign().
Referenced by read_rat_nos().
| static int read_rat | ( | const char ** | s, | |
| int | strict, | |||
| char ** | b | |||
| ) | [static] |
Definition at line 1611 of file complex.c.
References read_rat_nos(), and read_sign().
Referenced by parse_rat(), and read_comp().
| static int read_rat_nos | ( | const char ** | s, | |
| int | strict, | |||
| char ** | b | |||
| ) | [static] |
Definition at line 1593 of file complex.c.
References read_den(), and read_num().
Referenced by read_comp(), and read_rat().
| static int read_sign | ( | const char ** | s, | |
| char ** | b | |||
| ) | [static] |
Definition at line 1495 of file complex.c.
References issign.
Referenced by read_comp(), read_num(), and read_rat().
| static void skip_ws | ( | const char ** | s | ) | [inline, static] |
| static VALUE str2num | ( | char * | s | ) | [static] |
Definition at line 1630 of file complex.c.
References DBL2NUM, rb_cstr_to_dbl(), rb_cstr_to_inum(), rb_cstr_to_rat(), and strchr().
| static VALUE string_to_c | ( | VALUE | self | ) | [static] |
Definition at line 1810 of file complex.c.
References parse_comp(), rb_must_asciicompat(), rb_str_modify(), RSTRING_LEN, RSTRING_PTR, and VALUE.
Referenced by Init_Complex().
| static VALUE string_to_c_strict | ( | VALUE | self | ) | [static] |
Definition at line 1756 of file complex.c.
References f_inspect, parse_comp(), rb_eArgError, rb_must_asciicompat(), rb_raise(), rb_str_modify(), RSTRING_LEN, RSTRING_PTR, StringValuePtr, and VALUE.
Referenced by nucomp_s_convert().
ID id_convert [static] |
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), Init_Rational(), nucomp_f_complex(), and nurat_f_rational().
ID id_denominator [static] |
Definition at line 21 of file complex.c.
Referenced by f_eqeq_p(), f_minus_one_p(), f_one_p(), f_zero_p(), fun1(), Init_Complex(), and Init_Rational().
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), Init_Rational(), nucomp_expt(), and nurat_expt().
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), Init_Rational(), and nucomp_fdiv().
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), nucomp_loader(), and nucomp_marshal_load().
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), nucomp_loader(), and nucomp_marshal_load().
ID id_inspect [static] |
ID id_numerator [static] |
Definition at line 21 of file complex.c.
Referenced by f_to_f(), Init_Complex(), and Init_Rational().
Definition at line 21 of file complex.c.
Referenced by fun1(), Init_Complex(), Init_Numeric(), Init_Rational(), and num_to_int().
Definition at line 21 of file complex.c.
Referenced by Init_Complex(), Init_String(), and rb_obj_as_string().
| VALUE rb_cComplex |
Definition at line 19 of file complex.c.
Referenced by imp1(), Init_Complex(), k_complex_p(), m_sin(), nucomp_f_complex(), nucomp_s_convert(), rb_Complex(), rb_complex_new(), rb_complex_polar(), and rb_complex_raw().
1.4.7