public class RubyBignum extends RubyInteger
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeExceptionRubyObject.DataRubyBasicObject.Finalizer| Modifier and Type | Field and Description |
|---|---|
private static int |
BIT_SIZE |
static java.math.BigInteger |
LONG_MAX |
static java.math.BigInteger |
LONG_MIN |
private static long |
MAX |
static java.math.BigInteger |
ULONG_MAX |
private java.math.BigInteger |
value |
SINGLE_CHAR_BYTELISTS, SINGLE_CHAR_BYTELISTS19DBL_EPSILON, NUMERIC_ALLOCATORFIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, VAR_TABLE_OFFSET, varTable, varTableStampNULL_ARRAY| Constructor and Description |
|---|
RubyBignum(Ruby runtime,
java.math.BigInteger value) |
| Modifier and Type | Method and Description |
|---|---|
IRubyObject |
abs()
rb_big_abs
|
private IRubyObject |
addBignum(java.math.BigInteger other) |
private IRubyObject |
addFixnum(long other) |
private IRubyObject |
addFloat(RubyFloat other) |
private IRubyObject |
addOther(ThreadContext context,
IRubyObject other) |
static double |
big2dbl(RubyBignum value)
rb_big2dbl
|
static long |
big2long(RubyBignum value)
rb_big2long
|
static long |
big2ulong(RubyBignum value)
rb_big2ulong
This is here because for C extensions ulong can hold different values without throwing a RangeError
|
static RubyInteger |
bignorm(Ruby runtime,
java.math.BigInteger bi)
rb_big_norm
|
private IRubyObject |
checkShiftDown(RubyBignum other) |
IRubyObject |
coerce(IRubyObject other)
rb_big_coerce
|
int |
compareTo(IRubyObject other)
Compares this Ruby object with another.
|
(package private) static double |
convertToDouble(java.math.BigInteger bigint)
BigInteger#doubleValue is _really_ slow currently.
|
private IRubyObject |
convertToInteger(ThreadContext context,
IRubyObject other) |
static RubyClass |
createBignumClass(Ruby runtime) |
IRubyObject |
divmod(ThreadContext context,
IRubyObject other)
rb_big_divmod
|
IRubyObject |
divmod19(ThreadContext context,
IRubyObject other)
num_divmod
|
IRubyObject |
eql_p(IRubyObject other)
rb_big_eql
|
IRubyObject |
eql_p19(IRubyObject other)
In ruby 1.9, '==' and '===' are the same, but they differ from 'eql?'.
|
static java.math.BigInteger |
fix2big(RubyFixnum arg)
rb_int2big
|
java.math.BigInteger |
getBigIntegerValue() |
double |
getDoubleValue() |
java.lang.Class<?> |
getJavaClass()
Will return the Java interface that most closely can represent
this object, when working through JAva integration
translations.
|
long |
getLongValue() |
int |
getNativeTypeIndex()
This is overridden in the other concrete Java builtins to provide a fast way
to determine what type they are.
|
java.math.BigInteger |
getValue()
Getter for property value.
|
RubyFixnum |
hash()
rb_big_hash
|
static java.math.BigInteger |
long2big(long arg) |
static void |
marshalTo(RubyBignum bignum,
MarshalStream output) |
static RubyBignum |
newBignum(Ruby runtime,
java.math.BigInteger value) |
static RubyBignum |
newBignum(Ruby runtime,
double value) |
static RubyBignum |
newBignum(Ruby runtime,
long value) |
static RubyBignum |
newBignum(Ruby runtime,
java.lang.String value) |
IRubyObject |
op_and(ThreadContext context,
IRubyObject other)
rb_big_and
|
IRubyObject |
op_and19(ThreadContext context,
IRubyObject other) |
RubyFixnum |
op_aref(IRubyObject other)
rb_big_aref
|
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other)
rb_big_cmp
|
IRubyObject |
op_div(ThreadContext context,
IRubyObject other)
rb_big_div
|
private IRubyObject |
op_divide(ThreadContext context,
IRubyObject other,
boolean slash)
rb_big_divide.
|
IRubyObject |
op_equal(IRubyObject other)
rb_big_eq
|
IRubyObject |
op_idiv(ThreadContext context,
IRubyObject other)
rb_big_idiv
|
IRubyObject |
op_lshift(IRubyObject other)
rb_big_lshift
|
IRubyObject |
op_minus(ThreadContext context,
IRubyObject other)
rb_big_minus
|
IRubyObject |
op_minus(ThreadContext context,
long other) |
IRubyObject |
op_mod(ThreadContext context,
IRubyObject other)
rb_big_modulo
|
IRubyObject |
op_mod19(ThreadContext context,
IRubyObject other)
rb_big_modulo
|
IRubyObject |
op_mul(ThreadContext context,
IRubyObject other)
rb_big_mul
|
IRubyObject |
op_mul(ThreadContext context,
long other) |
IRubyObject |
op_mul19(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_neg()
rb_big_neg
|
IRubyObject |
op_or(ThreadContext context,
IRubyObject other)
rb_big_or
|
IRubyObject |
op_or19(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_plus(ThreadContext context,
IRubyObject other)
rb_big_plus
|
IRubyObject |
op_plus(ThreadContext context,
long other) |
IRubyObject |
op_pow(ThreadContext context,
IRubyObject other)
rb_big_pow
|
IRubyObject |
op_pow(ThreadContext context,
long other) |
IRubyObject |
op_pow19(ThreadContext context,
IRubyObject other)
rb_big_pow
|
IRubyObject |
op_rshift(IRubyObject other)
rb_big_rshift
|
IRubyObject |
op_uminus()
rb_big_uminus
|
IRubyObject |
op_xor(ThreadContext context,
IRubyObject other)
rb_big_xor
|
IRubyObject |
op_xor19(ThreadContext context,
IRubyObject other) |
IRubyObject |
opMulOther(ThreadContext context,
IRubyObject other) |
IRubyObject |
quo(ThreadContext context,
IRubyObject other)
rb_big_quo
|
IRubyObject |
quo19(ThreadContext context,
IRubyObject other) |
IRubyObject |
remainder(ThreadContext context,
IRubyObject other)
rb_big_remainder
|
IRubyObject |
remainder19(ThreadContext context,
IRubyObject other) |
IRubyObject |
size()
rb_big_size
|
private IRubyObject |
subtractBignum(java.math.BigInteger other) |
private IRubyObject |
subtractFixnum(long other) |
private IRubyObject |
subtractFloat(RubyFloat other) |
private IRubyObject |
subtractOther(ThreadContext context,
IRubyObject other) |
IRubyObject |
to_f()
rb_big_to_f
|
IRubyObject |
to_s()
rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj.
|
IRubyObject |
to_s(IRubyObject arg0) |
IRubyObject |
to_s(IRubyObject[] args)
rb_big_to_s
|
static RubyNumeric |
unmarshalFrom(UnmarshalStream input) |
private void |
warnIfPowExponentTooBig(ThreadContext context,
double other) |
chr, chr19, chr19, convertToInteger, createIntegerClass, denominator, downto, even_p, gcd, gcdlcm, induced_from, integer_p, lcm, numerator, odd_p, ord, pred, rationalize, round, round19, round19, succ, times, to_i, to_r, toFloat, uptoabs, abs2, arg, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerceBin, coerceBody, coerceCmp, coerceRelOp, conjugate, createNumericClass, dbl_cmp, dbl2num, div, div19, doCoerce, eql_p, fdiv, fix2int, fix2int, fix2long, floatStep, floatStep19, floor, getCoerced, image, initialize_copy, int2fix, magnitude, modulo, modulo19, newNumeric, nonzero_p, num_imaginary, num2chr, num2dbl, num2fix, num2int, num2long, op_cmp, op_num_equal, op_uminus, op_uplus, polar, quo_19, real, rect, sadded, scalar_p, step, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava, truncate, zero_pattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, equals, hashCode, initialize, initialize, inspect, op_eqq, puts, specificEval, toStringaddFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMetaClass, getNativeHandle, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, infectBy, infectBy, initialize19, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_equal_19, op_equal, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, recacheBuiltinMethods, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderprivate static final int BIT_SIZE
private static final long MAX
public static final java.math.BigInteger LONG_MAX
public static final java.math.BigInteger LONG_MIN
public static final java.math.BigInteger ULONG_MAX
private final java.math.BigInteger value
public RubyBignum(Ruby runtime, java.math.BigInteger value)
public int getNativeTypeIndex()
RubyObjectgetNativeTypeIndex in interface CoreObjectTypegetNativeTypeIndex in class RubyObjectClassIndexpublic java.lang.Class<?> getJavaClass()
RubyBasicObjectgetJavaClass in interface IRubyObjectgetJavaClass in class RubyBasicObjectpublic static RubyBignum newBignum(Ruby runtime, long value)
public static RubyBignum newBignum(Ruby runtime, double value)
public static RubyBignum newBignum(Ruby runtime, java.math.BigInteger value)
public static RubyBignum newBignum(Ruby runtime, java.lang.String value)
public double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
getLongValue in class RubyNumericpublic java.math.BigInteger getBigIntegerValue()
getBigIntegerValue in class RubyNumericpublic java.math.BigInteger getValue()
public static RubyInteger bignorm(Ruby runtime, java.math.BigInteger bi)
public static long big2long(RubyBignum value)
public static long big2ulong(RubyBignum value)
public static double big2dbl(RubyBignum value)
private IRubyObject checkShiftDown(RubyBignum other)
static double convertToDouble(java.math.BigInteger bigint)
public static java.math.BigInteger fix2big(RubyFixnum arg)
public static java.math.BigInteger long2big(long arg)
public IRubyObject to_s(IRubyObject[] args)
public IRubyObject to_s()
RubyBasicObjectto_s prints the object's class and an encoding of the
object id. As a special case, the top-level object that is the
initial execution context of Ruby programs returns ``main.''to_s in class RubyBasicObjectpublic IRubyObject to_s(IRubyObject arg0)
public IRubyObject coerce(IRubyObject other)
coerce in class RubyNumericpublic IRubyObject op_uminus()
public IRubyObject op_plus(ThreadContext context, IRubyObject other)
public IRubyObject op_plus(ThreadContext context, long other)
private IRubyObject addFixnum(long other)
private IRubyObject addBignum(java.math.BigInteger other)
private IRubyObject addFloat(RubyFloat other)
private IRubyObject addOther(ThreadContext context, IRubyObject other)
public IRubyObject op_minus(ThreadContext context, IRubyObject other)
public IRubyObject op_minus(ThreadContext context, long other)
private IRubyObject subtractFixnum(long other)
private IRubyObject subtractBignum(java.math.BigInteger other)
private IRubyObject subtractFloat(RubyFloat other)
private IRubyObject subtractOther(ThreadContext context, IRubyObject other)
public IRubyObject op_mul(ThreadContext context, IRubyObject other)
public IRubyObject op_mul19(ThreadContext context, IRubyObject other)
public IRubyObject op_mul(ThreadContext context, long other)
public IRubyObject opMulOther(ThreadContext context, IRubyObject other)
private IRubyObject op_divide(ThreadContext context, IRubyObject other, boolean slash)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_idiv(ThreadContext context, IRubyObject other)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod in class RubyNumericpublic IRubyObject divmod19(ThreadContext context, IRubyObject other)
RubyNumericdivmod19 in class RubyNumericpublic IRubyObject op_mod(ThreadContext context, IRubyObject other)
public IRubyObject op_mod19(ThreadContext context, IRubyObject other)
public IRubyObject remainder(ThreadContext context, IRubyObject other)
remainder in class RubyNumericpublic IRubyObject remainder19(ThreadContext context, IRubyObject other)
public IRubyObject quo(ThreadContext context, IRubyObject other)
quo in class RubyNumericpublic IRubyObject quo19(ThreadContext context, IRubyObject other)
public IRubyObject op_pow(ThreadContext context, IRubyObject other)
public IRubyObject op_pow(ThreadContext context, long other)
private void warnIfPowExponentTooBig(ThreadContext context, double other)
public IRubyObject op_pow19(ThreadContext context, IRubyObject other)
public IRubyObject op_and(ThreadContext context, IRubyObject other)
public IRubyObject op_and19(ThreadContext context, IRubyObject other)
public IRubyObject op_or(ThreadContext context, IRubyObject other)
public IRubyObject op_or19(ThreadContext context, IRubyObject other)
public IRubyObject op_xor(ThreadContext context, IRubyObject other)
public IRubyObject op_xor19(ThreadContext context, IRubyObject other)
private IRubyObject convertToInteger(ThreadContext context, IRubyObject other)
public IRubyObject op_neg()
public IRubyObject op_lshift(IRubyObject other)
public IRubyObject op_rshift(IRubyObject other)
public RubyFixnum op_aref(IRubyObject other)
public final int compareTo(IRubyObject other)
RubyBasicObjectcompareTo in interface java.lang.Comparable<IRubyObject>compareTo in class RubyBasicObjectother - another IRubyObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp in class RubyBasicObjectpublic IRubyObject op_equal(IRubyObject other)
public IRubyObject eql_p(IRubyObject other)
eql_p in class RubyBasicObjectpublic IRubyObject eql_p19(IRubyObject other)
public RubyFixnum hash()
hash in class RubyBasicObjectpublic IRubyObject to_f()
public IRubyObject abs()
public IRubyObject size()
public static void marshalTo(RubyBignum bignum, MarshalStream output) throws java.io.IOException
java.io.IOExceptionpublic static RubyNumeric unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOException