public class RubyBignum extends RubyInteger
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException
RubyObject.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
static java.math.BigInteger |
LONG_MAX |
static java.math.BigInteger |
LONG_MIN |
static java.math.BigInteger |
ULONG_MAX |
SINGLE_CHAR_BYTELISTS19
DBL_EPSILON, NUMERIC_ALLOCATOR
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
NULL_ARRAY
Constructor and Description |
---|
RubyBignum(Ruby runtime,
java.math.BigInteger value) |
Modifier and Type | Method and Description |
---|---|
IRubyObject |
abs()
Deprecated.
|
IRubyObject |
abs(ThreadContext context)
rb_big_abs
|
static double |
big2dbl(RubyBignum val)
rb_big2dbl
|
static long |
big2long(RubyBignum val)
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
|
IRubyObject |
bit_length(ThreadContext context) |
IRubyObject |
ceil(ThreadContext context,
IRubyObject arg)
rb_big_ceil
|
IRubyObject |
coerce(IRubyObject other)
rb_big_coerce
|
int |
compareTo(IRubyObject other)
Compares this Ruby object with another.
|
RubyRational |
convertToRational() |
static RubyClass |
createBignumClass(Ruby runtime) |
IRubyObject |
denominator(ThreadContext context)
numeric_denominator
|
RubyArray |
digits(ThreadContext context,
IRubyObject base)
rb_big_digits
|
IRubyObject |
divmod(ThreadContext context,
IRubyObject other)
rb_big_divmod
|
IRubyObject |
eql_p(IRubyObject other)
rb_big_eql
|
IRubyObject |
eql_p19(IRubyObject other)
Deprecated.
|
boolean |
equals(java.lang.Object other)
This override does not do a "checked" dispatch.
|
RubyBoolean |
even_p(ThreadContext context) |
IRubyObject |
fdivDouble(ThreadContext context,
IRubyObject y) |
IRubyObject |
fdivFloat(ThreadContext context,
RubyFloat y) |
IRubyObject |
fdivInt(ThreadContext context,
RubyBignum y) |
static java.math.BigInteger |
fix2big(RubyFixnum arg)
rb_int2big
|
IRubyObject |
floor(ThreadContext context,
IRubyObject arg)
rb_big_floor
|
java.math.BigInteger |
getBigIntegerValue() |
double |
getDoubleValue() |
int |
getIntValue()
Return the value of this numeric as a 32-bit long.
|
java.lang.Class<?> |
getJavaClass()
Will return the Java interface that most closely can represent
this object, when working through Java integration translations.
|
long |
getLongValue()
Return the value of this numeric as a 64-bit long.
|
ClassIndex |
getNativeClassIndex()
This is overridden in the other concrete Java builtins to provide a fast way
to determine what type they are.
|
RubyClass |
getSingletonClass()
rb_singleton_class
Note: this method is specialized for RubyFixnum, RubySymbol,
RubyNil and RubyBoolean
Will either return the existing singleton class for this
object, or create a new one and return that.
|
java.math.BigInteger |
getValue()
Getter for property value.
|
RubyFixnum |
hash()
rb_big_hash
|
int |
hashCode()
This override does not do "checked" dispatch since Object usually has #hash defined.
|
IRubyObject |
idiv(ThreadContext context,
IRubyObject other)
rb_big_idiv
|
IRubyObject |
idiv(ThreadContext context,
long other) |
protected boolean |
int_round_zero_p(ThreadContext context,
int ndigits) |
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?).
|
IRubyObject |
isNegative(ThreadContext context)
num_negative_p
|
IRubyObject |
isPositive(ThreadContext context)
num_positive_p
|
boolean |
isZero() |
static java.math.BigInteger |
long2big(long arg) |
static void |
marshalTo(RubyBignum bignum,
MarshalStream output) |
IRubyObject |
modulo(ThreadContext context,
IRubyObject other)
num_modulo
|
RubyInteger |
negate() |
static RubyInteger |
newBignorm(Ruby runtime,
double value)
Return a Bignum or Fixnum (Integer) for the given value, or raise FloatDomainError if it is out of range.
|
static RubyBignum |
newBignum(Ruby runtime,
java.math.BigInteger value) |
static RubyBignum |
newBignum(Ruby runtime,
double value)
Return a Bignum for the given value, or raise FloatDomainError if it is out of range.
|
static RubyBignum |
newBignum(Ruby runtime,
long value) |
static RubyBignum |
newBignum(Ruby runtime,
java.lang.String value) |
IRubyObject |
nonzero_p(ThreadContext context)
num_nonzero_p
|
IRubyObject |
numerator(ThreadContext context)
numeric_numerator
|
RubyBoolean |
odd_p(ThreadContext context) |
IRubyObject |
op_and(ThreadContext context,
IRubyObject other)
rb_big_and
|
IRubyObject |
op_and19(ThreadContext context,
IRubyObject other)
Deprecated.
|
RubyFixnum |
op_aref(ThreadContext context,
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
|
IRubyObject |
op_div(ThreadContext context,
long other) |
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
rb_big_eq
|
IRubyObject |
op_lshift(ThreadContext context,
IRubyObject other)
rb_big_lshift
|
RubyInteger |
op_lshift(ThreadContext context,
long shift) |
IRubyObject |
op_minus(ThreadContext context,
java.math.BigInteger other) |
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_mod(ThreadContext context,
long other) |
IRubyObject |
op_mod19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
op_mul(ThreadContext context,
IRubyObject other)
rb_big_mul
|
IRubyObject |
op_mul(ThreadContext context,
long other) |
IRubyObject |
op_mul19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
op_neg(ThreadContext context)
rb_big_neg
|
IRubyObject |
op_or(ThreadContext context,
IRubyObject other)
rb_big_or
|
IRubyObject |
op_or19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
op_plus(ThreadContext context,
java.math.BigInteger 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)
Deprecated.
|
IRubyObject |
op_rshift(ThreadContext context,
IRubyObject other)
rb_big_rshift
|
RubyInteger |
op_rshift(ThreadContext context,
long shift) |
IRubyObject |
op_uminus(ThreadContext context)
rb_big_uminus
|
IRubyObject |
op_xor(ThreadContext context,
IRubyObject other)
rb_big_xor
|
IRubyObject |
op_xor19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
quo(ThreadContext context,
IRubyObject other)
rb_big_quo
|
IRubyObject |
quo19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
remainder(ThreadContext context,
IRubyObject other)
rb_big_remainder
|
IRubyObject |
remainder19(ThreadContext context,
IRubyObject other)
Deprecated.
|
int |
signum() |
IRubyObject |
size(ThreadContext context)
rb_big_size
|
IRubyObject |
sqrt(ThreadContext context) |
IRubyObject |
to_f() |
IRubyObject |
to_f(ThreadContext context)
rb_big_to_f
|
RubyString |
to_s()
rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj.
|
RubyString |
to_s(IRubyObject arg0) |
IRubyObject |
to_s(IRubyObject[] args)
rb_big_to_s
|
static java.math.BigInteger |
toBigInteger(double value) |
IRubyObject |
truncate(ThreadContext context,
IRubyObject arg)
rb_big_truncate
|
static RubyNumeric |
unmarshalFrom(UnmarshalStream input) |
IRubyObject |
zero_p(ThreadContext context)
num_zero_p
|
allbits_p, anybits_p, ceil, ceil, chr, chr, chr19, chr19, convertToInteger, createIntegerClass, digits, div_div, downto, fdiv, floor, floor, floorSqrt, floorSqrt, gcd, gcdlcm, induced_from, int_half_p_half_down, int_half_p_half_even, int_half_p_half_up, int_round_half_down, int_round_half_even, int_round_half_up, integer_p, intPowTmp3, isNegative, isPositive, lcm, magnitude, nobits_p, op_aref, op_ge, op_gt, op_idiv, op_le, op_lshift, op_lt, op_neg, op_rshift, op_uminus, ord, pow, pow, pred, rationalize, round, round, round, round, round, round19, round19, roundShared, size, sqrt, succ, times, timesSizeFn, to_i, to_r, toFloat, truncate, truncate, upto
abs2, arg, asNumeric, callCoerced, callCoerced, callCoerced, callCoerced, checkInt, checkInt, coerceBin, coerceBin, coerceBit, coerceBit, coerceBody, coerceCmp, coerceCmp, coerceFailed, coerceRelOp, coerceRelOp, coerceRescue, compareWithZero, conjugate, createNumericClass, dbl_cmp, dbl2ival, dbl2num, div, div19, divmod19, doCoerce, dup, eql_p, finite_p, fix2int, fix2int, fix2long, fixable, float2long, floatStepSize, getCoerced, getRoundingMode, image, infinite_p, initialize_copy, int2fix, intervalStepSize, isReal, modulo19, negativeInt, negFixable, negFixable, newNumeric, num_imaginary, num2chr, num2dbl, num2dbl, num2fix, num2int, num2long, numFuncall, numFuncall, numRemainder, op_cmp, op_not, op_num_equal, op_uplus, polar, posFixable, posFixable, positiveInt, quo_19, rbClone, rbClone, rbClone, rbClone, real_p, real, rect, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, inspect, op_eqq, puts, specificEval, toRubyString, toString
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, 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, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id, infectBy, initialize, 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, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing, method_missing19, method, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbInspect, 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_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_method, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
array
public static final java.math.BigInteger LONG_MAX
public static final java.math.BigInteger LONG_MIN
public static final java.math.BigInteger ULONG_MAX
public RubyBignum(Ruby runtime, java.math.BigInteger value)
public ClassIndex getNativeClassIndex()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public java.lang.Class<?> getJavaClass()
RubyBasicObject
getJavaClass
in interface IRubyObject
getJavaClass
in class RubyBasicObject
public static RubyBignum newBignum(Ruby runtime, long value)
public static RubyBignum newBignum(Ruby runtime, double value)
public static java.math.BigInteger toBigInteger(double value)
public static RubyInteger newBignorm(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 RubyNumeric
public long getLongValue()
RubyNumeric
getLongValue
in class RubyNumeric
public int getIntValue()
RubyNumeric
getIntValue
in class RubyNumeric
public java.math.BigInteger getBigIntegerValue()
getBigIntegerValue
in class RubyNumeric
public RubyClass getSingletonClass()
RubyBasicObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyBasicObject
public java.math.BigInteger getValue()
public int signum()
signum
in class RubyInteger
public RubyInteger negate()
negate
in class RubyInteger
public static RubyInteger bignorm(Ruby runtime, java.math.BigInteger bi)
public static long big2long(RubyBignum val)
public static long big2ulong(RubyBignum value)
public static double big2dbl(RubyBignum val)
public static java.math.BigInteger fix2big(RubyFixnum arg)
public static java.math.BigInteger long2big(long arg)
public IRubyObject ceil(ThreadContext context, IRubyObject arg)
ceil
in class RubyInteger
public IRubyObject floor(ThreadContext context, IRubyObject arg)
floor
in class RubyInteger
public IRubyObject truncate(ThreadContext context, IRubyObject arg)
truncate
in class RubyInteger
public RubyArray digits(ThreadContext context, IRubyObject base)
digits
in class RubyInteger
public IRubyObject to_s(IRubyObject[] args)
public RubyString to_s()
RubyBasicObject
to_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 RubyInteger
public RubyString to_s(IRubyObject arg0)
to_s
in class RubyInteger
public IRubyObject coerce(IRubyObject other)
coerce
in class RubyNumeric
public IRubyObject op_uminus(ThreadContext context)
op_uminus
in class RubyInteger
public IRubyObject op_plus(ThreadContext context, IRubyObject other)
op_plus
in class RubyInteger
public final IRubyObject op_plus(ThreadContext context, long other)
op_plus
in class RubyInteger
public final IRubyObject op_plus(ThreadContext context, java.math.BigInteger other)
public IRubyObject op_minus(ThreadContext context, IRubyObject other)
op_minus
in class RubyInteger
public final IRubyObject op_minus(ThreadContext context, long other)
op_minus
in class RubyInteger
public final IRubyObject op_minus(ThreadContext context, java.math.BigInteger other)
public IRubyObject op_mul(ThreadContext context, IRubyObject other)
op_mul
in class RubyInteger
@Deprecated public final IRubyObject op_mul19(ThreadContext context, IRubyObject other)
public final IRubyObject op_mul(ThreadContext context, long other)
op_mul
in class RubyInteger
public IRubyObject op_div(ThreadContext context, IRubyObject other)
op_div
in class RubyInteger
public IRubyObject op_div(ThreadContext context, long other)
public IRubyObject idiv(ThreadContext context, IRubyObject other)
idiv
in class RubyInteger
public IRubyObject idiv(ThreadContext context, long other)
idiv
in class RubyNumeric
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod
in class RubyInteger
public IRubyObject op_mod(ThreadContext context, IRubyObject other)
op_mod
in class RubyInteger
public IRubyObject op_mod(ThreadContext context, long other)
op_mod
in class RubyInteger
public IRubyObject modulo(ThreadContext context, IRubyObject other)
RubyNumeric
modulo
in class RubyNumeric
@Deprecated public IRubyObject op_mod19(ThreadContext context, IRubyObject other)
public IRubyObject remainder(ThreadContext context, IRubyObject other)
remainder
in class RubyInteger
@Deprecated public IRubyObject remainder19(ThreadContext context, IRubyObject other)
public IRubyObject quo(ThreadContext context, IRubyObject other)
quo
in class RubyNumeric
@Deprecated public final IRubyObject quo19(ThreadContext context, IRubyObject other)
public IRubyObject op_pow(ThreadContext context, IRubyObject other)
op_pow
in class RubyInteger
public final IRubyObject op_pow(ThreadContext context, long other)
@Deprecated public IRubyObject op_pow19(ThreadContext context, IRubyObject other)
public IRubyObject op_and(ThreadContext context, IRubyObject other)
op_and
in class RubyInteger
@Deprecated public IRubyObject op_and19(ThreadContext context, IRubyObject other)
public IRubyObject op_or(ThreadContext context, IRubyObject other)
op_or
in class RubyInteger
public IRubyObject bit_length(ThreadContext context)
bit_length
in class RubyInteger
@Deprecated public IRubyObject op_or19(ThreadContext context, IRubyObject other)
public IRubyObject op_xor(ThreadContext context, IRubyObject other)
op_xor
in class RubyInteger
@Deprecated public IRubyObject op_xor19(ThreadContext context, IRubyObject other)
public IRubyObject op_neg(ThreadContext context)
op_neg
in class RubyInteger
public IRubyObject op_lshift(ThreadContext context, IRubyObject other)
op_lshift
in class RubyInteger
public RubyInteger op_lshift(ThreadContext context, long shift)
op_lshift
in class RubyInteger
public IRubyObject op_rshift(ThreadContext context, IRubyObject other)
op_rshift
in class RubyInteger
public RubyInteger op_rshift(ThreadContext context, long shift)
op_rshift
in class RubyInteger
public RubyBoolean odd_p(ThreadContext context)
odd_p
in class RubyInteger
public RubyBoolean even_p(ThreadContext context)
even_p
in class RubyInteger
public RubyFixnum op_aref(ThreadContext context, IRubyObject other)
op_aref
in class RubyInteger
public final int compareTo(IRubyObject other)
RubyBasicObject
compareTo
in interface java.lang.Comparable<IRubyObject>
compareTo
in class RubyBasicObject
other
- another IRubyObjectpublic boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
RubyBasicObject.equals(Object)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp
in class RubyInteger
public IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal
in interface IRubyObject
op_equal
in class RubyInteger
public IRubyObject eql_p(IRubyObject other)
eql_p
in class RubyBasicObject
@Deprecated public IRubyObject eql_p19(IRubyObject other)
public RubyFixnum hash()
hash
in class RubyBasicObject
public int hashCode()
RubyObject
hashCode
in class RubyObject
RubyBasicObject.hashCode()
public IRubyObject to_f(ThreadContext context)
to_f
in class RubyInteger
public IRubyObject to_f()
to_f
in class RubyInteger
@Deprecated public IRubyObject abs()
public IRubyObject abs(ThreadContext context)
abs
in class RubyInteger
public IRubyObject size(ThreadContext context)
size
in class RubyInteger
public IRubyObject zero_p(ThreadContext context)
RubyNumeric
zero_p
in class RubyInteger
public final boolean isZero()
isZero
in class RubyNumeric
public IRubyObject nonzero_p(ThreadContext context)
RubyNumeric
nonzero_p
in class RubyNumeric
public static void marshalTo(RubyBignum bignum, MarshalStream output) throws java.io.IOException
java.io.IOException
public static RubyNumeric unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOException
public IRubyObject fdivDouble(ThreadContext context, IRubyObject y)
fdivDouble
in class RubyInteger
public IRubyObject fdivInt(ThreadContext context, RubyBignum y)
public IRubyObject fdivFloat(ThreadContext context, RubyFloat y)
public IRubyObject isNegative(ThreadContext context)
RubyNumeric
isNegative
in class RubyInteger
public IRubyObject isPositive(ThreadContext context)
RubyNumeric
isPositive
in class RubyInteger
protected boolean int_round_zero_p(ThreadContext context, int ndigits)
int_round_zero_p
in class RubyInteger
public boolean isImmediate()
RubyBasicObject
isImmediate
in interface IRubyObject
isImmediate
in class RubyBasicObject
public IRubyObject numerator(ThreadContext context)
RubyNumeric
numerator
in class RubyInteger
public IRubyObject denominator(ThreadContext context)
RubyNumeric
denominator
in class RubyInteger
public RubyRational convertToRational()
convertToRational
in class RubyNumeric
public IRubyObject sqrt(ThreadContext context)
sqrt
in class RubyInteger
Copyright © 2001-2020 JRuby. All Rights Reserved.