#include "ruby.h"
#include <math.h>
#include <ctype.h>
Go to the source code of this file.
Defines | |
| #define | BDIGITS(x) ((BDIGIT*)RBIGNUM(x)->digits) |
| #define | BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT) |
| #define | BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG) |
| #define | DIGSPERLONG ((unsigned int)(SIZEOF_LONG/SIZEOF_BDIGITS)) |
| #define | DIGSPERLL ((unsigned int)(SIZEOF_LONG_LONG/SIZEOF_BDIGITS)) |
| #define | BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG) |
| #define | BIGDN(x) RSHIFT(x,BITSPERDIG) |
| #define | BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1))) |
| #define | BDIGMAX ((BDIGIT)-1) |
| #define | BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0)) |
| #define | bignew(len, sign) bignew_1(rb_cBignum,len,sign) |
Functions | |
| VALUE | bignew_1 (VALUE klass, long len, int sign) |
| VALUE | rb_big_clone (VALUE x) |
| void | get2comp (VALUE x) |
| void | rb_big_2comp (VALUE x) |
| VALUE | bignorm (VALUE x) |
| VALUE | rb_big_norm (VALUE x) |
| VALUE | rb_uint2big (unsigned long n) |
| VALUE | rb_int2big (long n) |
| VALUE | rb_uint2inum (unsigned long n) |
| VALUE | rb_int2inum (long n) |
| void | rb_quad_pack (char *buf, VALUE val) |
| VALUE | rb_quad_unpack (char *buf, int sign) const |
| VALUE | rb_cstr_to_inum (char *str, int base, int badcheck) const |
| VALUE | rb_str_to_inum (VALUE str, int base, int badcheck) |
| VALUE | rb_ull2big (unsigned LONG_LONG n) |
| VALUE | rb_ll2big (LONG_LONG n) |
| VALUE | rb_ull2inum (unsigned LONG_LONG n) |
| VALUE | rb_ll2inum (LONG_LONG n) |
| VALUE | rb_cstr2inum (char *str, int base) const |
| VALUE | rb_str2inum (VALUE str, int base) |
| VALUE | rb_big2str (VALUE x, int base) |
| VALUE | rb_big_to_s (int argc, VALUE *argv, VALUE x) |
| unsigned long | big2ulong (VALUE x, char *type) |
| unsigned long | rb_big2ulong_pack (VALUE x) |
| unsigned long | rb_big2ulong (VALUE x) |
| long | rb_big2long (VALUE x) |
| unsigned LONG_LONG | big2ull (VALUE x, char *type) |
| unsigned LONG_LONG | rb_big2ull (VALUE x) |
| LONG_LONG | rb_big2ll (VALUE x) |
| VALUE | dbl2big (double d) |
| VALUE | rb_dbl2big (double d) |
| double | rb_big2dbl (VALUE x) |
| VALUE | rb_big_to_f (VALUE x) |
| VALUE | rb_big_cmp (VALUE x, VALUE y) |
| VALUE | rb_big_eq (VALUE x, VALUE y) |
| VALUE | rb_big_eql (VALUE x, VALUE y) |
| VALUE | rb_big_uminus (VALUE x) |
| VALUE | rb_big_neg (VALUE x) |
| VALUE | bigsub (VALUE x, VALUE y) |
| VALUE | bigadd (VALUE x, VALUE y, int sign) |
| VALUE | rb_big_plus (VALUE x, VALUE y) |
| VALUE | rb_big_minus (VALUE x, VALUE y) |
| VALUE | rb_big_mul (VALUE x, VALUE y) |
| void | bigdivrem (VALUE x, VALUE y, VALUE *divp, VALUE *modp) |
| void | bigdivmod (VALUE x, VALUE y, VALUE *divp, VALUE *modp) |
| VALUE | rb_big_div (VALUE x, VALUE y) |
| VALUE | rb_big_modulo (VALUE x, VALUE y) |
| VALUE | rb_big_remainder (VALUE x, VALUE y) |
| VALUE | rb_big_divmod (VALUE x, VALUE y) |
| VALUE | rb_big_quo (VALUE x, VALUE y) |
| VALUE | rb_big_pow (VALUE x, VALUE y) |
| VALUE | rb_big_and (VALUE xx, VALUE yy) |
| VALUE | rb_big_or (VALUE xx, VALUE yy) |
| VALUE | rb_big_xor (VALUE xx, VALUE yy) |
| VALUE | rb_big_rshift (VALUE, VALUE) |
| VALUE | rb_big_lshift (VALUE x, VALUE y) |
| VALUE | rb_big_aref (VALUE x, VALUE y) |
| VALUE | rb_big_hash (VALUE x) |
| VALUE | rb_big_coerce (VALUE x, VALUE y) |
| VALUE | rb_big_abs (VALUE x) |
| VALUE | rb_big_rand (VALUE max, double *rand_buf) |
| VALUE | rb_big_size (VALUE big) |
| void | Init_Bignum () |
Variables | |
| VALUE | rb_cBignum |
| const char | ruby_digitmap [] = "0123456789abcdefghijklmnopqrstuvwxyz" |
|
|
Definition at line 27 of file bignum.c. Referenced by big2ull(), big2ulong(), bigadd(), bigdivrem(), bignorm(), bigsub(), dbl2big(), get2comp(), rb_big2dbl(), rb_big2str(), rb_big_and(), rb_big_aref(), rb_big_clone(), rb_big_cmp(), rb_big_eq(), rb_big_eql(), rb_big_hash(), rb_big_lshift(), rb_big_mul(), rb_big_neg(), rb_big_or(), rb_big_rand(), rb_big_rshift(), rb_big_xor(), rb_cstr_to_inum(), rb_quad_pack(), rb_quad_unpack(), rb_uint2big(), and rb_ull2big(). |
|
|
|
|
|
Definition at line 35 of file bignum.c. Referenced by bigadd(), bigdivrem(), bigsub(), get2comp(), rb_big_lshift(), rb_big_mul(), rb_cstr_to_inum(), rb_quad_unpack(), rb_uint2big(), and rb_ull2big(). |
|
|
Definition at line 36 of file bignum.c. Referenced by bigadd(), bigdivrem(), bigsub(), get2comp(), rb_big_lshift(), rb_big_mul(), rb_big_rshift(), rb_cstr_to_inum(), rb_quad_unpack(), rb_uint2big(), and rb_ull2big(). |
|
|
Definition at line 56 of file bignum.c. Referenced by bigadd(), bigdivrem(), bigsub(), dbl2big(), rb_big_and(), rb_big_lshift(), rb_big_mul(), rb_big_or(), rb_big_rand(), rb_big_rshift(), rb_big_xor(), rb_cstr_to_inum(), rb_quad_unpack(), rb_uint2big(), and rb_ull2big(). |
|
|
Definition at line 29 of file bignum.c. Referenced by bigdivrem(), dbl2big(), rb_big2dbl(), and rb_big_or(). |
|
|
Definition at line 34 of file bignum.c. Referenced by big2ull(), big2ulong(), bigdivrem(), bignorm(), rb_big2str(), rb_big_rshift(), and rb_quad_pack(). |
|
|
Definition at line 39 of file bignum.c. Referenced by bigdivmod(), bigdivrem(), rb_big2str(), and rb_big_rand(). |
|
|
Definition at line 28 of file bignum.c. Referenced by bigdivrem(), rb_big_aref(), rb_big_lshift(), rb_big_rshift(), and rb_cstr_to_inum(). |
|
|
Definition at line 32 of file bignum.c. Referenced by rb_quad_unpack(), and rb_ull2big(). |
|
|
Definition at line 30 of file bignum.c. Referenced by rb_uint2big(). |
|
||||||||||||
|
Definition at line 791 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGUP, rb_eRangeError, rb_raise(), RBIGNUM, SIZEOF_BDIGITS, SIZEOF_LONG_LONG, and VALUE. Referenced by rb_big2ll(), and rb_big2ull(). |
|
||||||||||||
|
Definition at line 730 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGUP, rb_eRangeError, rb_raise(), RBIGNUM, SIZEOF_BDIGITS, SIZEOF_LONG, and VALUE. Referenced by rb_big2long(), rb_big2ulong(), and rb_big2ulong_pack(). |
|
||||||||||||||||
|
Definition at line 1113 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bigsub(), RBIGNUM, and VALUE. Referenced by bigdivmod(), rb_big_minus(), and rb_big_plus(). |
|
||||||||||||||||||||
|
Definition at line 1394 of file bignum.c. References bigadd(), bigdivrem(), BIGZEROP, rb_int2big(), RBIGNUM, and VALUE. Referenced by rb_big_div(), rb_big_divmod(), and rb_big_modulo(). |
|
||||||||||||||||||||
|
Definition at line 1264 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BDIGITS, BIGDN, BIGLO, bignew, BIGRAD, BIGUP, BIGZEROP, BITSPERDIG, rb_big_clone(), rb_int2big(), rb_num_zerodiv(), rb_uint2big(), RBIGNUM, and VALUE. Referenced by bigdivmod(), and rb_big_remainder(). |
|
||||||||||||||||
|
Definition at line 42 of file bignum.c. References ALLOC_N, BDIGIT, NEWOBJ, OBJSETUP, T_BIGNUM, and VALUE. Referenced by rb_big_clone(). |
|
|
Definition at line 99 of file bignum.c. References BDIGIT, BDIGITS, BIGUP, FIXNUM_P, LONG2FIX, NEGFIXABLE, POSFIXABLE, RBIGNUM, SIZEOF_BDIGITS, and VALUE. Referenced by rb_big_and(), rb_big_div(), rb_big_divmod(), rb_big_lshift(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_neg(), rb_big_norm(), rb_big_or(), rb_big_plus(), rb_big_pow(), rb_big_remainder(), rb_big_rshift(), rb_big_uminus(), rb_big_xor(), rb_cstr_to_inum(), rb_dbl2big(), and rb_quad_unpack(). |
|
||||||||||||
|
Definition at line 1066 of file bignum.c. References BDIGIT, BDIGIT_DBL_SIGNED, BDIGITS, BIGDN, BIGLO, bignew, RBIGNUM, and VALUE. Referenced by bigadd(). |
|
|
Definition at line 837 of file bignum.c. References BDIGIT, BDIGITS, bignew, BIGRAD, isinf(), isnan(), POSFIXABLE, rb_eFloatDomainError, rb_raise(), and VALUE. Referenced by rb_dbl2big(). |
|
|
Definition at line 70 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, RBIGNUM, REALLOC_N, and VALUE. Referenced by rb_big_2comp(), rb_big_and(), rb_big_aref(), rb_big_neg(), rb_big_or(), rb_big_rshift(), and rb_big_xor(). |
|
|
Definition at line 2063 of file bignum.c. References rb_big_abs(), rb_big_and(), rb_big_aref(), rb_big_cmp(), rb_big_coerce(), rb_big_div(), rb_big_divmod(), rb_big_eq(), rb_big_eql(), rb_big_hash(), rb_big_lshift(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_neg(), rb_big_or(), rb_big_plus(), rb_big_pow(), rb_big_quo(), rb_big_remainder(), rb_big_rshift(), rb_big_size(), rb_big_to_f(), rb_big_to_s(), rb_big_uminus(), rb_big_xor(), rb_cBignum, rb_cInteger, rb_define_class(), and rb_define_method(). Referenced by rb_call_inits(). |
|
|
Definition at line 821 of file bignum.c. References big2ull(), LLONG_MIN, rb_eRangeError, rb_raise(), RBIGNUM, and VALUE. Referenced by rb_num2ll(). |
|
|
Definition at line 811 of file bignum.c. References big2ull(), RBIGNUM, and VALUE. Referenced by rb_num2ull(). |
|
|
Definition at line 750 of file bignum.c. References big2ulong(), RBIGNUM, and VALUE. Referenced by num2i32(). |
|
|
Definition at line 1994 of file bignum.c. References rb_big_clone(), RBIGNUM, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1910 of file bignum.c. References BDIGIT, BDIGITS, BITSPERDIG, get2comp(), INT2FIX, NUM2INT, rb_big_clone(), RBIGNUM, T_BIGNUM, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 922 of file bignum.c. References BDIGITS, FIX2LONG, INT2FIX, rb_big2dbl(), rb_dbl_cmp(), rb_int2big(), rb_num_coerce_cmp(), RBIGNUM, RFLOAT, T_BIGNUM, T_FIXNUM, T_FLOAT, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1967 of file bignum.c. References FIX2LONG, FIXNUM_P, Qnil, rb_assoc_new(), rb_eTypeError, rb_int2big(), rb_obj_classname(), rb_raise(), T_BIGNUM, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1420 of file bignum.c. References bigdivmod(), bignorm(), FIX2LONG, rb_big2dbl(), rb_float_new(), rb_int2big(), rb_num_coerce_bin(), RFLOAT, T_BIGNUM, T_FIXNUM, T_FLOAT, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 968 of file bignum.c. References BDIGIT, BDIGITS, FIX2LONG, isnan(), MEMCMP, Qfalse, Qtrue, rb_big2dbl(), rb_equal(), rb_int2big(), RBIGNUM, RFLOAT, T_BIGNUM, T_FIXNUM, T_FLOAT, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1007 of file bignum.c. References BDIGIT, BDIGITS, MEMCMP, Qfalse, Qtrue, RBIGNUM, T_BIGNUM, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
|
Definition at line 1949 of file bignum.c. References BDIGIT, BDIGITS, LONG2FIX, RBIGNUM, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1454 of file bignum.c. References bigdivmod(), bignorm(), FIX2LONG, rb_int2big(), rb_num_coerce_bin(), T_BIGNUM, T_FIXNUM, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
|
Definition at line 1048 of file bignum.c. References BDIGIT, BDIGITS, bignorm(), get2comp(), rb_big_clone(), RBIGNUM, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1548 of file bignum.c. References FIX2LONG, rb_big2dbl(), rb_float_new(), rb_num_coerce_bin(), RFLOAT, T_BIGNUM, T_FIXNUM, T_FLOAT, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1485 of file bignum.c. References bigdivrem(), bignorm(), FIX2LONG, rb_int2big(), rb_num_coerce_bin(), T_BIGNUM, T_FIXNUM, TYPE, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 1848 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGLO, bignew, bignorm(), BIGUP, BITSPERDIG, get2comp(), INT2FIX, NUM2INT, rb_big_clone(), rb_big_lshift(), RBIGNUM, and VALUE. Referenced by Init_Bignum(), and rb_big_lshift(). |
|
|
Definition at line 2038 of file bignum.c. References LONG2FIX, RBIGNUM, SIZEOF_BDIGITS, and VALUE. Referenced by Init_Bignum(). |
|
|
Definition at line 905 of file bignum.c. References rb_big2dbl(), rb_float_new(), and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||||||
|
Definition at line 715 of file bignum.c. References NUM2INT, rb_big2str(), rb_scan_args(), and VALUE. Referenced by Init_Bignum(). |
|
|
Definition at line 1025 of file bignum.c. References bignorm(), rb_big_clone(), RBIGNUM, and VALUE. Referenced by Init_Bignum(). |
|
||||||||||||
|
Definition at line 600 of file bignum.c. References rb_cstr_to_inum(). |
|
||||||||||||||||
|
Definition at line 316 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), BITSPERDIG, CHAR_BIT, end, INT2FIX, ISASCII, ISSPACE, LONG2FIX, POSFIXABLE, rb_eArgError, rb_invalid_str(), rb_raise(), rb_uint2big(), RBIGNUM, strtoul(), and VALUE. |
|
|
Definition at line 564 of file bignum.c. References rb_ull2big(), RBIGNUM, and VALUE. Referenced by rb_ll2inum(). |
|
||||||||||||
|
Definition at line 219 of file bignum.c. References BDIGIT, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), DIGSPERLL, FIXABLE, LONG2FIX, POSFIXABLE, RBIGNUM, SIZEOF_LONG_LONG, and VALUE. |
|
|
Definition at line 542 of file bignum.c. References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, DIGSPERLL, RBIGNUM, and VALUE. Referenced by rb_ll2big(), and rb_ull2inum(). |
|
|
Definition at line 21 of file bignum.c. Referenced by Init_Bignum(), r_object0(), and random_seed(). |
|
|
Definition at line 615 of file bignum.c. Referenced by rb_big2str(), and rb_fix2str(). |
1.3.5