Ruby
2.0.0p247(2013-06-27revision41674)
|
#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.
Macros | |
#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 | 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 | 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) |
Variables | |
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 59 of file numeric.c.
Referenced by BigDecimal_add(), 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(), if(), Init_Numeric(), rb_cstr_to_dbl(), rmpd_double_figures(), and ruby_strtod().
#define DBL_EPSILON 2.2204460492503131e-16 |
Definition at line 65 of file numeric.c.
Referenced by Init_Numeric(), and ruby_float_step_size().
#define DBL_MANT_DIG 53 |
Definition at line 62 of file numeric.c.
Referenced by flo_to_s(), and Init_Numeric().
#define DBL_MAX 1.7976931348623157e+308 |
Definition at line 44 of file numeric.c.
Referenced by Init_Numeric().
#define DBL_MAX_10_EXP 308 |
Definition at line 56 of file numeric.c.
Referenced by BigDecimal_to_f(), Init_Numeric(), and ruby_strtod().
#define DBL_MAX_EXP 1024 |
Definition at line 50 of file numeric.c.
Referenced by big2dbl(), Init_Numeric(), ruby_hdtoa(), and ruby_strtod().
#define DBL_MIN 2.2250738585072014e-308 |
Definition at line 41 of file numeric.c.
Referenced by Init_Numeric().
#define DBL_MIN_10_EXP (-307) |
Definition at line 53 of file numeric.c.
Referenced by BigDecimal_to_f(), and Init_Numeric().
#define DBL_MIN_EXP (-1021) |
Definition at line 47 of file numeric.c.
Referenced by Init_Numeric().
#define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS) |
Referenced by rb_num_to_uint().
#define FIT_SQRT_LONG | ( | n | ) | (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX)) |
#define FLT_RADIX 2 |
Definition at line 35 of file numeric.c.
Referenced by float_rationalize(), float_to_r(), Init_Numeric(), and ruby_strtod().
#define FLT_ROUNDS 1 |
Definition at line 38 of file numeric.c.
Referenced by Init_Numeric().
#define LONG_MAX_PLUS_ONE (2*(double)(LONG_MAX/2+1)) |
Definition at line 1941 of file numeric.c.
Referenced by rb_num2long().
#define LONG_MIN_MINUS_ONE ((double)LONG_MIN-1) |
Definition at line 1940 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 154 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 1942 of file numeric.c.
Referenced by rb_num2ulong().
Referenced by check_ushort().
Definition at line 3188 of file numeric.c.
References do_coerce(), FALSE, FIXNUM_P, rb_eTypeError, rb_inspect(), rb_obj_classname(), rb_raise(), rb_special_const_p(), RB_TYPE_P, RSTRING_PTR, T_BIGNUM, and TRUE.
Referenced by fix_and(), fix_or(), fix_xor(), and rb_num_coerce_bit().
|
static |
Definition at line 2108 of file numeric.c.
References rb_out_of_short(), and SIGNED_VALUE.
Referenced by rb_fix2short(), and rb_num2short().
Definition at line 2116 of file numeric.c.
References PRIdVALUE, PRIuVALUE, rb_eRangeError, rb_raise(), and VALUE_MSBMASK.
Referenced by rb_fix2ushort(), and rb_num2ushort().
Definition at line 221 of file numeric.c.
References id_coerce, and rb_funcall().
Referenced by do_coerce().
Definition at line 227 of file numeric.c.
References Qnil, rb_eTypeError, rb_inspect(), rb_obj_classname(), rb_raise(), rb_special_const_p(), RSTRING_PTR, and v.
Referenced by do_coerce().
|
static |
Definition at line 944 of file numeric.c.
References FIXABLE, LONG2FIX, rb_dbl2big(), and round().
Referenced by fix_divmod(), flo_divmod(), and flo_round().
Definition at line 241 of file numeric.c.
References a, ary, 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().
Definition at line 3220 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().
Definition at line 3366 of file numeric.c.
References CHAR_BIT, FIX2LONG, FIXNUM_P, i, INT2FIX, rb_big_norm(), rb_to_int(), and RBIGNUM_SIGN.
Referenced by Init_Numeric().
Definition at line 3051 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().
Definition at line 2784 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().
Definition at line 2883 of file numeric.c.
References a, b, 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().
Definition at line 3025 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().
Definition at line 3675 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 2768 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().
Definition at line 3102 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().
Definition at line 3077 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().
Definition at line 2842 of file numeric.c.
References fix_divide(), and rb_intern.
Referenced by Init_Numeric().
Definition at line 3155 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 |
Definition at line 3306 of file numeric.c.
References CHAR_BIT, LONG2NUM, rb_big_lshift(), rb_int2big(), and ULONG2NUM.
Referenced by rb_fix_lshift(), and rb_fix_rshift().
Definition at line 3130 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().
Definition at line 2648 of file numeric.c.
References a, b, c, DBL2NUM, FIX2LONG, FIXNUM_P, LONG2NUM, r, rb_big_minus(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
Definition at line 2857 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().
Definition at line 2686 of file numeric.c.
References a, b, d, DBL2NUM, FIT_SQRT_LONG, FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, MUL_OVERFLOW_FIXNUM_P, r, rb_big_mul(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
Definition at line 3659 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 3243 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().
Definition at line 2615 of file numeric.c.
References a, b, c, DBL2NUM, FIX2LONG, FIXNUM_P, LONG2NUM, r, rb_big_plus(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
Definition at line 2959 of file numeric.c.
References a, b, 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 |
Definition at line 3339 of file numeric.c.
References CHAR_BIT, INT2FIX, and LONG2FIX.
Referenced by rb_fix_lshift(), and rb_fix_rshift().
Definition at line 2590 of file numeric.c.
References b, NUM2INT, rb_fix2str(), and rb_scan_args().
Referenced by Init_Numeric().
Definition at line 2540 of file numeric.c.
References FIX2LONG, and LONG2NUM.
Referenced by Init_Numeric().
Definition at line 3266 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 |
Definition at line 2729 of file numeric.c.
References div, mod, and rb_num_zerodiv().
Referenced by fix_divide(), fix_divmod(), and fix_mod().
Definition at line 1400 of file numeric.c.
References DBL2NUM, RFLOAT_VALUE, and val.
Referenced by Init_Numeric().
Definition at line 1533 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by Init_Numeric(), and num_ceil().
Definition at line 1144 of file numeric.c.
References a, b, FIX2INT, FIXNUM_P, i, 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().
Definition at line 739 of file numeric.c.
References rb_assoc_new(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 835 of file numeric.c.
References d, DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
Definition at line 964 of file numeric.c.
References a, b, 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().
Definition at line 1076 of file numeric.c.
References a, b, isnan, num_equal(), Qfalse, Qtrue, rb_integer_float_eq(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by Init_Numeric().
Definition at line 1507 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by Init_Numeric(), and num_floor().
Definition at line 1232 of file numeric.c.
References a, b, 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().
Definition at line 1190 of file numeric.c.
References a, b, 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().
Definition at line 1108 of file numeric.c.
References d, hash, LONG2FIX, rb_memhash(), and RFLOAT_VALUE.
Referenced by Init_Numeric().
Definition at line 1479 of file numeric.c.
References finite(), isinf(), isnan, Qfalse, Qtrue, RFLOAT_VALUE, and value.
Referenced by Init_Numeric().
Definition at line 1457 of file numeric.c.
References INT2FIX, isinf(), Qnil, RFLOAT_VALUE, and value.
Referenced by Init_Numeric().
Definition at line 1437 of file numeric.c.
References isnan, Qfalse, Qtrue, RFLOAT_VALUE, and value.
Referenced by Init_Numeric().
Definition at line 1315 of file numeric.c.
References a, b, 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().
Definition at line 1273 of file numeric.c.
References a, b, 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().
Definition at line 789 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().
Definition at line 923 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().
Definition at line 812 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().
Definition at line 766 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().
Definition at line 999 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().
Definition at line 1618 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().
Definition at line 1382 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 658 of file numeric.c.
References buf, CHAR_BIT, DBL_DIG, DBL_MANT_DIG, e, int, isinf(), isnan, len, memcpy(), memmove(), memset(), mode, p, ptr, 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(), s, value, and xfree.
Referenced by Init_Numeric().
Definition at line 1676 of file numeric.c.
References f, FIXABLE, LONG2FIX, rb_dbl2big(), RFLOAT_VALUE, and val.
Referenced by flo_round(), Init_Numeric(), and num_truncate().
Definition at line 752 of file numeric.c.
References DBL2NUM, and RFLOAT_VALUE.
Referenced by Init_Numeric().
Definition at line 1415 of file numeric.c.
References Qfalse, Qtrue, and RFLOAT_VALUE.
Referenced by Init_Numeric().
|
static |
Definition at line 868 of file numeric.c.
References div, isinf(), isnan, mod, and rb_num_zerodiv().
Referenced by fix_divmod(), flo_divmod(), and ruby_float_mod().
Definition at line 3716 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().
Definition at line 2451 of file numeric.c.
References c, enc, FIX2LONG, FIXNUM_P, i, 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().
Definition at line 3579 of file numeric.c.
References end, FIX2LONG, FIXNUM_P, i, INT2FIX, int_dotimes_size(), LONG2FIX, rb_funcall(), rb_yield(), RETURN_SIZED_ENUMERATOR, and RTEST.
Referenced by Init_Numeric().
Definition at line 3548 of file numeric.c.
References FIXNUM_P, INT2FIX, NUM2LONG, rb_funcall(), and RTEST.
Referenced by int_dotimes().
Definition at line 3524 of file numeric.c.
References c, end, FIX2LONG, FIXNUM_P, i, INT2FIX, int_downto_size(), LONG2FIX, NIL_P(), rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_SIZED_ENUMERATOR.
Referenced by Init_Numeric().
Definition at line 3500 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), and RARRAY_PTR().
Referenced by int_downto().
Definition at line 2349 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_funcall().
Referenced by fix_pow(), and Init_Numeric().
Definition at line 2333 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_funcall().
Referenced by Init_Numeric().
Definition at line 2508 of file numeric.c.
Referenced by Init_Numeric().
|
static |
Definition at line 2912 of file numeric.c.
References FIT_SQRT_LONG, LONG2NUM, MUL_OVERFLOW_FIXNUM_P, neg, rb_big_mul(), rb_big_pow(), rb_int2big(), and v.
Referenced by fix_pow(), and int_round_0().
Definition at line 2407 of file numeric.c.
References FIX2LONG, FIXNUM_P, i, INT2FIX, LONG2NUM, and rb_funcall().
Referenced by Init_Numeric().
Definition at line 3617 of file numeric.c.
References int_round_0(), n, NUM2INT, rb_Float(), and rb_scan_args().
Referenced by Init_Numeric().
Definition at line 1549 of file numeric.c.
References f, FIX2LONG, FIXNUM_P, INT2FIX, int_pow(), LONG2NUM, n, neg, negative_int_p(), r, rb_funcall(), rb_intern, RB_TYPE_P, RTEST, SIGNED_VALUE, and T_FLOAT.
Referenced by flo_round(), and int_round().
Definition at line 2387 of file numeric.c.
References FIX2LONG, FIXNUM_P, i, INT2FIX, LONG2NUM, and rb_funcall().
Referenced by Init_Numeric().
Definition at line 2307 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 3476 of file numeric.c.
References c, end, FIX2LONG, FIXNUM_P, i, INT2FIX, int_upto_size(), LONG2FIX, NIL_P(), rb_cmperr(), rb_funcall(), rb_yield(), and RETURN_SIZED_ENUMERATOR.
Referenced by Init_Numeric().
Definition at line 3453 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), and RARRAY_PTR().
Referenced by int_upto().
Definition at line 173 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().
Definition at line 556 of file numeric.c.
References negative_int_p(), rb_funcall(), and rb_intern.
Referenced by Init_Numeric().
Definition at line 1726 of file numeric.c.
References flo_ceil(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 1048 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 211 of file numeric.c.
References CLASS_OF, rb_assoc_new(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 415 of file numeric.c.
References INT2FIX, rb_equal(), rb_funcall(), rb_intern, and rb_num_zerodiv().
Referenced by Init_Numeric(), and num_divmod().
Definition at line 508 of file numeric.c.
References num_div(), num_modulo(), and rb_assoc_new().
Referenced by Init_Numeric().
Definition at line 1032 of file numeric.c.
References Qfalse, rb_equal(), and TYPE.
Referenced by Init_Numeric().
Definition at line 1055 of file numeric.c.
References id_eq, Qtrue, and rb_funcall().
Referenced by fix_equal(), and flo_eq().
Definition at line 394 of file numeric.c.
References rb_Float(), and rb_funcall().
Referenced by Init_Numeric().
Definition at line 1704 of file numeric.c.
References flo_floor(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 348 of file numeric.c.
References INT2FIX, and rb_complex_new().
Referenced by Init_Numeric().
Definition at line 318 of file numeric.c.
References rb_eTypeError, rb_obj_classname(), rb_raise(), and UNREACHABLE.
Referenced by Init_Numeric().
Definition at line 1814 of file numeric.c.
References cmp, DBL2NUM, diff(), FIX2LONG, FIXNUM_P, id_div, INT2FIX, isinf(), LONG2FIX, n, NUM2DBL, rb_funcall(), RB_TYPE_P, result, RTEST, ruby_float_step_size(), and T_FLOAT.
Referenced by int_downto_size(), int_upto_size(), num_step_size(), range_size(), and range_step_size().
Definition at line 435 of file numeric.c.
References rb_funcall(), and rb_intern.
Referenced by Init_Numeric(), and num_divmod().
Definition at line 595 of file numeric.c.
References Qnil, rb_funcall(), rb_intern, and RTEST.
Referenced by Init_Numeric().
Definition at line 380 of file numeric.c.
References rb_funcall(), and rb_rational_raw1.
Referenced by Init_Numeric().
Definition at line 452 of file numeric.c.
References INT2FIX, negative_int_p(), positive_int_p(), rb_equal(), and rb_funcall().
Referenced by Init_Numeric().
Definition at line 1742 of file numeric.c.
References flo_round(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 302 of file numeric.c.
References rb_eTypeError, rb_id2name(), rb_obj_classname(), rb_raise(), rb_remove_method_id(), rb_singleton_class(), rb_to_id(), and UNREACHABLE.
Referenced by Init_Numeric().
Definition at line 1883 of file numeric.c.
References cmp, diff(), end, FALSE, FIX2LONG, FIXNUM_P, i, 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().
Definition at line 1846 of file numeric.c.
References FALSE, INT2FIX, num_interval_step_size(), RARRAY_LEN, and RARRAY_PTR().
Referenced by num_step().
Definition at line 615 of file numeric.c.
References id_to_i, and rb_funcall().
Referenced by Init_Numeric().
Definition at line 1757 of file numeric.c.
References flo_truncate(), and rb_Float().
Referenced by Init_Numeric().
Definition at line 362 of file numeric.c.
References do_coerce(), INT2FIX, rb_funcall(), TRUE, and zero().
Referenced by Init_Numeric().
Definition at line 334 of file numeric.c.
Referenced by Init_Numeric().
Definition at line 573 of file numeric.c.
References INT2FIX, Qfalse, Qtrue, and rb_equal().
Referenced by Init_Numeric().
Definition at line 157 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 2417 of file numeric.c.
References n, 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, RSTRING_PTR, and str.
Referenced by int_chr(), and rb_io_ungetc().
short rb_fix2short | ( | VALUE | val | ) |
Definition at line 2143 of file numeric.c.
References check_short(), FIX2LONG, FIXNUM_P, and rb_num2long().
Definition at line 2546 of file numeric.c.
References b, buf, CHAR_BIT, FIX2LONG, int, neg, rb_eArgError, rb_raise(), rb_usascii_str_new2, ruby_digitmap, SIZEOF_VALUE, and val.
Referenced by fix_to_s(), ole_typedesc2val(), and rb_big2str0().
unsigned short rb_fix2ushort | ( | VALUE | val | ) |
Definition at line 2161 of file numeric.c.
References check_ushort(), FIX2ULONG, FIXNUM_P, negative_int_p(), and rb_num2ushort().
Definition at line 3292 of file numeric.c.
References FIX2LONG, fix_lshift(), fix_rshift(), FIXNUM_P, NUM2LONG, rb_big_lshift(), rb_int2big(), and val.
Referenced by Init_Numeric().
Definition at line 3324 of file numeric.c.
References FIX2LONG, fix_lshift(), fix_rshift(), FIXNUM_P, i, rb_big_rshift(), rb_int2big(), and val.
Referenced by Init_Numeric().
VALUE rb_float_new_in_heap | ( | double | d | ) |
Definition at line 638 of file numeric.c.
References d, NEWOBJ_OF, OBJ_FREEZE, rb_cFloat, and T_FLOAT.
Referenced by rb_float_new().
Definition at line 2175 of file numeric.c.
References FIXABLE, FIXNUM_P, LONG2FIX, PRIdVALUE, rb_eRangeError, rb_num2long(), rb_raise(), SIGNED_VALUE, v, and val.
long rb_num2int | ( | VALUE | val | ) |
Definition at line 2088 of file numeric.c.
References rb_num2long().
SIGNED_VALUE rb_num2long | ( | VALUE | val | ) |
Definition at line 1945 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, s, SIGNED_VALUE, snprintf, strchr(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by rb_fix2short(), rb_num2fix(), rb_num2int(), rb_num2long_inline(), and rb_num2short().
short rb_num2short | ( | VALUE | val | ) |
Definition at line 2134 of file numeric.c.
References check_short(), and rb_num2long().
Referenced by rb_num2short_inline().
Definition at line 1979 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, s, snprintf, strchr(), T_BIGNUM, T_FLOAT, TYPE, and ULONG_MAX_PLUS_ONE.
Referenced by rb_num2ulong_inline(), and rb_num2ushort().
unsigned short rb_num2ushort | ( | VALUE | val | ) |
Definition at line 2152 of file numeric.c.
References check_ushort(), negative_int_p(), and rb_num2ulong().
Referenced by rb_fix2ushort().
Definition at line 269 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().
Definition at line 3206 of file numeric.c.
References bit_coerce(), rb_funcall(), and TRUE.
Referenced by rb_big_and(), rb_big_or(), and rb_big_xor().
Definition at line 276 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().
Definition at line 284 of file numeric.c.
References c, 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().
Definition at line 189 of file numeric.c.
References negative_int_p().
Referenced by rb_random_ulong_limited().
Definition at line 122 of file numeric.c.
References DIGSPERLONG, FIX2LONG, FIXNUM_P, int, NUMERR_NEGATIVE, NUMERR_TOOLARGE, NUMERR_TYPE, rb_big2ulong(), RBIGNUM_LEN, RBIGNUM_NEGATIVE_P, T_BIGNUM, TYPE, v, and val.
Referenced by int_chr(), and rb_str_concat().
Definition at line 115 of file numeric.c.
References rb_eZeroDivError, and rb_raise().
Referenced by bigdivrem(), fix_divide(), fixdivmod(), flodivmod(), num_div(), quo(), rb_big_divide(), wdivmod(), and wquo().
void rb_out_of_short | ( | SIGNED_VALUE | num | ) |
Definition at line 2101 of file numeric.c.
References PRIdVALUE, rb_eRangeError, and rb_raise().
Referenced by check_short().
double round | ( | double | x | ) |
Definition at line 84 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 | ||
) |
Definition at line 1788 of file numeric.c.
References d, DBL2NUM, end, FALSE, i, isinf(), n, NUM2DBL, RB_TYPE_P, rb_yield(), ruby_float_step_size(), T_FLOAT, and TRUE.
Referenced by num_step(), and range_step().
|
static |
Definition at line 1763 of file numeric.c.
References DBL_EPSILON, end, err, isinf(), and n.
Referenced by num_interval_step_size(), and ruby_float_step().
|
static |
Definition at line 104 of file numeric.c.
Referenced by coerce_body(), do_coerce(), and Init_Numeric().
|
static |
Definition at line 104 of file numeric.c.
Referenced by Init_Numeric(), and num_interval_step_size().
|
static |
Definition at line 104 of file numeric.c.
Referenced by Init_Numeric(), and num_equal().
|
static |
Definition at line 104 of file numeric.c.
Referenced by Init_Numeric(), and num_to_int().