#include "ruby/ruby.h"#include "ruby/encoding.h"#include "ruby/util.h"#include "internal.h"#include "id.h"#include <ctype.h>#include <math.h>#include <stdio.h>Go to the source code of this file.
Defines | |
| #define | FLT_RADIX 2 |
| #define | FLT_ROUNDS 1 |
| #define | DBL_MIN 2.2250738585072014e-308 |
| #define | DBL_MAX 1.7976931348623157e+308 |
| #define | DBL_MIN_EXP (-1021) |
| #define | DBL_MAX_EXP 1024 |
| #define | DBL_MIN_10_EXP (-307) |
| #define | DBL_MAX_10_EXP 308 |
| #define | DBL_DIG 15 |
| #define | DBL_EPSILON 2.2204460492503131e-16 |
| #define | NUMERR_TYPE 1 |
| #define | NUMERR_NEGATIVE 2 |
| #define | NUMERR_TOOLARGE 3 |
| #define | DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS) |
| #define | method_basic_p(klass) rb_method_basic_definition_p(klass, mid) |
| #define | LONG_MIN_MINUS_ONE ((double)LONG_MIN-1) |
| #define | LONG_MAX_PLUS_ONE (2*(double)(LONG_MAX/2+1)) |
| #define | ULONG_MAX_PLUS_ONE (2*(double)(ULONG_MAX/2+1)) |
| #define | VALUE_MSBMASK ((VALUE)1 << ((sizeof(VALUE) * CHAR_BIT) - 1)) |
| #define | int_succ rb_int_succ |
| #define | int_pred rb_int_pred |
| #define | SQRT_LONG_MAX ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2)) |
| #define | FIT_SQRT_LONG(n) (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX)) |
| #define | rb_intern(str) rb_intern_const(str) |
Functions | |
| double | round (double x) |
| static VALUE | fix_uminus (VALUE num) |
| static VALUE | fix_mul (VALUE x, VALUE y) |
| static VALUE | int_pow (long x, unsigned long y) |
| void | rb_num_zerodiv (void) |
| int | rb_num_to_uint (VALUE val, unsigned int *ret) |
| static int | positive_int_p (VALUE num) |
| static int | negative_int_p (VALUE num) |
| int | rb_num_negative_p (VALUE num) |
| static VALUE | num_coerce (VALUE x, VALUE y) |
| static VALUE | coerce_body (VALUE *x) |
| NORETURN (static void coerce_failed(VALUE x, VALUE y)) | |
| static void | coerce_failed (VALUE x, VALUE y) |
| static VALUE | coerce_rescue (VALUE *x) |
| static int | do_coerce (VALUE *x, VALUE *y, int err) |
| VALUE | rb_num_coerce_bin (VALUE x, VALUE y, ID func) |
| VALUE | rb_num_coerce_cmp (VALUE x, VALUE y, ID func) |
| VALUE | rb_num_coerce_relop (VALUE x, VALUE y, ID func) |
| static VALUE | num_sadded (VALUE x, VALUE name) |
| static VALUE | num_init_copy (VALUE x, VALUE y) |
| static VALUE | num_uplus (VALUE num) |
| static VALUE | num_imaginary (VALUE num) |
| static VALUE | num_uminus (VALUE num) |
| static VALUE | num_quo (VALUE x, VALUE y) |
| static VALUE | num_fdiv (VALUE x, VALUE y) |
| static VALUE | num_div (VALUE x, VALUE y) |
| static VALUE | num_modulo (VALUE x, VALUE y) |
| static VALUE | num_remainder (VALUE x, VALUE y) |
| static VALUE | num_divmod (VALUE x, VALUE y) |
| static VALUE | num_real_p (VALUE num) |
| static VALUE | num_int_p (VALUE num) |
| static VALUE | num_abs (VALUE num) |
| static VALUE | num_zero_p (VALUE num) |
| static VALUE | num_nonzero_p (VALUE num) |
| static VALUE | num_to_int (VALUE num) |
| VALUE | rb_float_new_in_heap (double d) |
| static VALUE | flo_to_s (VALUE flt) |
| static VALUE | flo_coerce (VALUE x, VALUE y) |
| static VALUE | flo_uminus (VALUE flt) |
| static VALUE | flo_plus (VALUE x, VALUE y) |
| static VALUE | flo_minus (VALUE x, VALUE y) |
| static VALUE | flo_mul (VALUE x, VALUE y) |
| static VALUE | flo_div (VALUE x, VALUE y) |
| static VALUE | flo_quo (VALUE x, VALUE y) |
| static void | flodivmod (double x, double y, double *divp, double *modp) |
| double | ruby_float_mod (double x, double y) |
| static VALUE | flo_mod (VALUE x, VALUE y) |
| static VALUE | dbl2ival (double d) |
| static VALUE | flo_divmod (VALUE x, VALUE y) |
| static VALUE | flo_pow (VALUE x, VALUE y) |
| static VALUE | num_eql (VALUE x, VALUE y) |
| static VALUE | num_cmp (VALUE x, VALUE y) |
| static VALUE | num_equal (VALUE x, VALUE y) |
| static VALUE | flo_eq (VALUE x, VALUE y) |
| static VALUE | flo_hash (VALUE num) |
| VALUE | rb_dbl_cmp (double a, double b) |
| static VALUE | flo_cmp (VALUE x, VALUE y) |
| static VALUE | flo_gt (VALUE x, VALUE y) |
| static VALUE | flo_ge (VALUE x, VALUE y) |
| static VALUE | flo_lt (VALUE x, VALUE y) |
| static VALUE | flo_le (VALUE x, VALUE y) |
| static VALUE | flo_eql (VALUE x, VALUE y) |
| static VALUE | flo_to_f (VALUE num) |
| static VALUE | flo_abs (VALUE flt) |
| static VALUE | flo_zero_p (VALUE num) |
| static VALUE | flo_is_nan_p (VALUE num) |
| static VALUE | flo_is_infinite_p (VALUE num) |
| static VALUE | flo_is_finite_p (VALUE num) |
| static VALUE | flo_floor (VALUE num) |
| static VALUE | flo_ceil (VALUE num) |
| static VALUE | int_round_0 (VALUE num, int ndigits) |
| static VALUE | flo_truncate (VALUE num) |
| static VALUE | flo_round (int argc, VALUE *argv, VALUE num) |
| static VALUE | num_floor (VALUE num) |
| static VALUE | num_ceil (VALUE num) |
| static VALUE | num_round (int argc, VALUE *argv, VALUE num) |
| static VALUE | num_truncate (VALUE num) |
| static double | ruby_float_step_size (double beg, double end, double unit, int excl) |
| int | ruby_float_step (VALUE from, VALUE to, VALUE step, int excl) |
| VALUE | num_interval_step_size (VALUE from, VALUE to, VALUE step, int excl) |
| static VALUE | num_step_size (VALUE from, VALUE args) |
| static VALUE | num_step (int argc, VALUE *argv, VALUE from) |
| SIGNED_VALUE | rb_num2long (VALUE val) |
| VALUE | rb_num2ulong (VALUE val) |
| long | rb_num2int (VALUE val) |
| long | rb_fix2int (VALUE val) |
| void | rb_out_of_short (SIGNED_VALUE num) |
| static void | check_short (SIGNED_VALUE num) |
| static void | check_ushort (VALUE num, int sign) |
| short | rb_num2short (VALUE val) |
| short | rb_fix2short (VALUE val) |
| unsigned short | rb_num2ushort (VALUE val) |
| unsigned short | rb_fix2ushort (VALUE val) |
| VALUE | rb_num2fix (VALUE val) |
| static VALUE | int_to_i (VALUE num) |
| static VALUE | int_int_p (VALUE num) |
| static VALUE | int_odd_p (VALUE num) |
| static VALUE | int_even_p (VALUE num) |
| static VALUE | fix_succ (VALUE num) |
| VALUE | rb_int_succ (VALUE num) |
| VALUE | rb_int_pred (VALUE num) |
| VALUE | rb_enc_uint_chr (unsigned int code, rb_encoding *enc) |
| static VALUE | int_chr (int argc, VALUE *argv, VALUE num) |
| static VALUE | int_ord (VALUE num) |
| VALUE | rb_fix2str (VALUE x, int base) |
| static VALUE | fix_to_s (int argc, VALUE *argv, VALUE x) |
| static VALUE | fix_plus (VALUE x, VALUE y) |
| static VALUE | fix_minus (VALUE x, VALUE y) |
| static void | fixdivmod (long x, long y, long *divp, long *modp) |
| static VALUE | fix_fdiv (VALUE x, VALUE y) |
| static VALUE | fix_divide (VALUE x, VALUE y, ID op) |
| static VALUE | fix_div (VALUE x, VALUE y) |
| static VALUE | fix_idiv (VALUE x, VALUE y) |
| static VALUE | fix_mod (VALUE x, VALUE y) |
| static VALUE | fix_divmod (VALUE x, VALUE y) |
| static VALUE | fix_pow (VALUE x, VALUE y) |
| static VALUE | fix_equal (VALUE x, VALUE y) |
| static VALUE | fix_cmp (VALUE x, VALUE y) |
| static VALUE | fix_gt (VALUE x, VALUE y) |
| static VALUE | fix_ge (VALUE x, VALUE y) |
| static VALUE | fix_lt (VALUE x, VALUE y) |
| static VALUE | fix_le (VALUE x, VALUE y) |
| static VALUE | fix_rev (VALUE num) |
| static int | bit_coerce (VALUE *x, VALUE *y, int err) |
| VALUE | rb_num_coerce_bit (VALUE x, VALUE y, ID func) |
| static VALUE | fix_and (VALUE x, VALUE y) |
| static VALUE | fix_or (VALUE x, VALUE y) |
| static VALUE | fix_xor (VALUE x, VALUE y) |
| static VALUE | fix_lshift (long, unsigned long) |
| static VALUE | fix_rshift (long, unsigned long) |
| static VALUE | rb_fix_lshift (VALUE x, VALUE y) |
| static VALUE | rb_fix_rshift (VALUE x, VALUE y) |
| static VALUE | fix_aref (VALUE fix, VALUE idx) |
| static VALUE | fix_to_f (VALUE num) |
| static VALUE | fix_abs (VALUE fix) |
| static VALUE | fix_size (VALUE fix) |
| static VALUE | int_upto_size (VALUE from, VALUE args) |
| static VALUE | int_upto (VALUE from, VALUE to) |
| static VALUE | int_downto_size (VALUE from, VALUE args) |
| static VALUE | int_downto (VALUE from, VALUE to) |
| static VALUE | int_dotimes_size (VALUE num) |
| static VALUE | int_dotimes (VALUE num) |
| static VALUE | int_round (int argc, VALUE *argv, VALUE num) |
| static VALUE | fix_zero_p (VALUE num) |
| static VALUE | fix_odd_p (VALUE num) |
| static VALUE | fix_even_p (VALUE num) |
| void | Init_Numeric (void) |
Variables | |
| union bytesequence4_or_float | rb_infinity = {{0x00, 0x00, 0x80, 0x7f}} |
| union bytesequence4_or_float | rb_nan = {{0x00, 0x00, 0xc0, 0x7f}} |
| static ID | id_coerce |
| static ID | id_to_i |
| static ID | id_eq |
| static ID | id_div |
| VALUE | rb_cNumeric |
| VALUE | rb_cFloat |
| VALUE | rb_cInteger |
| VALUE | rb_cFixnum |
| VALUE | rb_eZeroDivError |
| VALUE | rb_eFloatDomainError |
| #define DBL_DIG 15 |
Definition at line 67 of file numeric.c.
Referenced by BigDecimal_add(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_mult(), BigDecimal_new(), BigDecimal_power(), BigDecimal_sub(), BigDecimalCmp(), BigMath_s_exp(), BigMath_s_log(), flo_round(), flo_to_s(), GetVpValueWithPrec(), Init_Numeric(), rb_cstr_to_dbl(), rmpd_double_figures(), and ruby_strtod().
| #define DBL_EPSILON 2.2204460492503131e-16 |
Definition at line 73 of file numeric.c.
Referenced by Init_Numeric(), and ruby_float_step_size().
| #define DBL_MAX 1.7976931348623157e+308 |
Definition at line 52 of file numeric.c.
Referenced by Init_Numeric().
| #define DBL_MAX_10_EXP 308 |
Definition at line 64 of file numeric.c.
Referenced by BigDecimal_to_f(), Init_Numeric(), and ruby_strtod().
| #define DBL_MAX_EXP 1024 |
Definition at line 58 of file numeric.c.
Referenced by big2dbl(), Init_Numeric(), ruby_hdtoa(), and ruby_strtod().
| #define DBL_MIN 2.2250738585072014e-308 |
Definition at line 49 of file numeric.c.
Referenced by Init_Numeric().
| #define DBL_MIN_10_EXP (-307) |
Definition at line 61 of file numeric.c.
Referenced by BigDecimal_to_f(), and Init_Numeric().
| #define DBL_MIN_EXP (-1021) |
Definition at line 55 of file numeric.c.
Referenced by Init_Numeric().
| #define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS) |
| #define FIT_SQRT_LONG | ( | n | ) | (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX)) |
| #define FLT_RADIX 2 |
Definition at line 43 of file numeric.c.
Referenced by float_rationalize(), float_to_r(), Init_Numeric(), and ruby_strtod().
| #define FLT_ROUNDS 1 |
Definition at line 46 of file numeric.c.
Referenced by Init_Numeric().
| #define int_pred rb_int_pred |
Definition at line 2441 of file numeric.c.
Referenced by Init_Numeric().
| #define int_succ rb_int_succ |
Definition at line 2419 of file numeric.c.
Referenced by Init_Numeric().
| #define LONG_MAX_PLUS_ONE (2*(double)(LONG_MAX/2+1)) |
Definition at line 1964 of file numeric.c.
Referenced by rb_num2long().
| #define LONG_MIN_MINUS_ONE ((double)LONG_MIN-1) |
Definition at line 1963 of file numeric.c.
Referenced by rb_num2long(), and rb_num2ulong().
| #define method_basic_p | ( | klass | ) | rb_method_basic_definition_p(klass, mid) |
Definition at line 162 of file numeric.c.
Referenced by negative_int_p(), and positive_int_p().
| #define NUMERR_NEGATIVE 2 |
Referenced by rb_num_to_uint().
| #define NUMERR_TOOLARGE 3 |
Referenced by rb_num_to_uint().
| #define NUMERR_TYPE 1 |
Referenced by rb_num_to_uint().
| #define rb_intern | ( | str | ) | rb_intern_const(str) |
| #define SQRT_LONG_MAX ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2)) |
| #define ULONG_MAX_PLUS_ONE (2*(double)(ULONG_MAX/2+1)) |
Definition at line 1965 of file numeric.c.
Referenced by rb_num2ulong().
| #define VALUE_MSBMASK ((VALUE)1 << ((sizeof(VALUE) * CHAR_BIT) - 1)) |
Referenced by check_ushort().
| static int bit_coerce | ( | VALUE * | x, | |
| VALUE * | y, | |||
| int | err | |||
| ) | [static] |
Definition at line 3215 of file numeric.c.
References coerce_failed(), do_coerce(), FALSE, FIXNUM_P, RB_TYPE_P, T_BIGNUM, and TRUE.
Referenced by fix_and(), fix_or(), fix_xor(), and rb_num_coerce_bit().
| static void check_short | ( | SIGNED_VALUE | num | ) | [static] |
Definition at line 2131 of file numeric.c.
References rb_out_of_short(), and SIGNED_VALUE.
Referenced by rb_fix2short(), and rb_num2short().
| static void check_ushort | ( | VALUE | num, | |
| int | sign | |||
| ) | [static] |
Definition at line 2139 of file numeric.c.
References PRIdVALUE, PRIuVALUE, rb_eRangeError, rb_raise(), and VALUE_MSBMASK.
Referenced by rb_fix2ushort(), and rb_num2ushort().
| static VALUE coerce_body | ( | VALUE * | x | ) | [static] |
Definition at line 229 of file numeric.c.
References id_coerce, and rb_funcall().
Referenced by do_coerce().
| static void coerce_failed | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 236 of file numeric.c.
References BUILTIN_TYPE, PRIsVALUE, rb_eTypeError, rb_inspect(), rb_obj_class(), rb_raise(), SPECIAL_CONST_P, and T_FLOAT.
Referenced by bit_coerce(), and coerce_rescue().
| static VALUE coerce_rescue | ( | VALUE * | x | ) | [static] |
Definition at line 249 of file numeric.c.
References coerce_failed(), and Qnil.
Referenced by do_coerce().
| static VALUE dbl2ival | ( | double | d | ) | [static] |
Definition at line 959 of file numeric.c.
References FIXABLE, LONG2FIX, rb_dbl2big(), and round().
Referenced by fix_divmod(), flo_divmod(), and flo_round().
| static int do_coerce | ( | VALUE * | x, | |
| VALUE * | y, | |||
| int | err | |||
| ) | [static] |
Definition at line 256 of file numeric.c.
References coerce_body(), coerce_rescue(), FALSE, id_coerce, RARRAY_LEN, RARRAY_PTR, rb_eTypeError, rb_raise(), rb_rescue(), rb_respond_to(), RB_TYPE_P, T_ARRAY, and TRUE.
Referenced by bit_coerce(), num_uminus(), rb_num_coerce_bin(), rb_num_coerce_cmp(), and rb_num_coerce_relop().
| static VALUE fix_abs | ( | VALUE | fix | ) | [static] |
Definition at line 3447 of file numeric.c.
References FIX2LONG, and LONG2NUM.
Referenced by Init_Numeric().
| static VALUE fix_and | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3244 of file numeric.c.
References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, rb_big_and(), rb_funcall(), rb_intern, RB_TYPE_P, T_BIGNUM, and TRUE.
Referenced by Init_Numeric().
| static VALUE fix_aref | ( | VALUE | fix, | |
| VALUE | idx | |||
| ) | [static] |
Definition at line 3390 of file numeric.c.
References CHAR_BIT, FIX2LONG, FIXNUM_P, INT2FIX, rb_big_norm(), rb_to_int(), and RBIGNUM_SIGN.
Referenced by Init_Numeric().
| static VALUE fix_cmp | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3078 of file numeric.c.
References FIX2LONG, FIXNUM_P, INT2FIX, rb_big_cmp(), rb_int2big(), rb_integer_float_cmp(), rb_intern, rb_num_coerce_cmp(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_div | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
| static VALUE fix_divide | ( | VALUE | x, | |
| VALUE | y, | |||
| ID | op | |||
| ) | [static] |
Definition at line 2811 of file numeric.c.
References DBL2NUM, div, FIX2LONG, fixdivmod(), FIXNUM_P, LONG2NUM, rb_big_div(), rb_dbl2big(), rb_int2big(), rb_num_coerce_bin(), rb_num_zerodiv(), rb_rational_reciprocal(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, T_RATIONAL, and TYPE.
Referenced by fix_div(), and fix_idiv().
| static VALUE fix_divmod | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2910 of file numeric.c.
References dbl2ival(), DBL2NUM, div, FIX2LONG, fixdivmod(), FIXNUM_P, flodivmod(), LONG2NUM, mod, rb_assoc_new(), rb_big_divmod(), rb_int2big(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_equal | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3052 of file numeric.c.
References FIXNUM_P, num_equal(), Qfalse, Qtrue, rb_big_eq(), rb_integer_float_eq(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_even_p | ( | VALUE | num | ) | [static] |
Definition at line 3699 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE fix_fdiv | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2795 of file numeric.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, rb_big_fdiv(), rb_int2big(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_ge | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3129 of file numeric.c.
References FIX2INT, FIX2LONG, FIXNUM_P, INT2FIX, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_integer_float_cmp(), rb_intern, rb_num_coerce_relop(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_gt | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3104 of file numeric.c.
References FIX2INT, FIX2LONG, FIXNUM_P, INT2FIX, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_integer_float_cmp(), rb_num_coerce_relop(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_idiv | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2869 of file numeric.c.
References fix_divide(), and rb_intern.
Referenced by Init_Numeric().
| static VALUE fix_le | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3182 of file numeric.c.
References FIX2INT, FIX2LONG, FIXNUM_P, INT2FIX, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_integer_float_cmp(), rb_intern, rb_num_coerce_relop(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_lshift | ( | long | val, | |
| unsigned long | width | |||
| ) | [static] |
Definition at line 3330 of file numeric.c.
References CHAR_BIT, LONG2NUM, rb_big_lshift(), rb_int2big(), and ULONG2NUM.
Referenced by rb_fix_lshift(), and rb_fix_rshift().
| static VALUE fix_lt | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3157 of file numeric.c.
References FIX2INT, FIX2LONG, FIXNUM_P, INT2FIX, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_integer_float_cmp(), rb_num_coerce_relop(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_minus | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2675 of file numeric.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, LONG2NUM, rb_big_minus(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_mod | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2884 of file numeric.c.
References DBL2NUM, FIX2LONG, fixdivmod(), FIXNUM_P, LONG2NUM, mod, rb_big_modulo(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, ruby_float_mod(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_mul | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2713 of file numeric.c.
References DBL2NUM, FIT_SQRT_LONG, FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, MUL_OVERFLOW_FIXNUM_P, rb_big_mul(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_odd_p | ( | VALUE | num | ) | [static] |
Definition at line 3683 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE fix_or | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3267 of file numeric.c.
References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, rb_big_or(), rb_funcall(), rb_intern, RB_TYPE_P, T_BIGNUM, and TRUE.
Referenced by Init_Numeric().
| static VALUE fix_plus | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2642 of file numeric.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, LONG2NUM, rb_big_plus(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_pow | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 2986 of file numeric.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, INFINITY, INT2FIX, int_even_p(), int_pow(), negative_int_p(), rb_big_pow(), rb_complex_raw1, rb_funcall(), rb_int2big(), rb_intern, rb_num_coerce_bin(), rb_rational_raw1, RFLOAT_VALUE, round(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE fix_rev | ( | VALUE | num | ) | [static] |
| static VALUE fix_rshift | ( | long | val, | |
| unsigned long | i | |||
| ) | [static] |
Definition at line 3363 of file numeric.c.
References CHAR_BIT, INT2FIX, and LONG2FIX.
Referenced by rb_fix_lshift(), and rb_fix_rshift().
| static VALUE fix_size | ( | VALUE | fix | ) | [static] |
| static VALUE fix_succ | ( | VALUE | num | ) | [static] |
Definition at line 2392 of file numeric.c.
References FIX2LONG, and LONG2NUM.
Referenced by Init_Numeric().
| static VALUE fix_to_f | ( | VALUE | num | ) | [static] |
Definition at line 3425 of file numeric.c.
References DBL2NUM, and FIX2LONG.
Referenced by Init_Numeric().
| static VALUE fix_to_s | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | x | |||
| ) | [static] |
Definition at line 2617 of file numeric.c.
References NUM2INT, rb_fix2str(), and rb_scan_args().
Referenced by Init_Numeric().
| static VALUE fix_uminus | ( | VALUE | num | ) | [static] |
Definition at line 2567 of file numeric.c.
References FIX2LONG, and LONG2NUM.
Referenced by Init_Numeric().
| static VALUE fix_xor | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3290 of file numeric.c.
References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, rb_big_xor(), rb_funcall(), rb_intern, RB_TYPE_P, T_BIGNUM, and TRUE.
Referenced by Init_Numeric().
| static VALUE fix_zero_p | ( | VALUE | num | ) | [static] |
| static void fixdivmod | ( | long | x, | |
| long | y, | |||
| long * | divp, | |||
| long * | modp | |||
| ) | [static] |
Definition at line 2756 of file numeric.c.
References div, mod, and rb_num_zerodiv().
Referenced by fix_divide(), fix_divmod(), and fix_mod().
| static VALUE flo_abs | ( | VALUE | flt | ) | [static] |
Definition at line 1415 of file numeric.c.
References DBL2NUM, RFLOAT_VALUE, and val.
Referenced by Init_Numeric().
| static VALUE flo_ceil | ( | VALUE | num | ) | [static] |
Definition at line 1548 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by Init_Numeric(), and num_ceil().
| static VALUE flo_cmp | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1159 of file numeric.c.
References FIX2INT, FIXNUM_P, INT2FIX, isinf(), isnan, Qnil, Qundef, rb_check_funcall(), rb_cmpint(), rb_dbl_cmp(), rb_integer_float_cmp(), rb_intern, rb_num_coerce_cmp(), RFLOAT_VALUE, RTEST, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_coerce | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 754 of file numeric.c.
References rb_assoc_new(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE flo_div | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 850 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_divmod | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 979 of file numeric.c.
References dbl2ival(), DBL2NUM, div, FIX2LONG, flodivmod(), mod, rb_assoc_new(), rb_big2dbl(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_eq | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1091 of file numeric.c.
References isnan, num_equal(), Qfalse, Qtrue, rb_integer_float_eq(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_eql | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1375 of file numeric.c.
References isnan, Qfalse, Qtrue, RB_TYPE_P, RFLOAT_VALUE, and T_FLOAT.
Referenced by Init_Numeric().
| static VALUE flo_floor | ( | VALUE | num | ) | [static] |
Definition at line 1522 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by Init_Numeric(), and num_floor().
| static VALUE flo_ge | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1247 of file numeric.c.
References FIX2INT, FIXNUM_P, isnan, Qfalse, Qtrue, rb_integer_float_cmp(), rb_intern, rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_gt | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1205 of file numeric.c.
References FIX2INT, FIXNUM_P, isnan, Qfalse, Qtrue, rb_integer_float_cmp(), rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_hash | ( | VALUE | num | ) | [static] |
Definition at line 1123 of file numeric.c.
References hash(), LONG2FIX, rb_memhash(), and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static VALUE flo_is_finite_p | ( | VALUE | num | ) | [static] |
Definition at line 1494 of file numeric.c.
References isinf(), isnan, Qfalse, Qtrue, and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static VALUE flo_is_infinite_p | ( | VALUE | num | ) | [static] |
Definition at line 1472 of file numeric.c.
References INT2FIX, isinf(), Qnil, and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static VALUE flo_is_nan_p | ( | VALUE | num | ) | [static] |
Definition at line 1452 of file numeric.c.
References isnan, Qfalse, Qtrue, and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static VALUE flo_le | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1330 of file numeric.c.
References FIX2INT, FIXNUM_P, isnan, Qfalse, Qtrue, rb_integer_float_cmp(), rb_intern, rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_lt | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1288 of file numeric.c.
References FIX2INT, FIXNUM_P, isnan, Qfalse, Qtrue, rb_integer_float_cmp(), rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_minus | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 804 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_mod | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 938 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, ruby_float_mod(), T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_mul | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 827 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_plus | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 781 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_pow | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1014 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_complex_raw1, rb_funcall(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, round(), T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
| static VALUE flo_quo | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
| static VALUE flo_round | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | num | |||
| ) | [static] |
Definition at line 1633 of file numeric.c.
References dbl2ival(), DBL2NUM, DBL_DIG, f, flo_truncate(), int_round_0(), isinf(), isnan, NUM2INT, rb_scan_args(), RFLOAT_VALUE, and round().
Referenced by Init_Numeric(), and num_round().
| static VALUE flo_to_f | ( | VALUE | num | ) | [static] |
Definition at line 1397 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE flo_to_s | ( | VALUE | flt | ) | [static] |
Definition at line 673 of file numeric.c.
References buf, CHAR_BIT, DBL_DIG, DBL_MANT_DIG, isinf(), isnan, memmove(), rb_str_cat(), rb_str_catf(), rb_str_resize(), rb_usascii_str_new(), rb_usascii_str_new2, RFLOAT_VALUE, RSTRING_LEN, RSTRING_PTR, ruby_dtoa(), and xfree.
Referenced by Init_Numeric().
| static VALUE flo_truncate | ( | VALUE | num | ) | [static] |
Definition at line 1691 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by flo_round(), Init_Numeric(), and num_truncate().
| static VALUE flo_uminus | ( | VALUE | flt | ) | [static] |
Definition at line 767 of file numeric.c.
References DBL2NUM, and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static VALUE flo_zero_p | ( | VALUE | num | ) | [static] |
Definition at line 1430 of file numeric.c.
References Qfalse, Qtrue, and RFLOAT_VALUE.
Referenced by Init_Numeric().
| static void flodivmod | ( | double | x, | |
| double | y, | |||
| double * | divp, | |||
| double * | modp | |||
| ) | [static] |
Definition at line 883 of file numeric.c.
References div, isinf(), isnan, mod, and rb_num_zerodiv().
Referenced by fix_divmod(), flo_divmod(), and ruby_float_mod().
| void Init_Numeric | ( | void | ) |
Definition at line 3740 of file numeric.c.
References CLASS_OF, DBL2NUM, DBL_DIG, DBL_EPSILON, DBL_MANT_DIG, DBL_MAX, DBL_MAX_10_EXP, DBL_MAX_EXP, DBL_MIN, DBL_MIN_10_EXP, DBL_MIN_EXP, fix_abs(), fix_and(), fix_aref(), fix_cmp(), fix_div(), fix_divmod(), fix_equal(), fix_even_p(), fix_fdiv(), fix_ge(), fix_gt(), fix_idiv(), fix_le(), fix_lt(), fix_minus(), fix_mod(), fix_mul(), fix_odd_p(), fix_or(), fix_plus(), fix_pow(), fix_rev(), fix_size(), fix_succ(), fix_to_f(), fix_to_s(), fix_uminus(), fix_xor(), fix_zero_p(), flo_abs(), flo_ceil(), flo_cmp(), flo_coerce(), flo_div(), flo_divmod(), flo_eq(), flo_eql(), flo_floor(), flo_ge(), flo_gt(), flo_hash(), flo_is_finite_p(), flo_is_infinite_p(), flo_is_nan_p(), flo_le(), flo_lt(), flo_minus(), flo_mod(), flo_mul(), flo_plus(), flo_pow(), flo_quo(), flo_round(), flo_to_f(), flo_to_s(), flo_truncate(), flo_uminus(), flo_zero_p(), FLT_RADIX, FLT_ROUNDS, id_coerce, id_div, id_eq, id_to_i, INFINITY, INT2FIX, int_chr(), int_dotimes(), int_downto(), int_even_p(), int_int_p(), int_odd_p(), int_ord(), int_pred, int_round(), int_succ, int_to_i(), int_upto(), NAN, num_abs(), num_ceil(), num_cmp(), num_coerce(), num_div(), num_divmod(), num_eql(), num_fdiv(), num_floor(), num_imaginary(), num_init_copy(), num_int_p(), num_modulo(), num_nonzero_p(), num_quo(), num_real_p(), num_remainder(), num_round(), num_sadded(), num_step(), num_to_int(), num_truncate(), num_uminus(), num_uplus(), num_zero_p(), rb_cFixnum, rb_cFloat, rb_cInteger, rb_cNumeric, rb_cObject, rb_define_alias(), rb_define_class(), rb_define_const(), rb_define_method(), rb_eFloatDomainError, rb_eRangeError, rb_eStandardError, rb_eZeroDivError, rb_fix_lshift(), rb_fix_rshift(), rb_include_module(), rb_intern, rb_mComparable, rb_undef_alloc_func(), and rb_undef_method().
| static VALUE int_chr | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | num | |||
| ) | [static] |
Definition at line 2478 of file numeric.c.
References FIX2LONG, FIXNUM_P, rb_ascii8bit_encoding(), rb_check_arity, rb_default_internal_encoding(), rb_enc_uint_chr(), rb_eRangeError, rb_num_to_uint(), rb_raise(), rb_str_new(), rb_to_encoding(), and rb_usascii_str_new().
Referenced by Init_Numeric().
| static VALUE int_dotimes | ( | VALUE | num | ) | [static] |
Definition at line 3603 of file numeric.c.
References FIX2LONG, FIXNUM_P, INT2FIX, int_dotimes_size(), LONG2FIX, rb_funcall(), rb_yield(), RETURN_SIZED_ENUMERATOR, and RTEST.
Referenced by Init_Numeric().
| static VALUE int_dotimes_size | ( | VALUE | num | ) | [static] |
Definition at line 3572 of file numeric.c.
References FIXNUM_P, INT2FIX, NUM2LONG, rb_funcall(), and RTEST.
Referenced by int_dotimes().
| static VALUE int_downto | ( | VALUE | from, | |
| VALUE | to | |||
| ) | [static] |
Definition at line 3548 of file numeric.c.
References FIX2LONG, FIXNUM_P, INT2FIX, int_downto_size(), LONG2FIX, NIL_P, rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_SIZED_ENUMERATOR.
Referenced by Init_Numeric().
| static VALUE int_downto_size | ( | VALUE | from, | |
| VALUE | args | |||
| ) | [static] |
Definition at line 3524 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), and RARRAY_PTR.
Referenced by int_downto().
| static VALUE int_even_p | ( | VALUE | num | ) | [static] |
Definition at line 2372 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_funcall().
Referenced by fix_pow(), and Init_Numeric().
| static VALUE int_int_p | ( | VALUE | num | ) | [static] |
| static VALUE int_odd_p | ( | VALUE | num | ) | [static] |
Definition at line 2356 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_funcall().
Referenced by Init_Numeric().
| static VALUE int_ord | ( | VALUE | num | ) | [static] |
Definition at line 2535 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE int_pow | ( | long | x, | |
| unsigned long | y | |||
| ) | [static] |
Definition at line 2939 of file numeric.c.
References FIT_SQRT_LONG, LONG2NUM, MUL_OVERFLOW_FIXNUM_P, neg, rb_big_mul(), rb_big_pow(), and rb_int2big().
Referenced by fix_pow(), and int_round_0().
| static VALUE int_round | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | num | |||
| ) | [static] |
Definition at line 3641 of file numeric.c.
References int_round_0(), NUM2INT, rb_Float(), and rb_scan_args().
Referenced by Init_Numeric().
| static VALUE int_round_0 | ( | VALUE | num, | |
| int | ndigits | |||
| ) | [static] |
Definition at line 1564 of file numeric.c.
References f, FIX2LONG, FIXNUM_P, INT2FIX, int_pow(), LONG2NUM, neg, negative_int_p(), rb_funcall(), rb_intern, RB_TYPE_P, RTEST, SIGNED_VALUE, and T_FLOAT.
Referenced by flo_round(), and int_round().
| static VALUE int_to_i | ( | VALUE | num | ) | [static] |
Definition at line 2330 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE int_upto | ( | VALUE | from, | |
| VALUE | to | |||
| ) | [static] |
Definition at line 3500 of file numeric.c.
References FIX2LONG, FIXNUM_P, INT2FIX, int_upto_size(), LONG2FIX, NIL_P, rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_SIZED_ENUMERATOR.
Referenced by Init_Numeric().
| static VALUE int_upto_size | ( | VALUE | from, | |
| VALUE | args | |||
| ) | [static] |
Definition at line 3477 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), and RARRAY_PTR.
Referenced by int_upto().
| static int negative_int_p | ( | VALUE | num | ) | [inline, static] |
Definition at line 181 of file numeric.c.
References FIXNUM_P, INT2FIX, method_basic_p, rb_cBignum, rb_cFixnum, rb_funcall(), RB_TYPE_P, RBIGNUM_NEGATIVE_P, RTEST, SIGNED_VALUE, and T_BIGNUM.
Referenced by fix_pow(), int_round_0(), num_abs(), num_remainder(), rb_fix2ushort(), rb_num2ushort(), and rb_num_negative_p().
| NORETURN | ( | static void | coerce_failedVALUE x, VALUE y | ) |
| static VALUE num_abs | ( | VALUE | num | ) | [static] |
Definition at line 571 of file numeric.c.
References negative_int_p(), rb_funcall(), and rb_intern.
Referenced by Init_Numeric().
| static VALUE num_ceil | ( | VALUE | num | ) | [static] |
Definition at line 1741 of file numeric.c.
References flo_ceil(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE num_cmp | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1063 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE num_coerce | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 219 of file numeric.c.
References CLASS_OF, rb_assoc_new(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE num_div | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 430 of file numeric.c.
References INT2FIX, rb_equal(), rb_funcall(), rb_intern, and rb_num_zerodiv().
Referenced by Init_Numeric(), and num_divmod().
| static VALUE num_divmod | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 523 of file numeric.c.
References num_div(), num_modulo(), and rb_assoc_new().
Referenced by Init_Numeric().
| static VALUE num_eql | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1047 of file numeric.c.
References Qfalse, rb_equal(), and TYPE.
Referenced by Init_Numeric().
| static VALUE num_equal | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 1070 of file numeric.c.
References id_eq, Qtrue, and rb_funcall().
Referenced by fix_equal(), and flo_eq().
| static VALUE num_fdiv | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 409 of file numeric.c.
References rb_Float(), and rb_funcall().
Referenced by Init_Numeric().
| static VALUE num_floor | ( | VALUE | num | ) | [static] |
Definition at line 1719 of file numeric.c.
References flo_floor(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE num_imaginary | ( | VALUE | num | ) | [static] |
Definition at line 363 of file numeric.c.
References INT2FIX, and rb_complex_new().
Referenced by Init_Numeric().
| static VALUE num_init_copy | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 333 of file numeric.c.
References PRIsVALUE, rb_eTypeError, rb_obj_class(), rb_raise(), and UNREACHABLE.
Referenced by Init_Numeric().
| static VALUE num_int_p | ( | VALUE | num | ) | [static] |
| VALUE num_interval_step_size | ( | VALUE | from, | |
| VALUE | to, | |||
| VALUE | step, | |||
| int | excl | |||
| ) |
Definition at line 1829 of file numeric.c.
References cmp, DBL2NUM, diff(), FIX2LONG, FIXNUM_P, id_div, INT2FIX, isinf(), LONG2FIX, NUM2DBL, POSFIXABLE, rb_dbl2big(), rb_funcall(), rb_num_zerodiv(), RB_TYPE_P, result, RTEST, ruby_float_step_size(), T_FLOAT, and ULONG2NUM.
Referenced by int_downto_size(), int_upto_size(), num_step_size(), range_size(), and range_step_size().
| static VALUE num_modulo | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 450 of file numeric.c.
References rb_funcall(), and rb_intern.
Referenced by Init_Numeric(), and num_divmod().
| static VALUE num_nonzero_p | ( | VALUE | num | ) | [static] |
Definition at line 610 of file numeric.c.
References Qnil, rb_funcall(), rb_intern, and RTEST.
Referenced by Init_Numeric().
| static VALUE num_quo | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 395 of file numeric.c.
References rb_funcall(), and rb_rational_raw1.
Referenced by Init_Numeric().
| static VALUE num_real_p | ( | VALUE | num | ) | [static] |
| static VALUE num_remainder | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 467 of file numeric.c.
References INT2FIX, negative_int_p(), positive_int_p(), rb_equal(), and rb_funcall().
Referenced by Init_Numeric().
| static VALUE num_round | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | num | |||
| ) | [static] |
Definition at line 1757 of file numeric.c.
References flo_round(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE num_sadded | ( | VALUE | x, | |
| VALUE | name | |||
| ) | [static] |
Definition at line 317 of file numeric.c.
References PRIsVALUE, rb_eTypeError, rb_id2str(), rb_obj_class(), rb_raise(), rb_remove_method_id(), rb_singleton_class(), rb_to_id(), and UNREACHABLE.
Referenced by Init_Numeric().
| static VALUE num_step | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | from | |||
| ) | [static] |
Definition at line 1906 of file numeric.c.
References cmp, diff(), FALSE, FIX2LONG, FIXNUM_P, INT2FIX, LONG2FIX, num_step_size(), positive_int_p(), rb_check_arity, rb_eArgError, rb_equal(), rb_funcall(), rb_raise(), rb_yield(), RETURN_SIZED_ENUMERATOR, RTEST, and ruby_float_step().
Referenced by Init_Numeric().
| static VALUE num_step_size | ( | VALUE | from, | |
| VALUE | args | |||
| ) | [static] |
Definition at line 1869 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), RARRAY_LEN, and RARRAY_PTR.
Referenced by num_step().
| static VALUE num_to_int | ( | VALUE | num | ) | [static] |
Definition at line 630 of file numeric.c.
References id_to_i, and rb_funcall().
Referenced by Init_Numeric().
| static VALUE num_truncate | ( | VALUE | num | ) | [static] |
Definition at line 1772 of file numeric.c.
References flo_truncate(), and rb_Float().
Referenced by Init_Numeric().
| static VALUE num_uminus | ( | VALUE | num | ) | [static] |
Definition at line 377 of file numeric.c.
References do_coerce(), INT2FIX, rb_funcall(), TRUE, and zero().
Referenced by Init_Numeric().
| static VALUE num_uplus | ( | VALUE | num | ) | [static] |
Definition at line 349 of file numeric.c.
Referenced by Init_Numeric().
| static VALUE num_zero_p | ( | VALUE | num | ) | [static] |
Definition at line 588 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_equal().
Referenced by Init_Numeric().
| static int positive_int_p | ( | VALUE | num | ) | [inline, static] |
Definition at line 165 of file numeric.c.
References FIXNUM_P, INT2FIX, method_basic_p, rb_cBignum, rb_cFixnum, rb_funcall(), RB_TYPE_P, RBIGNUM_POSITIVE_P, RTEST, SIGNED_VALUE, and T_BIGNUM.
Referenced by num_remainder(), and num_step().
| VALUE rb_dbl_cmp | ( | double | a, | |
| double | b | |||
| ) |
| VALUE rb_enc_uint_chr | ( | unsigned int | code, | |
| rb_encoding * | enc | |||
| ) |
Definition at line 2444 of file numeric.c.
References ONIGERR_INVALID_CODE_POINT_VALUE, ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, rb_enc_codelen(), rb_enc_mbcput, rb_enc_name, rb_enc_precise_mbclen(), rb_enc_str_new(), rb_eRangeError, rb_raise(), RSTRING_END, and RSTRING_PTR.
Referenced by int_chr(), and rb_io_ungetc().
| short rb_fix2short | ( | VALUE | val | ) |
Definition at line 2166 of file numeric.c.
References check_short(), FIX2LONG, FIXNUM_P, and rb_num2long().
| VALUE rb_fix2str | ( | VALUE | x, | |
| int | base | |||
| ) |
Definition at line 2573 of file numeric.c.
References CHAR_BIT, FIX2LONG, neg, rb_eArgError, rb_raise(), rb_usascii_str_new2, ruby_digitmap, and SIZEOF_VALUE.
Referenced by call_original_exit(), fix_to_s(), ole_typedesc2val(), and rb_big2str0().
| unsigned short rb_fix2ushort | ( | VALUE | val | ) |
Definition at line 2184 of file numeric.c.
References check_ushort(), FIX2ULONG, FIXNUM_P, negative_int_p(), and rb_num2ushort().
| static VALUE rb_fix_lshift | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3316 of file numeric.c.
References FIX2LONG, fix_lshift(), fix_rshift(), FIXNUM_P, NUM2LONG, rb_big_lshift(), and rb_int2big().
Referenced by Init_Numeric().
| static VALUE rb_fix_rshift | ( | VALUE | x, | |
| VALUE | y | |||
| ) | [static] |
Definition at line 3348 of file numeric.c.
References FIX2LONG, fix_lshift(), fix_rshift(), FIXNUM_P, rb_big_rshift(), and rb_int2big().
Referenced by Init_Numeric().
| VALUE rb_float_new_in_heap | ( | double | d | ) |
| VALUE rb_int_pred | ( | VALUE | num | ) |
| VALUE rb_int_succ | ( | VALUE | num | ) |
Definition at line 2410 of file numeric.c.
References FIX2LONG, FIXNUM_P, INT2FIX, LONG2NUM, and rb_funcall().
Referenced by enumerator_with_index_i().
| VALUE rb_num2fix | ( | VALUE | val | ) |
Definition at line 2198 of file numeric.c.
References FIXABLE, FIXNUM_P, LONG2FIX, PRIdVALUE, rb_eRangeError, rb_num2long(), rb_raise(), and SIGNED_VALUE.
| long rb_num2int | ( | VALUE | val | ) |
Definition at line 2111 of file numeric.c.
References rb_num2long().
| SIGNED_VALUE rb_num2long | ( | VALUE | val | ) |
Definition at line 1968 of file numeric.c.
References buf, FIX2LONG, FIXNUM_P, LONG_MAX_PLUS_ONE, LONG_MIN_MINUS_ONE, NIL_P, rb_big2long(), rb_eRangeError, rb_eTypeError, rb_raise(), rb_to_int(), RFLOAT_VALUE, SIGNED_VALUE, snprintf, strchr(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by rb_fix2short(), rb_num2fix(), rb_num2int(), and rb_num2short().
| short rb_num2short | ( | VALUE | val | ) |
Definition at line 2157 of file numeric.c.
References check_short(), and rb_num2long().
| VALUE rb_num2ulong | ( | VALUE | val | ) |
Definition at line 2002 of file numeric.c.
References buf, FIX2LONG, FIXNUM_P, LONG_MIN_MINUS_ONE, NIL_P, rb_big2ulong(), rb_eRangeError, rb_eTypeError, rb_raise(), rb_to_int(), RFLOAT_VALUE, snprintf, strchr(), T_BIGNUM, T_FLOAT, TYPE, and ULONG_MAX_PLUS_ONE.
Referenced by rb_num2ushort().
| unsigned short rb_num2ushort | ( | VALUE | val | ) |
Definition at line 2175 of file numeric.c.
References check_ushort(), negative_int_p(), and rb_num2ulong().
Referenced by rb_fix2ushort().
| VALUE rb_num_coerce_bin | ( | VALUE | x, | |
| VALUE | y, | |||
| ID | func | |||
| ) |
Definition at line 284 of file numeric.c.
References do_coerce(), rb_funcall(), and TRUE.
Referenced by f_addsub(), f_divide(), fix_divide(), fix_divmod(), fix_fdiv(), fix_minus(), fix_mod(), fix_mul(), fix_plus(), fix_pow(), flo_div(), flo_divmod(), flo_minus(), flo_mod(), flo_mul(), flo_plus(), flo_pow(), nucomp_expt(), nucomp_mul(), nurat_add(), nurat_div(), nurat_expt(), nurat_mul(), nurat_sub(), rb_big_divide(), rb_big_divmod(), rb_big_fdiv(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_plus(), rb_big_pow(), and rb_big_remainder().
| VALUE rb_num_coerce_bit | ( | VALUE | x, | |
| VALUE | y, | |||
| ID | func | |||
| ) |
Definition at line 3230 of file numeric.c.
References bit_coerce(), rb_funcall(), and TRUE.
Referenced by rb_big_and(), rb_big_or(), and rb_big_xor().
| VALUE rb_num_coerce_cmp | ( | VALUE | x, | |
| VALUE | y, | |||
| ID | func | |||
| ) |
Definition at line 291 of file numeric.c.
References do_coerce(), FALSE, Qnil, and rb_funcall().
Referenced by BigDecimalCmp(), cmp_gen(), equal_gen(), fix_cmp(), flo_cmp(), nurat_cmp(), and rb_big_cmp().
| VALUE rb_num_coerce_relop | ( | VALUE | x, | |
| VALUE | y, | |||
| ID | func | |||
| ) |
Definition at line 299 of file numeric.c.
References do_coerce(), FALSE, NIL_P, Qnil, rb_cmperr(), and rb_funcall().
Referenced by big_op(), BigDecimalCmp(), fix_ge(), fix_gt(), fix_le(), fix_lt(), flo_ge(), flo_gt(), flo_le(), and flo_lt().
| int rb_num_negative_p | ( | VALUE | num | ) |
Definition at line 197 of file numeric.c.
References negative_int_p().
Referenced by rb_random_ulong_limited().
| int rb_num_to_uint | ( | VALUE | val, | |
| unsigned int * | ret | |||
| ) |
Definition at line 130 of file numeric.c.
References DIGSPERLONG, FIX2LONG, FIXNUM_P, NUMERR_NEGATIVE, NUMERR_TOOLARGE, NUMERR_TYPE, rb_big2ulong(), RBIGNUM_LEN, RBIGNUM_NEGATIVE_P, T_BIGNUM, and TYPE.
Referenced by int_chr(), and rb_str_concat().
| void rb_num_zerodiv | ( | void | ) |
Definition at line 123 of file numeric.c.
References rb_eZeroDivError, and rb_raise().
Referenced by bigdivrem(), fix_divide(), fixdivmod(), flodivmod(), num_div(), num_interval_step_size(), quo(), rb_big_divide(), wdivmod(), and wquo().
| void rb_out_of_short | ( | SIGNED_VALUE | num | ) |
Definition at line 2124 of file numeric.c.
References PRIdVALUE, rb_eRangeError, and rb_raise().
Referenced by check_short().
| double round | ( | double | x | ) |
Definition at line 92 of file numeric.c.
References f.
Referenced by BigDecimal_power(), d_lite_plus(), dbl2ival(), fix_pow(), flo_pow(), flo_round(), offset_to_sec(), rb_big_pow(), and wholenum_p().
| double ruby_float_mod | ( | double | x, | |
| double | y | |||
| ) |
| int ruby_float_step | ( | VALUE | from, | |
| VALUE | to, | |||
| VALUE | step, | |||
| int | excl | |||
| ) |
Definition at line 1803 of file numeric.c.
References DBL2NUM, FALSE, isinf(), NUM2DBL, RB_TYPE_P, rb_yield(), ruby_float_step_size(), T_FLOAT, and TRUE.
Referenced by num_step(), and range_step().
| static double ruby_float_step_size | ( | double | beg, | |
| double | end, | |||
| double | unit, | |||
| int | excl | |||
| ) | [static] |
Definition at line 1778 of file numeric.c.
References DBL_EPSILON, err, and isinf().
Referenced by num_interval_step_size(), and ruby_float_step().
ID id_coerce [static] |
Definition at line 112 of file numeric.c.
Referenced by coerce_body(), do_coerce(), and Init_Numeric().
ID id_div [static] |
Definition at line 112 of file numeric.c.
Referenced by Init_Numeric(), and num_interval_step_size().
ID id_eq [static] |
Definition at line 112 of file numeric.c.
Referenced by Init_Numeric(), and num_equal().
ID id_to_i [static] |
Definition at line 112 of file numeric.c.
Referenced by Init_Numeric(), and num_to_int().
| VALUE rb_cFixnum |
Definition at line 117 of file numeric.c.
Referenced by generate_json(), Init_Numeric(), k_fixnum_p(), negative_int_p(), positive_int_p(), and vm_redefinition_check_flag().
| VALUE rb_cFloat |
Definition at line 115 of file numeric.c.
Referenced by generate_json(), Init_Complex(), Init_Numeric(), Init_Rational(), k_float_p(), opt_eq_func(), rb_float_new_in_heap(), and vm_redefinition_check_flag().
| VALUE rb_cInteger |
Definition at line 116 of file numeric.c.
Referenced by host_str(), Init_Bignum(), Init_Numeric(), Init_Rational(), k_integer_p(), range_max(), rb_check_to_integer(), and rb_to_integer().
| VALUE rb_cNumeric |
Definition at line 114 of file numeric.c.
Referenced by case_when_optimizable_literal(), Init_bigdecimal(), Init_Complex(), Init_Numeric(), Init_Rational(), k_numeric_p(), range_include(), range_max(), range_size(), range_step(), range_step_size(), rb_ary_bsearch(), rb_check_to_float(), and rb_to_float().
| VALUE rb_eFloatDomainError |
Definition at line 120 of file numeric.c.
Referenced by BigDecimal_to_i(), dbl2big(), Init_Numeric(), rb_cstr_to_rat(), string_to_r(), string_to_r_strict(), and VpException().
| VALUE rb_eZeroDivError |
Definition at line 119 of file numeric.c.
Referenced by BigDecimal_DoDivmod(), Init_Numeric(), and rb_num_zerodiv().
| union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}} |
1.6.1