Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables

# numeric.c File Reference

`#include "ruby/ruby.h"`
`#include "ruby/encoding.h"`
`#include "ruby/util.h"`
`#include <ctype.h>`
`#include <math.h>`
`#include <stdio.h>`
Include dependency graph for numeric.c:

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_MANT_DIG 53
#define | DBL_EPSILON 2.2204460492503131e-16
#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)
void | rb_num_zerodiv (void)
static VALUE | num_coerce (VALUE x, VALUE y)
static VALUE | coerce_body (VALUE *x)
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 (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)
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 | flo_round (int argc, VALUE *argv, VALUE num)
static VALUE | flo_truncate (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)
int | ruby_float_step (VALUE from, VALUE to, VALUE step, int excl)
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)
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)
static VALUE | int_succ (VALUE num)
static VALUE | 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)
static VALUE | fix_uminus (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 VALUE | fix_mul (VALUE x, VALUE y)
static void | fixdivmod (long x, long y, long *divp, long *modp)
VALUE | rb_big_fdiv (VALUE x, VALUE y)
static VALUE | fix_fdiv (VALUE x, VALUE y)
VALUE | rb_rational_reciprocal (VALUE x)
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 | int_pow (long x, unsigned long 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 VALUE | bit_coerce (VALUE x)
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 (VALUE from, VALUE to)
static VALUE | int_downto (VALUE from, VALUE to)
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
const unsigned char | rb_infinity [] = "\x00\x00\x80\x7f"
const unsigned char | rb_nan [] = "\x00\x00\xc0\x7f"
static ID | id_coerce
static ID | id_to_i
static ID | id_eq
VALUE | rb_cNumeric
VALUE | rb_cFloat
VALUE | rb_cInteger
VALUE | rb_cFixnum
VALUE | rb_eZeroDivError
VALUE | rb_eFloatDomainError

## Define Documentation

#define DBL_DIG 15

Definition at line 57 of file numeric.c.

Referenced by flo_to_s(), Init_Numeric(), rb_cstr_to_dbl(), and ruby_strtod().

#define DBL_EPSILON 2.2204460492503131e-16

Definition at line 63 of file numeric.c.

Referenced by Init_Numeric(), and ruby_float_step().

#define DBL_MANT_DIG 53

Definition at line 60 of file numeric.c.

Referenced by flo_to_s(), and Init_Numeric().

#define DBL_MAX 1.7976931348623157e+308

Definition at line 42 of file numeric.c.

Referenced by Init_Numeric().

#define DBL_MAX_10_EXP 308

Definition at line 54 of file numeric.c.

Referenced by BigDecimal_to_f(), Init_Numeric(), and ruby_strtod().

#define DBL_MAX_EXP 1024

Definition at line 48 of file numeric.c.

Referenced by big2dbl(), BSD__hdtoa(), Init_Numeric(), and ruby_strtod().

#define DBL_MIN 2.2250738585072014e-308

Definition at line 39 of file numeric.c.

Referenced by Init_Numeric().

#define DBL_MIN_10_EXP (-307)

Definition at line 51 of file numeric.c.

Referenced by Init_Numeric().

#define DBL_MIN_EXP (-1021)

Definition at line 45 of file numeric.c.

Referenced by Init_Numeric().

#define FIT_SQRT_LONG | ( |  | n | ) | (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX))

Definition at line 2284 of file numeric.c.

Referenced by fix_mul(), and int_pow().

#define FLT_RADIX 2

Definition at line 33 of file numeric.c.

Referenced by float_rationalize(), float_to_r(), Init_Numeric(), and ruby_strtod().

#define FLT_ROUNDS 1

Definition at line 36 of file numeric.c.

Referenced by Init_Numeric().

#define rb_intern | ( |  | str | ) | rb_intern_const(str)

#define SQRT_LONG_MAX ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))

Definition at line 2282 of file numeric.c.

## Function Documentation

static VALUE bit_coerce | ( | VALUE | x | ) | `[static]`

Definition at line 2809 of file numeric.c.

References FIXNUM_P, rb_eTypeError, rb_raise(), rb_to_int(), T_BIGNUM, T_FLOAT, and TYPE.

Referenced by fix_and(), fix_or(), and fix_xor().

static VALUE coerce_body | ( | VALUE * | x | ) | `[static]`

Definition at line 144 of file numeric.c.

References id_coerce, and rb_funcall().

Referenced by do_coerce().

static VALUE coerce_rescue | ( | VALUE * | x | ) | `[static]`

Definition at line 150 of file numeric.c.

References Qnil, rb_eTypeError, rb_inspect(), rb_obj_classname(), rb_raise(), rb_special_const_p(), and RSTRING_PTR.

Referenced by do_coerce().

static VALUE dbl2ival | ( | double | d | ) | `[static]`

Definition at line 823 of file numeric.c.

References FIXABLE, LONG2FIX, rb_dbl2big(), and round().

Referenced by fix_divmod(), and flo_divmod().

static int do_coerce | ( | VALUE * | x,
|  | VALUE * | y,
|  | int | err
| ) |  | `[static]`

Definition at line 163 of file numeric.c.

References coerce_body(), coerce_rescue(), FALSE, RARRAY_LEN, RARRAY_PTR, rb_eTypeError, rb_raise(), rb_rescue(), T_ARRAY, TRUE, and TYPE.

Referenced by 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 3019 of file numeric.c.

References FIX2LONG, and LONG2NUM.

Referenced by Init_Numeric().

static VALUE fix_and | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2828 of file numeric.c.

References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, and rb_big_and().

Referenced by Init_Numeric().

static VALUE fix_aref | ( | VALUE | fix,
|  | VALUE | idx
| ) |  | `[static]`

Definition at line 2962 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 2675 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, rb_big_cmp(), rb_dbl_cmp(), rb_int2big(), rb_intern, rb_num_coerce_cmp(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_div | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2446 of file numeric.c.

References fix_divide().

Referenced by Init_Numeric().

static VALUE fix_divide | ( | VALUE | x,
|  | VALUE | y,
|  | ID | op
| ) |  | `[static]`

Definition at line 2401 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 2505 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 2650 of file numeric.c.

References FIX2LONG, FIXNUM_P, num_equal(), Qfalse, Qtrue, rb_big_eq(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_even_p | ( | VALUE | num | ) | `[static]`

Definition at line 3266 of file numeric.c.

References Qfalse, and Qtrue.

Referenced by Init_Numeric().

static VALUE fix_fdiv | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2383 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 2726 of file numeric.c.

References FIX2INT, FIX2LONG, FIXNUM_P, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_intern, rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_gt | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2701 of file numeric.c.

References FIX2INT, FIX2LONG, FIXNUM_P, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_idiv | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2459 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 2776 of file numeric.c.

References FIX2INT, FIX2LONG, FIXNUM_P, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_intern, rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_lshift | ( | long | val,
|  | unsigned long | width
| ) |  | `[static]`

Definition at line 2902 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 2751 of file numeric.c.

References FIX2INT, FIX2LONG, FIXNUM_P, Qfalse, Qtrue, rb_big_cmp(), rb_int2big(), rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_minus | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2258 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 2474 of file numeric.c.

References DBL2NUM, FIX2LONG, fixdivmod(), FIXNUM_P, flodivmod(), LONG2NUM, mod, rb_big_modulo(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE fix_mul | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2296 of file numeric.c.

References DBL2NUM, FIT_SQRT_LONG, FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, 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 3250 of file numeric.c.

References Qfalse, and Qtrue.

Referenced by Init_Numeric().

static VALUE fix_or | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2847 of file numeric.c.

References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, and rb_big_or().

Referenced by Init_Numeric().

static VALUE fix_plus | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2225 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 2582 of file numeric.c.

References DBL2NUM, FIX2LONG, FIXNUM_P, INFINITY, INT2FIX, int_even_p(), int_pow(), 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]`

Definition at line 2800 of file numeric.c.

References FIX2LONG, and LONG2NUM.

Referenced by Init_Numeric().

static VALUE fix_rshift | ( | long | val,
|  | unsigned long | i
| ) |  | `[static]`

Definition at line 2935 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]`

Definition at line 3043 of file numeric.c.

References INT2FIX.

Referenced by Init_Numeric().

static VALUE fix_succ | ( | VALUE | num | ) | `[static]`

Definition at line 1994 of file numeric.c.

References FIX2LONG, and LONG2NUM.

Referenced by Init_Numeric().

static VALUE fix_to_f | ( | VALUE | num | ) | `[static]`

Definition at line 2997 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 2200 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 2150 of file numeric.c.

References FIX2LONG, and LONG2NUM.

Referenced by Init_Numeric().

static VALUE fix_xor | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2866 of file numeric.c.

References bit_coerce(), FIX2LONG, FIXNUM_P, LONG2NUM, and rb_big_xor().

Referenced by Init_Numeric().

static VALUE fix_zero_p | ( | VALUE | num | ) | `[static]`

Definition at line 3234 of file numeric.c.

References FIX2LONG, Qfalse, and Qtrue.

Referenced by Init_Numeric().

static void fixdivmod | ( | long | x,
|  | long | y,
|  | long * | divp,
|  | long * | modp
| ) |  | `[static]`

Definition at line 2342 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 1257 of file numeric.c.

References DBL2NUM, and RFLOAT_VALUE.

Referenced by Init_Numeric().

static VALUE flo_ceil | ( | VALUE | num | ) | `[static]`

Definition at line 1390 of file numeric.c.

References FIXABLE, LONG2FIX, rb_dbl2big(), and RFLOAT_VALUE.

Referenced by Init_Numeric(), and num_ceil().

static VALUE flo_cmp | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 1017 of file numeric.c.

References FIX2LONG, INT2FIX, isinf(), isnan, Qnil, rb_big2dbl(), rb_dbl_cmp(), rb_funcall(), rb_intern, rb_num_coerce_cmp(), rb_respond_to(), 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 632 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 728 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 840 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 950 of file numeric.c.

References FIX2LONG, isnan, num_equal(), Qfalse, Qtrue, rb_big2dbl(), 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 1217 of file numeric.c.

References isnan, Qfalse, Qtrue, RFLOAT_VALUE, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE flo_floor | ( | VALUE | num | ) | `[static]`

Definition at line 1364 of file numeric.c.

References FIXABLE, LONG2FIX, rb_dbl2big(), and RFLOAT_VALUE.

Referenced by Init_Numeric(), and num_floor().

static VALUE flo_ge | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 1098 of file numeric.c.

References FIX2LONG, isnan, Qfalse, Qtrue, rb_big2dbl(), 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 1059 of file numeric.c.

References FIX2LONG, isnan, Qfalse, Qtrue, rb_big2dbl(), 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 985 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 1336 of file numeric.c.

References finite(), isinf(), isnan, Qfalse, Qtrue, and RFLOAT_VALUE.

Referenced by Init_Numeric().

static VALUE flo_is_infinite_p | ( | VALUE | num | ) | `[static]`

Definition at line 1314 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 1294 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 1175 of file numeric.c.

References FIX2LONG, isnan, Qfalse, Qtrue, rb_big2dbl(), 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 1136 of file numeric.c.

References FIX2LONG, isnan, Qfalse, Qtrue, rb_big2dbl(), 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 682 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 801 of file numeric.c.

References DBL2NUM, FIX2LONG, flodivmod(), mod, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.

Referenced by Init_Numeric().

static VALUE flo_mul | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 705 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 659 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 875 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]`

Definition at line 755 of file numeric.c.

References rb_funcall().

Referenced by Init_Numeric().

static VALUE flo_round | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | num
| ) |  | `[static]`

Definition at line 1433 of file numeric.c.

References DBL2NUM, FIXABLE, isinf(), LONG2FIX, NUM2INT, rb_dbl2big(), 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 1239 of file numeric.c.

Referenced by Init_Numeric().

static VALUE flo_to_s | ( | VALUE | flt | ) | `[static]`

Definition at line 559 of file numeric.c.

References buf, CHAR_BIT, DBL_DIG, DBL_MANT_DIG, isinf(), isnan, len, memmove(), rb_str_cat(), rb_str_catf(), rb_str_resize(), rb_usascii_str_new(), rb_usascii_str_new2(), rb_usascii_str_new_cstr(), RFLOAT_VALUE, RSTRING_LEN, RSTRING_PTR, ruby_dtoa(), and xfree().

Referenced by Init_Numeric().

static VALUE flo_truncate | ( | VALUE | num | ) | `[static]`

Definition at line 1479 of file numeric.c.

References FIXABLE, LONG2FIX, rb_dbl2big(), and RFLOAT_VALUE.

Referenced by Init_Numeric(), and num_truncate().

static VALUE flo_uminus | ( | VALUE | flt | ) | `[static]`

Definition at line 645 of file numeric.c.

References DBL2NUM, and RFLOAT_VALUE.

Referenced by Init_Numeric().

static VALUE flo_zero_p | ( | VALUE | num | ) | `[static]`

Definition at line 1272 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 761 of file numeric.c.

References div, isinf(), isnan, mod, and rb_num_zerodiv().

Referenced by fix_divmod(), fix_mod(), flo_divmod(), and flo_mod().

void Init_Numeric | ( | void |  | ) |

Definition at line 3307 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_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_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 2067 of file numeric.c.

References NUM2UINT, rb_ascii8bit_encoding(), rb_default_internal_encoding(), rb_eArgError, rb_enc_uint_chr(), rb_eRangeError, 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 3151 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2FIX, rb_funcall(), rb_yield(), RETURN_ENUMERATOR, and RTEST.

Referenced by Init_Numeric().

static VALUE int_downto | ( | VALUE | from,
|  | VALUE | to
| ) |  | `[static]`

Definition at line 3108 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2FIX, NIL_P, rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_ENUMERATOR.

Referenced by Init_Numeric().

static VALUE int_even_p | ( | VALUE | num | ) | `[static]`

Definition at line 1974 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]`

Definition at line 1945 of file numeric.c.

References Qtrue.

Referenced by Init_Numeric().

static VALUE int_odd_p | ( | VALUE | num | ) | `[static]`

Definition at line 1958 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 2117 of file numeric.c.

Referenced by Init_Numeric().

static VALUE int_pow | ( | long | x,
|  | unsigned long | y
| ) |  | `[static]`

Definition at line 2534 of file numeric.c.

References FIT_SQRT_LONG, LONG2NUM, neg, POSFIXABLE, rb_big_mul(), rb_big_pow(), and rb_int2big().

Referenced by fix_pow(), and int_round().

static VALUE int_pred | ( | VALUE | num | ) | `[static]`

Definition at line 2032 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2NUM, and rb_funcall().

Referenced by Init_Numeric().

static VALUE int_round | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | num
| ) |  | `[static]`

Definition at line 3189 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, int_pow(), LONG2NUM, neg, NUM2INT, rb_eArgError, rb_Float(), rb_funcall(), rb_raise(), rb_scan_args(), RTEST, and SIGNED_VALUE.

Referenced by Init_Numeric().

static VALUE int_succ | ( | VALUE | num | ) | `[static]`

Definition at line 2012 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2NUM, and rb_funcall().

Referenced by Init_Numeric().

static VALUE int_to_i | ( | VALUE | num | ) | `[static]`

Definition at line 1932 of file numeric.c.

Referenced by Init_Numeric().

static VALUE int_upto | ( | VALUE | from,
|  | VALUE | to
| ) |  | `[static]`

Definition at line 3066 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2FIX, NIL_P, rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_ENUMERATOR.

Referenced by Init_Numeric().

static VALUE num_abs | ( | VALUE | num | ) | `[static]`

Definition at line 467 of file numeric.c.

References INT2FIX, rb_funcall(), rb_intern, and RTEST.

Referenced by Init_Numeric().

static VALUE num_ceil | ( | VALUE | num | ) | `[static]`

Definition at line 1529 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 924 of file numeric.c.

References INT2FIX, and Qnil.

Referenced by Init_Numeric().

static VALUE num_coerce | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 134 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 328 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 421 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 908 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 931 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 307 of file numeric.c.

References rb_Float(), and rb_funcall().

Referenced by Init_Numeric().

static VALUE num_floor | ( | VALUE | num | ) | `[static]`

Definition at line 1507 of file numeric.c.

References flo_floor(), and rb_Float().

Referenced by Init_Numeric().

static VALUE num_imaginary | ( | VALUE | num | ) | `[static]`

Definition at line 261 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 232 of file numeric.c.

References Qnil, rb_eTypeError, rb_obj_classname(), and rb_raise().

Referenced by Init_Numeric().

static VALUE num_int_p | ( | VALUE | num | ) | `[static]`

Definition at line 449 of file numeric.c.

References Qfalse.

Referenced by Init_Numeric().

static VALUE num_modulo | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 348 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 506 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 293 of file numeric.c.

References rb_funcall(), and rb_rational_raw1.

Referenced by Init_Numeric().

static VALUE num_real_p | ( | VALUE | num | ) | `[static]`

Definition at line 435 of file numeric.c.

References Qtrue.

Referenced by Init_Numeric().

static VALUE num_remainder | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 365 of file numeric.c.

References INT2FIX, rb_equal(), rb_funcall(), and RTEST.

Referenced by Init_Numeric().

static VALUE num_round | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | num
| ) |  | `[static]`

Definition at line 1545 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 217 of file numeric.c.

References Qnil, rb_eTypeError, rb_id2name(), rb_obj_classname(), rb_raise(), rb_remove_method_id(), rb_singleton_class(), and rb_to_id().

Referenced by Init_Numeric().

static VALUE num_step | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | from
| ) |  | `[static]`

Definition at line 1625 of file numeric.c.

References cmp, diff(), FALSE, FIX2LONG, FIXNUM_P, INT2FIX, LONG2FIX, rb_eArgError, rb_equal(), rb_funcall(), rb_raise(), rb_yield(), RETURN_ENUMERATOR, RTEST, and ruby_float_step().

Referenced by Init_Numeric().

static VALUE num_to_int | ( | VALUE | num | ) | `[static]`

Definition at line 523 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 1560 of file numeric.c.

References flo_truncate(), and rb_Float().

Referenced by Init_Numeric().

static VALUE num_uminus | ( | VALUE | num | ) | `[static]`

Definition at line 275 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 247 of file numeric.c.

Referenced by Init_Numeric().

static VALUE num_zero_p | ( | VALUE | num | ) | `[static]`

Definition at line 484 of file numeric.c.

References INT2FIX, Qfalse, Qtrue, and rb_equal().

Referenced by Init_Numeric().

VALUE rb_big_fdiv | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 2734 of file bignum.c.

References big2dbl(), big_fdiv(), DBL2NUM, FIX2LONG, isinf(), isnan, rb_big2dbl(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.

Referenced by fix_fdiv(), and Init_Bignum().

VALUE rb_dbl_cmp | ( | double | a,
|  | double | b
| ) |  |

Definition at line 998 of file numeric.c.

References INT2FIX, isnan, and Qnil.

Referenced by big_op(), fix_cmp(), flo_cmp(), and rb_big_cmp().

VALUE rb_enc_uint_chr | ( | unsigned int | code,
|  | rb_encoding * | enc
| ) |  |

Definition at line 2042 of file numeric.c.

References rb_enc_codelen(), rb_enc_mbcput, rb_enc_str_new(), rb_eRangeError, rb_raise(), and RSTRING_PTR.

Referenced by int_chr(), and rb_io_ungetc().

long rb_fix2int | ( | VALUE | val | ) |

Definition at line 1835 of file numeric.c.

References FIX2INT.

VALUE rb_fix2str | ( | VALUE | x,
|  | int | base
| ) |  |

Definition at line 2156 of file numeric.c.

References buf, 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().

static VALUE rb_fix_lshift | ( | VALUE | x,
|  | VALUE | y
| ) |  | `[static]`

Definition at line 2888 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 2920 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 | ( | double | d | ) |

Definition at line 539 of file numeric.c.

References NEWOBJ, OBJSETUP, rb_cFloat, and T_FLOAT.

Referenced by BigDecimal_to_f(), callback(), generic_to_value(), ole_variant2val(), random_rand(), tkstr_to_float(), and yaml_org_handler().

VALUE rb_num2fix | ( | VALUE | val | ) |

Definition at line 1842 of file numeric.c.

References FIXABLE, FIXNUM_P, LONG2FIX, PRIdVALUE, rb_eRangeError, rb_num2long(), and rb_raise().

long rb_num2int | ( | VALUE | val | ) |

Definition at line 1829 of file numeric.c.

References rb_num2long().

SIGNED_VALUE rb_num2long | ( | VALUE | val | ) |

Definition at line 1687 of file numeric.c.

References buf, FIX2LONG, FIXNUM_P, LONG_MAX, LONG_MIN, 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_num2fix(), and rb_num2int().

VALUE rb_num2ulong | ( | VALUE | val | ) |

Definition at line 1721 of file numeric.c.

References buf, FIX2LONG, FIXNUM_P, LONG_MAX, LONG_MIN, NIL_P, rb_big2ulong(), rb_eRangeError, rb_eTypeError, rb_raise(), rb_to_int(), RFLOAT_VALUE, snprintf, strchr(), T_BIGNUM, T_FLOAT, and TYPE.

VALUE rb_num_coerce_bin | ( | VALUE | x,
|  | VALUE | y,
|  | ID | func
| ) |  |

Definition at line 184 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_cmp | ( | VALUE | x,
|  | VALUE | y,
|  | ID | func
| ) |  |

Definition at line 191 of file numeric.c.

References do_coerce(), FALSE, Qnil, and rb_funcall().

Referenced by BigDecimalCmp(), fix_cmp(), flo_cmp(), nurat_cmp(), and rb_big_cmp().

VALUE rb_num_coerce_relop | ( | VALUE | x,
|  | VALUE | y,
|  | ID | func
| ) |  |

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

void rb_num_zerodiv | ( | void |  | ) |

Definition at line 111 of file numeric.c.

References rb_eZeroDivError, and rb_raise().

Referenced by bigdivrem(), fix_divide(), fixdivmod(), flodivmod(), num_div(), quo(), wdivmod(), and wquo().

VALUE rb_rational_reciprocal | ( | VALUE | x | ) |

Definition at line 1594 of file rational.c.

References CLASS_OF, f_rational_new_no_reduce2(), and get_dat1.

Referenced by fix_divide().

double round | ( | double | x | ) |

Definition at line 84 of file numeric.c.

Referenced by dbl2ival(), fix_pow(), flo_pow(), flo_round(), and rb_big_pow().

int ruby_float_step | ( | VALUE | from,
|  | VALUE | to,
|  | VALUE | step,
|  | int | excl
| ) |  |

Definition at line 1567 of file numeric.c.

References DBL2NUM, DBL_EPSILON, err, FALSE, isinf(), NUM2DBL, rb_yield(), T_FLOAT, TRUE, and TYPE.

Referenced by num_step(), and range_step().

## Variable Documentation

ID id_coerce`[static]`

Definition at line 100 of file numeric.c.

Referenced by coerce_body(), and Init_Numeric().

ID id_eq

Definition at line 100 of file numeric.c.

Referenced by eq(), Init_Numeric(), Init_Object(), Init_Time(), num_equal(), rb_equal(), rb_obj_not_equal(), and weq().

ID id_to_i

Definition at line 100 of file numeric.c.

VALUE rb_cFixnum

Definition at line 105 of file numeric.c.

VALUE rb_cFloat

Definition at line 103 of file numeric.c.

VALUE rb_cInteger

Definition at line 104 of file numeric.c.

VALUE rb_cNumeric

Definition at line 102 of file numeric.c.

VALUE rb_eFloatDomainError

Definition at line 108 of file numeric.c.

VALUE rb_eZeroDivError

Definition at line 107 of file numeric.c.

const unsigned char rb_infinity[] = "\x00\x00\x80\x7f"

Definition at line 68 of file numeric.c.

const unsigned char rb_nan[] = "\x00\x00\xc0\x7f"

Definition at line 75 of file numeric.c.