36 #define DBL_MIN 2.2250738585072014e-308 39 #define DBL_MAX 1.7976931348623157e+308 42 #define DBL_MIN_EXP (-1021) 45 #define DBL_MAX_EXP 1024 47 #ifndef DBL_MIN_10_EXP 48 #define DBL_MIN_10_EXP (-307) 50 #ifndef DBL_MAX_10_EXP 51 #define DBL_MAX_10_EXP 308 57 #define DBL_MANT_DIG 53 60 #define DBL_EPSILON 2.2204460492503131e-16 64 #elif !defined(WORDS_BIGENDIAN) 71 #elif !defined(WORDS_BIGENDIAN) 85 x = f + (x - f >= 0.5);
89 x = f - (f - x >= 0.5);
101 if (s == 1.0)
return f;
103 if ((
double)((f + 0.5) / s) <= x) f += 1;
107 if ((
double)((f - 0.5) / s) >= x) f -= 1;
116 double f, xs = x * s;
120 if ((
double)((f - 0.5) / s) >= x) f -= 1;
124 if ((
double)((f + 0.5) / s) <= x) f += 1;
133 double f, d, xs = x * s;
140 else if (d == 0.5 || ((
double)((f + 0.5) / s) <= x))
151 else if (d == 0.5 || ((
double)((f - 0.5) / s) >= x))
175 #define id_to_i idTo_i 182 #ifndef RUBY_INTEGER_UNIFICATION 200 static ID round_kwds[1];
206 if (!round_kwds[0]) {
209 if (!
rb_get_kwargs(opts, round_kwds, 0, 1, &rounding))
goto noopt;
213 else if (
NIL_P(rounding)) {
218 if (
NIL_P(str))
goto invalid;
244 #define NUMERR_TYPE 1 245 #define NUMERR_NEGATIVE 2 246 #define NUMERR_TOOLARGE 3 249 #if SIZEOF_INT < SIZEOF_LONG 253 *ret = (
unsigned int)v;
259 #if SIZEOF_INT < SIZEOF_LONG 272 #define method_basic_p(klass) rb_method_basic_definition_p(klass, mid) 357 else if (name[0] && name[1] ==
'@' && !name[2]) {
404 args[0] = (
VALUE)func;
477 a[0] = *x; a[1] = *y;
488 rb_warn(
"Numerical comparison operators will no more rescue exceptions of #coerce");
489 rb_warn(
"in the next release. Return nil in #coerce if the coercion is impossible.");
496 else if (!
NIL_P(ary)) {
497 rb_warn(
"Bad return value for #coerce, called by numerical comparison operators.");
498 rb_warn(
"#coerce must return [x, y]. The next release will raise an error for this.");
526 VALUE c, x0 = x, y0 = y;
945 flt->float_value = d;
963 enum {float_dig = DBL_DIG+1};
968 int sign, decpt, digs;
971 static const char minf[] =
"-Infinity";
972 const int pos = (value > 0);
975 else if (
isnan(value))
978 p =
ruby_dtoa(value, 0, 0, &decpt, &sign, &e);
980 if ((digs = (
int)(e - p)) >= (
int)
sizeof(
buf)) digs = (int)
sizeof(
buf) - 1;
989 else if (decpt <= DBL_DIG) {
996 memset(ptr,
'0', decpt - digs);
1005 else if (decpt > -4) {
1011 memset(ptr += len,
'0', -decpt);
1184 if (modp) *modp = y;
1185 if (divp) *divp = y;
1204 div = (x -
mod) / y;
1205 if (modp && divp) div =
round(div);
1211 if (modp) *modp =
mod;
1212 if (divp) *divp =
div;
1283 volatile VALUE a, b;
1328 if (dx < 0 && dy !=
round(dy))
1374 if (x == y)
return INT2FIX(0);
1382 if (x == y)
return Qtrue;
1405 volatile double a, b;
1412 #if defined(_MSC_VER) && _MSC_VER < 1300 1420 #if defined(_MSC_VER) && _MSC_VER < 1300 1451 if (a == b)
return INT2FIX(0);
1453 if (a < b)
return INT2FIX(-1);
1491 j = (a > 0.0) ? (j > 0 ? 0 : +1) : (j < 0 ? 0 : -1);
1494 if (a > 0.0)
return INT2FIX(1);
1526 #if defined(_MSC_VER) && _MSC_VER < 1300 1533 #if defined(_MSC_VER) && _MSC_VER < 1300 1563 #if defined(_MSC_VER) && _MSC_VER < 1300 1570 #if defined(_MSC_VER) && _MSC_VER < 1300 1600 #if defined(_MSC_VER) && _MSC_VER < 1300 1607 #if defined(_MSC_VER) && _MSC_VER < 1300 1637 #if defined(_MSC_VER) && _MSC_VER < 1300 1644 #if defined(_MSC_VER) && _MSC_VER < 1300 1669 #if defined(_MSC_VER) && _MSC_VER < 1300 1770 return INT2FIX( value < 0 ? -1 : 1 );
1790 #ifdef HAVE_ISFINITE 1955 if (number == 0.0) {
1960 frexp(number, &binexp);
1964 f = pow(10, ndigits);
1965 f = floor(number * f) /
f;
2015 if (number == 0.0) {
2020 frexp(number, &binexp);
2024 f = pow(10, ndigits);
2025 f = ceil(number * f) /
f;
2042 bytes =
sizeof(long);
2050 return (-0.415241 * ndigits - 0.125 > bytes);
2057 if ((z * y - x) * 2 == y) {
2066 return (x + y / 2) / y * y;
2072 return (x + y / 2 - 1) / y * y;
2140 if (neg) x = -x + y - 1;
2247 double number,
f, x;
2257 if (number == 0.0) {
2269 frexp(number, &binexp);
2272 f = pow(10, ndigits);
2301 if (ndigits >= float_dig - (binexp > 0 ? binexp / 4 : binexp / 3 - 1)) {
2310 if (ndigits < - (binexp > 0 ? binexp / 3 + 1 : binexp / 4)) {
2332 if (f > 0.0) f = floor(f);
2333 if (f < 0.0) f = ceil(f);
2469 double n = (end - beg)/unit;
2470 double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon;
2473 return unit > 0 ? beg <= end : beg >= end;
2478 if (err>0.5) err=0.5;
2507 else if (unit == 0) {
2513 for (i=0; i<n; i++) {
2514 double d = i*unit+beg;
2515 if (unit >= 0 ? end < d : d < end) d = end;
2559 case -1: cmp =
'<';
break;
2604 argc =
rb_scan_args(argc, argv,
"02:", to, step, &hash);
2611 if (values[0] !=
Qundef) {
2615 if (values[1] !=
Qundef) {
2622 if (argc > 1 &&
NIL_P(*step)) {
2734 for (; i >= end; i +=
diff)
2738 for (; i <= end; i +=
diff)
2751 ID cmp = desc ?
'<' :
'>';
2763 char *
const buf = *pbuf;
2767 if ((s =
strchr(buf,
' ')) != 0) *s =
'\0';
2771 #define FLOAT_OUT_OF_RANGE(val, type) do { \ 2773 rb_raise(rb_eRangeError, "float %s out of range of "type, \ 2774 out_of_range_float(&buf, (val))); \ 2777 #define LONG_MIN_MINUS_ONE ((double)LONG_MIN-1) 2778 #define LONG_MAX_PLUS_ONE (2*(double)(LONG_MAX/2+1)) 2779 #define ULONG_MAX_PLUS_ONE (2*(double)(ULONG_MAX/2+1)) 2780 #define LONG_MIN_MINUS_ONE_IS_LESS_THAN(n) \ 2781 (LONG_MIN_MINUS_ONE == (double)LONG_MIN ? \ 2783 LONG_MIN_MINUS_ONE < (n)) 2813 static unsigned long 2825 return (
unsigned long)l;
2831 *wrap_p = d <= -1.0;
2833 return (
unsigned long)d;
2834 return (
unsigned long)(long)d;
2860 #if SIZEOF_INT < SIZEOF_LONG 2865 num, num < 0 ?
"small" :
"big");
2871 if ((
long)(
int)num != num) {
2877 check_uint(
unsigned long num,
int sign)
2881 if (num < (
unsigned long)INT_MIN)
2910 rb_num2uint(
VALUE val)
2915 check_uint(num, wrap);
2920 rb_fix2uint(
VALUE val)
2925 return rb_num2uint(val);
2951 num, num < 0 ?
"small" :
"big");
2957 if ((
long)(
short)num != num) {
2967 if (num < (
unsigned long)SHRT_MIN)
2972 if (USHRT_MAX < num)
3034 #define LLONG_MIN_MINUS_ONE ((double)LLONG_MIN-1) 3035 #define LLONG_MAX_PLUS_ONE (2*(double)(LLONG_MAX/2+1)) 3036 #define ULLONG_MAX_PLUS_ONE (2*(double)(ULLONG_MAX/2+1)) 3038 #define ULLONG_MAX ((unsigned LONG_LONG)LLONG_MAX*2+1) 3040 #define LLONG_MIN_MINUS_ONE_IS_LESS_THAN(n) \ 3041 (LLONG_MIN_MINUS_ONE == (double)LLONG_MIN ? \ 3043 LLONG_MIN_MINUS_ONE < (n)) 3046 rb_num2ll(
VALUE val)
3056 && (LLONG_MIN_MINUS_ONE_IS_LESS_THAN(
RFLOAT_VALUE(val)))) {
3064 return rb_big2ll(val);
3078 rb_num2ull(
VALUE val)
3088 && LLONG_MIN_MINUS_ONE_IS_LESS_THAN(
RFLOAT_VALUE(val))) {
3091 return (
unsigned LONG_LONG)(LONG_LONG)(
RFLOAT_VALUE(val));
3098 return rb_big2ull(val);
3108 return NUM2ULL(val);
3186 if ((num & 2) == 0) {
3227 #define int_succ rb_int_succ 3252 #define int_pred rb_int_pred 3411 if (base < 2 || 36 < base) {
3414 #if SIZEOF_LONG < SIZEOF_VOIDP 3415 # if SIZEOF_VOIDP == SIZEOF_LONG_LONG 3416 if ((val >= 0 && (x & 0xFFFFFFFF00000000ull)) ||
3417 (val < 0 && (x & 0xFFFFFFFF00000000ull) != 0xFFFFFFFF00000000ull)) {
3418 rb_bug(
"Unnormalized Fixnum value %p", (
void *)x);
3429 u = 1 + (
unsigned long)(-(val + 1));
3437 }
while (u /= base);
3573 #define SQRT_LONG_MAX ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2)) 3575 #define FIT_SQRT_LONG(n) (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX)) 3867 volatile VALUE a, b;
3924 while (y % 2 == 0) {
3962 if (a == 1)
return INT2FIX(1);
3972 if (b == 0)
return INT2FIX(1);
3973 if (b == 1)
return x;
3981 if (a == 1)
return INT2FIX(1);
3988 if (a == 0)
return INT2FIX(0);
3997 if (a == 1)
return DBL2NUM(1.0);
4000 if (a < 0 && dy !=
round(dy))
4002 return DBL2NUM(pow((
double)a, dy));
4038 if (x == y)
return Qtrue;
4079 if (x == y)
return INT2FIX(0);
4321 args[0] = (
VALUE)func;
4326 args[2], args[1], (
VALUE)args);
4457 return fix_rshift(val, (
unsigned long)-width);
4464 if (width > (SIZEOF_LONG*
CHAR_BIT-1)
4465 || ((
unsigned long)val)>>(SIZEOF_LONG*
CHAR_BIT-1-width) > 0) {
4501 if (i == 0)
return x;
4510 if (i >=
sizeof(
long)*
CHAR_BIT-1) {
4511 if (val < 0)
return INT2FIX(-1);
4514 val = RSHIFT(val, i);
4570 if (val < 0)
return INT2FIX(1);
4898 for (i =
FIX2LONG(from); i <= end; i++) {
4944 for (i=
FIX2LONG(from); i >= end; i--) {
4998 for (i=0; i<end; i++) {
5036 if (!
rb_scan_args(argc, argv,
"01:", &nd, &opt))
return num;
5244 #define rb_intern(str) rb_intern_const(str) 5355 #ifndef RUBY_INTEGER_UNIFICATION 5508 #undef rb_float_value unsigned short rb_fix2ushort(VALUE val)
VALUE rb_big_modulo(VALUE x, VALUE y)
int rb_bigzero_p(VALUE x)
static VALUE int_aref(VALUE num, VALUE idx)
static int do_coerce(VALUE *x, VALUE *y, int err)
static VALUE flo_to_s(VALUE flt)
static int cmp(VALUE x, VALUE y)
static VALUE num_abs(VALUE num)
#define FIXNUM_POSITIVE_P(num)
int rb_enc_codelen(int c, rb_encoding *enc)
static VALUE num_remainder(VALUE x, VALUE y)
short rb_num2short(VALUE val)
static VALUE num_coerce(VALUE x, VALUE y)
static VALUE flo_to_i(VALUE num)
static VALUE fix_minus(VALUE x, VALUE y)
static VALUE num_truncate(int argc, VALUE *argv, VALUE num)
void rb_bug(const char *fmt,...)
static VALUE flo_plus(VALUE x, VALUE y)
static VALUE fix_le(VALUE x, VALUE y)
VALUE rb_int_floor(VALUE num, int ndigits)
size_t strlen(const char *)
VALUE rb_int_ge(VALUE x, VALUE y)
static VALUE flo_hash(VALUE num)
static VALUE flo_cmp(VALUE x, VALUE y)
double rb_int_fdiv_double(VALUE x, VALUE y)
static VALUE flo_zero_p(VALUE num)
static VALUE coerce_rescue(VALUE arg, VALUE errinfo)
static VALUE rb_fix_rshift(VALUE x, VALUE y)
VALUE rb_num_coerce_bit(VALUE x, VALUE y, ID func)
static double round_half_even(double x, double s)
static VALUE compare_with_zero(VALUE num, ID mid)
static VALUE num_step_size(VALUE from, VALUE args, VALUE eobj)
static unsigned int hash(str, len) register const char *str
void rb_undef_alloc_func(VALUE)
RUBY_EXTERN int signbit(double x)
VALUE rb_int_truncate(VALUE num, int ndigits)
static VALUE num_equal(VALUE x, VALUE y)
static VALUE fix_xor(VALUE x, VALUE y)
static int int_neg_p(VALUE num)
static VALUE fix_size(VALUE fix)
#define rb_usascii_str_new2
const union bytesequence4_or_float rb_infinity
VALUE rb_str_cat(VALUE, const char *, long)
static VALUE num_funcall_op_1(VALUE y, VALUE arg, int recursive)
static VALUE num_zero_p(VALUE num)
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
static VALUE coerce_body(VALUE arg)
static double ruby_float_step_size(double beg, double end, double unit, int excl)
VALUE rb_int_plus(VALUE x, VALUE y)
#define LONG_MAX_PLUS_ONE
double rb_float_value(VALUE v)
const char ruby_digitmap[]
unsigned long rb_big2ulong(VALUE x)
#define ONIGERR_INVALID_CODE_POINT_VALUE
static VALUE int_lt(VALUE x, VALUE y)
VALUE rb_big_odd_p(VALUE num)
static SIGNED_VALUE int_round_half_down(SIGNED_VALUE x, SIGNED_VALUE y)
static VALUE int_even_p(VALUE x)
VALUE rb_big_eql(VALUE x, VALUE y)
VALUE rb_big_plus(VALUE x, VALUE y)
unsigned long rb_num2ulong(VALUE val)
rb_encoding * rb_to_encoding(VALUE enc)
double ruby_float_mod(double x, double y)
size_t rb_big_size(VALUE big)
VALUE rb_fix2str(VALUE x, int base)
static VALUE fix_comp(VALUE num)
VALUE rb_dbl_cmp(double a, double b)
static VALUE fix_mul(VALUE x, VALUE y)
VALUE rb_float_abs(VALUE flt)
rb_encoding * rb_default_internal_encoding(void)
static VALUE flo_quo(VALUE x, VALUE y)
VALUE rb_ary_push(VALUE ary, VALUE item)
SSL_METHOD *(* func)(void)
static int int_half_p_half_down(VALUE num, VALUE n, VALUE f)
RUBY_EXTERN VALUE rb_eMathDomainError
static VALUE int_or(VALUE x, VALUE y)
VALUE rb_big_bit_length(VALUE big)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
static VALUE flo_to_f(VALUE num)
static VALUE num_funcall_op_0(VALUE x, VALUE arg, int recursive)
static VALUE num_modulo(VALUE x, VALUE y)
void rb_raise(VALUE exc, const char *fmt,...)
static void num_funcall_op_1_recursion(VALUE x, ID func, VALUE y)
VALUE rb_integer_float_cmp(VALUE x, VALUE y)
static VALUE rb_fix_mul_fix(VALUE x, VALUE y)
long rb_dbl_long_hash(double d)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
int rb_num_negative_p(VALUE num)
VALUE rb_int_equal(VALUE x, VALUE y)
void rb_include_module(VALUE klass, VALUE module)
static VALUE num_imaginary(VALUE num)
double rb_big2dbl(VALUE x)
VALUE rb_num2fix(VALUE val)
#define rb_complex_raw1(x)
VALUE rb_float_pow(VALUE x, VALUE y)
static VALUE rb_fix_bit_length(VALUE fix)
unsigned short rb_num2ushort(VALUE val)
VALUE rb_int_gt(VALUE x, VALUE y)
static int int_half_p_half_even(VALUE num, VALUE n, VALUE f)
static VALUE dbl2ival(double d)
static VALUE rb_fix_div_fix(VALUE x, VALUE y)
static int negative_int_p(VALUE num)
VALUE rb_int_lshift(VALUE x, VALUE y)
VALUE rb_int_pred(VALUE num)
static VALUE flo_ge(VALUE x, VALUE y)
static VALUE fix_idiv(VALUE x, VALUE y)
void rb_undef_method(VALUE klass, const char *name)
int rb_cmpint(VALUE val, VALUE a, VALUE b)
static VALUE flo_divmod(VALUE x, VALUE y)
static VALUE fix_or(VALUE x, VALUE y)
#define FLOAT_OUT_OF_RANGE(val, type)
static VALUE flo_lt(VALUE x, VALUE y)
static VALUE int_to_f(VALUE num)
const char * rb_obj_classname(VALUE)
RUBY_EXTERN void * memmove(void *, const void *, size_t)
VALUE rb_int_modulo(VALUE x, VALUE y)
short rb_fix2short(VALUE val)
void rb_name_error(ID id, const char *fmt,...)
#define NEWOBJ_OF(obj, type, klass, flags)
const union bytesequence4_or_float rb_nan
VALUE rb_fix_plus(VALUE x, VALUE y)
VALUE rb_singleton_class(VALUE obj)
Returns the singleton class of obj.
static VALUE flo_next_float(VALUE vx)
#define RB_TYPE_P(obj, type)
VALUE rb_big_divmod(VALUE x, VALUE y)
VALUE rb_int_cmp(VALUE x, VALUE y)
VALUE rb_int_idiv(VALUE x, VALUE y)
VALUE rb_big_ge(VALUE x, VALUE y)
static VALUE int_le(VALUE x, VALUE y)
VALUE rb_rescue(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*r_proc)(ANYARGS), VALUE data2)
#define rb_rational_raw1(x)
VALUE rb_dbl2big(double d)
static VALUE num_real_p(VALUE num)
VALUE rb_big_eq(VALUE x, VALUE y)
static VALUE num_floor(int argc, VALUE *argv, VALUE num)
#define ROUND_CALL(mode, name, args)
static VALUE fix_divide(VALUE x, VALUE y, ID op)
VALUE rb_complex_mul(VALUE self, VALUE other)
static int float_round_overflow(int ndigits, int binexp)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_int_fdiv(VALUE x, VALUE y)
static int positive_int_p(VALUE num)
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE, VALUE)
static VALUE flo_ceil(int argc, VALUE *argv, VALUE num)
long rb_num2long(VALUE val)
VALUE rb_int_mul(VALUE x, VALUE y)
static SIGNED_VALUE int_round_half_up(SIGNED_VALUE x, SIGNED_VALUE y)
VALUE rb_int_positive_pow(long x, unsigned long y)
static VALUE flo_is_nan_p(VALUE num)
static double fix_fdiv_double(VALUE x, VALUE y)
static VALUE num_to_int(VALUE num)
VALUE rb_big_cmp(VALUE x, VALUE y)
static VALUE num_funcall_bit_1(VALUE y, VALUE arg, int recursive)
static VALUE num_uplus(VALUE num)
static VALUE int_dotimes(VALUE num)
VALUE rb_num_coerce_relop(VALUE x, VALUE y, ID func)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
static VALUE flo_negative_p(VALUE num)
static VALUE flo_truncate(int argc, VALUE *argv, VALUE num)
static VALUE int_upto(VALUE from, VALUE to)
void rb_define_const(VALUE, const char *, VALUE)
static VALUE fix_div(VALUE x, VALUE y)
void rb_remove_method_id(VALUE, ID)
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
static VALUE int_comp(VALUE num)
#define BIGNUM_NEGATIVE_P(b)
RUBY_EXTERN int isinf(double)
static VALUE fix_pow(VALUE x, VALUE y)
static VALUE fix_rshift(long, unsigned long)
static VALUE fix_equal(VALUE x, VALUE y)
static VALUE int_ceil(int argc, VALUE *argv, VALUE num)
VALUE rb_int_minus(VALUE x, VALUE y)
static VALUE num_fdiv(VALUE x, VALUE y)
static VALUE int_downto(VALUE from, VALUE to)
VALUE rb_int_uminus(VALUE num)
void rb_num_zerodiv(void)
VALUE rb_eFloatDomainError
char * ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve)
static VALUE int_chr(int argc, VALUE *argv, VALUE num)
VALUE rb_big2str(VALUE x, int base)
static VALUE fix_plus(VALUE x, VALUE y)
static VALUE rb_float_new_inline(double d)
static VALUE fix_gt(VALUE x, VALUE y)
static VALUE num_funcall0(VALUE x, ID func)
static VALUE num_step(int argc, VALUE *argv, VALUE from)
static VALUE int_round(int argc, VALUE *argv, VALUE num)
VALUE rb_str_resize(VALUE, long)
static VALUE fix_uminus(VALUE num)
static VALUE fix_lt(VALUE x, VALUE y)
static VALUE num_step_compare_with_zero(VALUE num)
static VALUE num_ceil(int argc, VALUE *argv, VALUE num)
static VALUE num_int_p(VALUE num)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
VALUE rb_big_minus(VALUE x, VALUE y)
VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode)
#define RARRAY_CONST_PTR(a)
void rb_deprecate_constant(VALUE mod, const char *name)
#define MUL_OVERFLOW_FIXNUM_P(a, b)
static VALUE flo_positive_p(VALUE num)
long rb_fix2int(VALUE val)
VALUE rb_big_div(VALUE x, VALUE y)
VALUE rb_big_idiv(VALUE x, VALUE y)
int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
static VALUE flo_floor(int argc, VALUE *argv, VALUE num)
static VALUE coerce_rescue_quiet(VALUE arg, VALUE errinfo)
static double round_half_down(double x, double s)
static VALUE fix_aref(VALUE fix, VALUE idx)
VALUE rb_big_size_m(VALUE big)
static VALUE fix_and(VALUE x, VALUE y)
static VALUE int_truncate(int argc, VALUE *argv, VALUE num)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
unsigned char buf[MIME_BUF_SIZE]
VALUE rb_assoc_new(VALUE car, VALUE cdr)
long rb_big2long(VALUE x)
static unsigned long rb_num2ulong_internal(VALUE val, int *wrap_p)
#define FIXNUM_NEGATIVE_P(num)
static VALUE num_divmod(VALUE x, VALUE y)
VALUE rb_num_coerce_cmp(VALUE x, VALUE y, ID func)
static VALUE fix_cmp(VALUE x, VALUE y)
VALUE rb_int_and(VALUE x, VALUE y)
VALUE rb_big_mul(VALUE x, VALUE y)
static VALUE flo_is_finite_p(VALUE num)
static VALUE int_downto_size(VALUE from, VALUE args, VALUE eobj)
static char * out_of_range_float(char(*pbuf)[24], VALUE val)
#define LONG_MIN_MINUS_ONE_IS_LESS_THAN(n)
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn)
static void coerce_failed(VALUE x, VALUE y)
char * strchr(char *, char)
static VALUE num_finite_p(VALUE num)
VALUE rb_int_pow(VALUE x, VALUE y)
static VALUE rb_fix_mod_fix(VALUE x, VALUE y)
static VALUE num_cmp(VALUE x, VALUE y)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
const char * rb_id2name(ID)
size_t rb_absint_size(VALUE val, int *nlz_bits_ret)
VALUE rb_big_even_p(VALUE num)
VALUE rb_big_gt(VALUE x, VALUE y)
#define RARRAY_LENINT(ary)
VALUE rb_int_abs(VALUE num)
VALUE rb_complex_new(VALUE x, VALUE y)
enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts)
#define RB_FLOAT_TYPE_P(obj)
VALUE rb_big_comp(VALUE x)
static VALUE int_dotimes_size(VALUE num, VALUE args, VALUE eobj)
int rb_respond_to(VALUE, ID)
register unsigned int len
static int int_half_p_half_up(VALUE num, VALUE n, VALUE f)
static int num_step_scan_args(int argc, const VALUE *argv, VALUE *to, VALUE *step)
VALUE rb_int_ceil(VALUE num, int ndigits)
static int int_pos_p(VALUE num)
static VALUE int_pow(long x, unsigned long y)
static VALUE int_int_p(VALUE num)
static VALUE flo_coerce(VALUE x, VALUE y)
static VALUE int_odd_p(VALUE x)
static VALUE flo_round(int argc, VALUE *argv, VALUE num)
static VALUE fix_ge(VALUE x, VALUE y)
VALUE rb_equal(VALUE, VALUE)
static VALUE rb_int_digits(int argc, VALUE *argv, VALUE num)
VALUE rb_big_uminus(VALUE x)
VALUE rb_int_div(VALUE x, VALUE y)
double rb_big_fdiv_double(VALUE x, VALUE y)
static VALUE flo_minus(VALUE x, VALUE y)
static VALUE flo_eq(VALUE x, VALUE y)
static VALUE num_eql(VALUE x, VALUE y)
VALUE rb_big_remainder(VALUE x, VALUE y)
VALUE rb_dbl_hash(double d)
long rb_num2int(VALUE val)
#define RARRAY_AREF(a, i)
static VALUE int_size(VALUE num)
static VALUE num_div(VALUE x, VALUE y)
static int num_step_negative_p(VALUE num)
static VALUE int_to_s(int argc, VALUE *argv, VALUE x)
static void check_short(long num)
static VALUE int_to_i(VALUE num)
static VALUE num_init_copy(VALUE x, VALUE y)
VALUE rb_big_and(VALUE x, VALUE y)
VALUE rb_rational_reciprocal(VALUE x)
#define FIXNUM_ZERO_P(num)
static VALUE num_funcall1(VALUE x, ID func, VALUE y)
static void rb_fix_divmod_fix(VALUE a, VALUE b, VALUE *divp, VALUE *modp)
static VALUE fix_mod(VALUE x, VALUE y)
VALUE rb_str_catf(VALUE str, const char *format,...)
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE
static VALUE flo_prev_float(VALUE vx)
VALUE rb_check_string_type(VALUE)
VALUE rb_big_norm(VALUE x)
VALUE rb_float_new(double d)
VALUE rb_big_lshift(VALUE x, VALUE y)
#define ULONG_MAX_PLUS_ONE
VALUE rb_float_new_in_heap(double d)
static VALUE num_positive_p(VALUE num)
static Bigint * diff(Bigint *a, Bigint *b)
static VALUE flo_div(VALUE x, VALUE y)
#define RGENGC_WB_PROTECTED_FLOAT
VALUE rb_float_uminus(VALUE flt)
VALUE rb_float_gt(VALUE x, VALUE y)
static VALUE rb_int_digits_bigbase(VALUE num, VALUE base)
static VALUE rb_fix_digits(VALUE fix, long base)
#define method_basic_p(klass)
static int int_round_zero_p(VALUE num, int ndigits)
static VALUE int_ord(VALUE num)
VALUE rb_complex_plus(VALUE self, VALUE other)
VALUE rb_big_pow(VALUE x, VALUE y)
static void check_ushort(unsigned long num, int sign)
static SIGNED_VALUE int_round_half_even(SIGNED_VALUE x, SIGNED_VALUE y)
int rb_num_to_uint(VALUE val, unsigned int *ret)
#define BIGNUM_POSITIVE_P(b)
static VALUE num_uminus(VALUE num)
VALUE rb_int2big(SIGNED_VALUE n)
static VALUE num_negative_p(VALUE num)
VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
VALUE rb_big_aref(VALUE x, VALUE y)
static VALUE flo_le(VALUE x, VALUE y)
VALUE rb_integer_float_eq(VALUE x, VALUE y)
VALUE rb_gcd(VALUE x, VALUE y)
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
NORETURN(static void coerce_failed(VALUE x, VALUE y))
VALUE rb_big_le(VALUE x, VALUE y)
VALUE rb_int_succ(VALUE num)
static VALUE fix_lshift(long, unsigned long)
static VALUE int_upto_size(VALUE from, VALUE args, VALUE eobj)
VALUE rb_yield_1(VALUE val)
RUBY_EXTERN double nextafter(double x, double y)
VALUE rb_int_divmod(VALUE x, VALUE y)
VALUE rb_big_lt(VALUE x, VALUE y)
static VALUE rb_int_bit_length(VALUE num)
static VALUE int_xor(VALUE x, VALUE y)
VALUE() rb_ary_new_from_args(long n,...)
static double rb_float_value_inline(VALUE v)
rb_encoding * rb_ascii8bit_encoding(void)
static VALUE flo_is_infinite_p(VALUE num)
static VALUE flo_eql(VALUE x, VALUE y)
static VALUE flo_mod(VALUE x, VALUE y)
static VALUE num_infinite_p(VALUE num)
static VALUE flo_mul(VALUE x, VALUE y)
#define rb_intern_const(str)
VALUE rb_big_rshift(VALUE x, VALUE y)
#define SPECIAL_CONST_P(x)
static VALUE num_round(int argc, VALUE *argv, VALUE num)
static VALUE int_floor(int argc, VALUE *argv, VALUE num)
VALUE rb_int2str(VALUE x, int base)
#define rb_enc_mbcput(c, buf, enc)
static VALUE fix_abs(VALUE fix)
VALUE rb_usascii_str_new(const char *, long)
static double round_half_up(double x, double s)
#define RB_INTEGER_TYPE_P(obj)
VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
static void rb_out_of_short(SIGNED_VALUE num)
VALUE int_remainder(VALUE x, VALUE y)
static int float_round_underflow(int ndigits, int binexp)
VALUE rb_big_abs(VALUE x)
static VALUE rb_fix_lshift(VALUE x, VALUE y)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static VALUE num_sadded(VALUE x, VALUE name)
int rb_memcicmp(const void *, const void *, long)
void rb_warn(const char *fmt,...)
static VALUE rb_int_rshift(VALUE x, VALUE y)
VALUE rb_big_or(VALUE x, VALUE y)
static void flodivmod(double x, double y, double *divp, double *modp)
static VALUE fix_divmod(VALUE x, VALUE y)
void rb_cmperr(VALUE x, VALUE y)
VALUE rb_usascii_str_new_cstr(const char *)
VALUE rb_big_xor(VALUE x, VALUE y)
VALUE rb_num_coerce_bin(VALUE x, VALUE y, ID func)
static VALUE num_nonzero_p(VALUE num)
VALUE rb_str_new(const char *, long)
VALUE rb_obj_class(VALUE)