Package org.jruby
Class RubyBignum
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyNumeric
org.jruby.RubyInteger
org.jruby.RubyBignum
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyNumeric
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigInteger
static final BigInteger
static final BigInteger
static final BigInteger
static final BigInteger
static final BigInteger
static final BigInteger
Fields inherited from class org.jruby.RubyInteger
NUMERR_NEGATIVE, NUMERR_TOOLARGE, NUMERR_TYPE
Fields inherited from class org.jruby.RubyNumeric
DBL_EPSILON
Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
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, 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
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()
Deprecated.abs
(ThreadContext context) rb_big_absasBigInteger
(ThreadContext context) Return a BigInteger representation of this numerical valuedouble
asDouble
(ThreadContext context) Return a double representation of this numerical valueint
asInt
(ThreadContext context) Returns the value of this numeric and a java int.long
asLong
(ThreadContext context) Return the value of this numeric as a 64-bit long.static double
big2dbl
(RubyBignum val) rb_big2dblstatic long
big2long
(RubyBignum val) rb_big2longstatic long
big2ulong
(RubyBignum value) rb_big2ulong This is here because for C extensions ulong can hold different values without throwing a RangeErrorstatic long
big2ulong
(Ruby runtime, BigInteger big) static RubyInteger
bignorm
(Ruby runtime, BigInteger bi) rb_big_normbit_length
(ThreadContext context) ceil
(ThreadContext context, IRubyObject arg) rb_big_ceilcoerce
(ThreadContext context, IRubyObject other) num_coercefinal int
compareTo
(IRubyObject other) Compares this Ruby object with another.convertToRational
(ThreadContext context) denominator
(ThreadContext context) numeric_denominatordigits
(ThreadContext context, IRubyObject baseArg) rb_big_digitsdivmod
(ThreadContext context, IRubyObject other) rb_big_divmodeql_p
(ThreadContext context, IRubyObject other) rb_big_eqlboolean
This override does not do a "checked" dispatch.even_p
(ThreadContext context) fdivDouble
(ThreadContext context, IRubyObject y) fdivFloat
(ThreadContext context, RubyFloat y) fdivInt
(ThreadContext context, RubyBignum y) static BigInteger
fix2big
(RubyFixnum arg) rb_int2bigfloor
(ThreadContext context, IRubyObject arg) rb_big_floorClass
<?> Will return the Java interface that most closely can represent this object, when working through Java integration translations.This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.getValue()
Getter for property value.hash
(ThreadContext context) Will return the hash code of this object.int
hashCode()
This override does not do "checked" dispatch since Object usually has #hash defined.idiv
(ThreadContext context, long other) idiv
(ThreadContext context, IRubyObject other) rb_big_idivprotected boolean
int_round_zero_p
(ThreadContext context, int ndigits) boolean
Is object immediate (def: Fixnum, Symbol, true, false, nil?).isNegative
(ThreadContext context) num_negative_pisPositive
(ThreadContext context) num_positive_pfinal boolean
isZero
(ThreadContext context) static BigInteger
long2big
(long arg) static void
marshalTo
(RubyBignum bignum, MarshalStream output) Deprecated, for removal: This API element is subject to removal in a future version.static void
marshalTo
(ThreadContext context, RubyOutputStream out, RubyBignum bignum, MarshalDumper output) modulo
(ThreadContext context, IRubyObject other) num_modulonegate
(ThreadContext context) 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
Return a Bignum for the given value, or raise FloatDomainError if it is out of range.static RubyBignum
static RubyBignum
static RubyBignum
newBignum
(Ruby runtime, BigInteger value) nonzero_p
(ThreadContext context) num_nonzero_pnumerator
(ThreadContext context) numeric_numeratorodd_p
(ThreadContext context) op_and
(ThreadContext context, IRubyObject other) rb_big_andprotected IRubyObject
op_aref_subclass
(ThreadContext context, IRubyObject other) rb_big_arefop_cmp
(ThreadContext context, IRubyObject other) rb_big_cmpop_div
(ThreadContext context, long other) op_div
(ThreadContext context, IRubyObject other) rb_big_divop_equal
(ThreadContext context, IRubyObject other) rb_big_eqop_ge
(ThreadContext context, IRubyObject other) op_gt
(ThreadContext context, IRubyObject other) op_le
(ThreadContext context, IRubyObject other) op_lshift
(ThreadContext context, long shift) op_lshift
(ThreadContext context, IRubyObject other) rb_big_lshiftop_lt
(ThreadContext context, IRubyObject other) final IRubyObject
op_minus
(ThreadContext context, long other) final IRubyObject
op_minus
(ThreadContext context, BigInteger other) op_minus
(ThreadContext context, IRubyObject other) rb_big_minusop_mod
(ThreadContext context, long other) op_mod
(ThreadContext context, IRubyObject other) rb_big_modulofinal IRubyObject
op_mul
(ThreadContext context, long other) op_mul
(ThreadContext context, IRubyObject other) rb_big_mulop_neg
(ThreadContext context) rb_big_negop_or
(ThreadContext context, IRubyObject other) rb_big_orfinal IRubyObject
op_plus
(ThreadContext context, long other) final IRubyObject
op_plus
(ThreadContext context, BigInteger other) op_plus
(ThreadContext context, IRubyObject other) rb_big_plusfinal IRubyObject
op_pow
(ThreadContext context, long other) op_pow
(ThreadContext context, IRubyObject other) rb_big_powop_rshift
(ThreadContext context, long shift) op_rshift
(ThreadContext context, IRubyObject other) rb_big_rshiftop_uminus
(ThreadContext context) rb_big_uminusop_xor
(ThreadContext context, IRubyObject other) rb_big_xorquo
(ThreadContext context, IRubyObject otherArg) Deprecated.remainder
(ThreadContext context, IRubyObject other) rb_big_remainderint
signum
(ThreadContext context) singletonClass
(ThreadContext context) Will either return the existing singleton class for this object, or create a new one and return that.size
(ThreadContext context) rb_big_sizesqrt
(ThreadContext context) to_f
(ThreadContext context) rb_big_to_fto_s
(IRubyObject[] args) Deprecated.to_s
(ThreadContext context) to_s
(ThreadContext context, IRubyObject arg0) static BigInteger
toBigInteger
(double value) truncate
(ThreadContext context, IRubyObject arg) rb_big_truncatestatic RubyNumeric
unmarshalFrom
(UnmarshalStream input) Deprecated, for removal: This API element is subject to removal in a future version.static RubyNumeric
unmarshalFrom
(ThreadContext context, RubyInputStream in, MarshalLoader input) zero_p
(ThreadContext context) num_zero_pMethods inherited from class org.jruby.RubyInteger
allbits_p, anybits_p, ceil, ceil, chr, chr, 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, integerCeil, integerFloor, intPowTmp3, isNegativeNumber, isPositiveNumber, lcm, magnitude, negate, nobits_p, numToUint, numToUint, op_aref, op_aref, op_aref, op_idiv, op_lshift, op_neg, op_rshift, op_uminus, ord, pow, pow, pred, rationalize, round, round, round, round, round, roundShared, signum, singleCharByteList, singleCharString, singleCharUTF8ByteList, size, sqrt, succ, times, timesSize, to_f, to_i, to_i, to_r, to_s, to_s, toFloat, truncate, truncate, try_convert, upto
Methods inherited from class org.jruby.RubyNumeric
abs2, arg, asNumeric, callCoerced, callCoerced, callCoerced, callCoerced, checkInt, checkInt, coerce, coerceBin, coerceBin, coerceBit, coerceBit, coerceCmp, coerceCmp, coerceFailed, coerceRelOp, coerceRelOp, coerceRescue, compareWithZero, conjugate, convertToRational, createNumericClass, dbl_cmp, dbl2ival, dbl2num, div, doCoerce, dup, finite_p, fix2int, fix2int, fix2long, fixable, float2long, float2ulong, floatStep, floatStepSize, getBigIntegerValue, getCoerced, getDoubleValue, getIntValue, getLongValue, getRoundingMode, image, infinite_p, initialize_copy, int2fix, integer_p, intervalStepSize, isNegative, isPositive, isReal, isZero, negativeInt, negFixable, negFixable, newNumeric, num_imaginary, num2chr, num2dbl, num2dbl, num2fix, num2fix, num2int, num2long, num2ulong, numFuncall, numFuncall, numRemainder, op_not, op_num_equal, op_uplus, op_uplus, polar, posFixable, posFixable, positiveInt, rbClone, rbClone, rbClone, rbClone, real, real_p, rect, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum, str2inum, str2inum, str2inum, to_c, to_int, toJava
Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, finishObjectClass, inspect, op_eqq, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize, initialize_copy, inspect, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_match, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Field Details
-
LONG_MAX
-
LONG_MAX_PLUS_ONE
-
LONG_MIN
-
LONG_MIN_MINUS_ONE
-
INTEGER_MAX
-
INTEGER_MIN
-
ULONG_MAX
-
-
Constructor Details
-
RubyBignum
-
-
Method Details
-
getNativeClassIndex
Description copied from class:RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
getJavaClass
Description copied from class:RubyBasicObject
Will return the Java interface that most closely can represent this object, when working through Java integration translations.- Specified by:
getJavaClass
in interfaceIRubyObject
- Overrides:
getJavaClass
in classRubyBasicObject
- Returns:
- the true Java class of this (Ruby) object
-
newBignum
-
newBignum
Return a Bignum for the given value, or raise FloatDomainError if it is out of range. Note this method may return Bignum that are in Fixnum range. -
toBigInteger
-
newBignorm
Return a Bignum or Fixnum (Integer) for the given value, or raise FloatDomainError if it is out of range. MRI: rb_dbl2big -
newBignum
-
newBignum
-
asBigInteger
Description copied from class:RubyNumeric
Return a BigInteger representation of this numerical value- Overrides:
asBigInteger
in classRubyNumeric
- Parameters:
context
- the current thread context- Returns:
- a BigInteger
-
asDouble
Description copied from class:RubyNumeric
Return a double representation of this numerical value- Overrides:
asDouble
in classRubyNumeric
- Parameters:
context
- the current thread context- Returns:
- a double
-
asInt
Description copied from class:RubyNumeric
Returns the value of this numeric and a java int.- Overrides:
asInt
in classRubyNumeric
-
asLong
Description copied from class:RubyNumeric
Return the value of this numeric as a 64-bit long.- Overrides:
asLong
in classRubyNumeric
-
singletonClass
Description copied from class:RubyBasicObject
Will either return the existing singleton class for this object, or create a new one and return that. For a few types a singleton class is not possible so it will throw an error.- Specified by:
singletonClass
in interfaceIRubyObject
- Overrides:
singletonClass
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the singleton of this type
-
getValue
Getter for property value.- Returns:
- Value of property value.
-
signum
- Overrides:
signum
in classRubyInteger
-
negate
- Overrides:
negate
in classRubyInteger
-
bignorm
rb_big_norm -
big2long
rb_big2long -
big2ulong
rb_big2ulong This is here because for C extensions ulong can hold different values without throwing a RangeError -
big2ulong
-
big2dbl
rb_big2dbl -
fix2big
rb_int2big -
long2big
-
ceil
rb_big_ceil- Specified by:
ceil
in classRubyInteger
-
floor
rb_big_floor- Specified by:
floor
in classRubyInteger
-
truncate
rb_big_truncate- Specified by:
truncate
in classRubyInteger
-
digits
rb_big_digits- Specified by:
digits
in classRubyInteger
-
to_s
Deprecated.rb_big_to_s -
to_s
- Overrides:
to_s
in classRubyInteger
-
to_s
- Overrides:
to_s
in classRubyInteger
-
coerce
Description copied from class:RubyNumeric
num_coerce- Overrides:
coerce
in classRubyNumeric
-
op_uminus
rb_big_uminus- Specified by:
op_uminus
in classRubyInteger
-
op_plus
rb_big_plus- Specified by:
op_plus
in classRubyInteger
-
op_plus
- Overrides:
op_plus
in classRubyInteger
-
op_plus
-
op_minus
rb_big_minus- Specified by:
op_minus
in classRubyInteger
-
op_minus
- Overrides:
op_minus
in classRubyInteger
-
op_minus
-
op_mul
rb_big_mul- Specified by:
op_mul
in classRubyInteger
-
op_mul
- Overrides:
op_mul
in classRubyInteger
-
op_div
rb_big_div- Specified by:
op_div
in classRubyInteger
-
op_div
-
idiv
rb_big_idiv- Specified by:
idiv
in classRubyInteger
-
idiv
- Overrides:
idiv
in classRubyNumeric
-
divmod
rb_big_divmod- Overrides:
divmod
in classRubyInteger
-
op_mod
rb_big_modulo- Specified by:
op_mod
in classRubyInteger
-
op_mod
- Overrides:
op_mod
in classRubyInteger
-
modulo
Description copied from class:RubyNumeric
num_modulo- Overrides:
modulo
in classRubyNumeric
-
remainder
rb_big_remainder- Overrides:
remainder
in classRubyInteger
-
quo
Deprecated.MRI: rb_big_quo, formerly Deprecated since 10.0 since CRuby no longer has Bignum-specific quo logic.- Overrides:
quo
in classRubyNumeric
-
op_pow
rb_big_pow- Specified by:
op_pow
in classRubyInteger
-
op_pow
-
op_and
rb_big_and- Specified by:
op_and
in classRubyInteger
-
op_or
rb_big_or- Specified by:
op_or
in classRubyInteger
-
bit_length
- Specified by:
bit_length
in classRubyInteger
-
op_xor
rb_big_xor- Specified by:
op_xor
in classRubyInteger
-
op_neg
rb_big_neg- Specified by:
op_neg
in classRubyInteger
-
op_lshift
rb_big_lshift- Specified by:
op_lshift
in classRubyInteger
-
op_lshift
- Overrides:
op_lshift
in classRubyInteger
-
op_rshift
rb_big_rshift- Specified by:
op_rshift
in classRubyInteger
-
op_rshift
- Overrides:
op_rshift
in classRubyInteger
-
odd_p
- Overrides:
odd_p
in classRubyInteger
-
even_p
- Overrides:
even_p
in classRubyInteger
-
op_aref_subclass
rb_big_aref- Specified by:
op_aref_subclass
in classRubyInteger
-
op_gt
- Overrides:
op_gt
in classRubyInteger
-
op_lt
- Overrides:
op_lt
in classRubyInteger
-
op_ge
- Overrides:
op_ge
in classRubyInteger
-
op_le
- Overrides:
op_le
in classRubyInteger
-
compareTo
Description copied from class:RubyBasicObject
Compares this Ruby object with another.- Specified by:
compareTo
in interfaceComparable<IRubyObject>
- Overrides:
compareTo
in classRubyBasicObject
- Parameters:
other
- another IRubyObject- Returns:
- 0 if equal, < 0 if this is less than other, > 0 if this is greater than other
-
equals
Description copied from class:RubyObject
This override does not do a "checked" dispatch.- Overrides:
equals
in classRubyObject
- Parameters:
other
- object to compare- Returns:
- true if equals
- See Also:
-
op_cmp
rb_big_cmp- Specified by:
op_cmp
in classRubyInteger
-
op_equal
rb_big_eq- Specified by:
op_equal
in interfaceIRubyObject
- Specified by:
op_equal
in classRubyInteger
-
eql_p
rb_big_eql- Overrides:
eql_p
in classRubyNumeric
-
hash
Description copied from class:RubyBasicObject
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
hashCode
public int hashCode()Description copied from class:RubyObject
This override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCode
in classRubyObject
- Returns:
- the hash code
- See Also:
-
to_f
rb_big_to_f- Specified by:
to_f
in classRubyInteger
-
abs
Deprecated. -
abs
rb_big_abs- Specified by:
abs
in classRubyInteger
-
size
rb_big_size- Specified by:
size
in classRubyInteger
-
zero_p
Description copied from class:RubyNumeric
num_zero_p- Specified by:
zero_p
in classRubyInteger
-
isZero
- Overrides:
isZero
in classRubyNumeric
-
nonzero_p
Description copied from class:RubyNumeric
num_nonzero_p- Overrides:
nonzero_p
in classRubyNumeric
-
marshalTo
@Deprecated(since="10.0", forRemoval=true) public static void marshalTo(RubyBignum bignum, MarshalStream output) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
marshalTo
public static void marshalTo(ThreadContext context, RubyOutputStream out, RubyBignum bignum, MarshalDumper output) -
unmarshalFrom
@Deprecated(since="10.0", forRemoval=true) public static RubyNumeric unmarshalFrom(UnmarshalStream input) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
unmarshalFrom
public static RubyNumeric unmarshalFrom(ThreadContext context, RubyInputStream in, MarshalLoader input) -
fdivDouble
- Specified by:
fdivDouble
in classRubyInteger
-
fdivInt
-
fdivFloat
-
isNegative
Description copied from class:RubyNumeric
num_negative_p- Overrides:
isNegative
in classRubyInteger
-
isPositive
Description copied from class:RubyNumeric
num_positive_p- Overrides:
isPositive
in classRubyInteger
-
int_round_zero_p
- Overrides:
int_round_zero_p
in classRubyInteger
-
isImmediate
public boolean isImmediate()Description copied from class:RubyBasicObject
Is object immediate (def: Fixnum, Symbol, true, false, nil?).- Specified by:
isImmediate
in interfaceIRubyObject
- Overrides:
isImmediate
in classRubyBasicObject
- Returns:
- boolean
-
numerator
Description copied from class:RubyNumeric
numeric_numerator- Overrides:
numerator
in classRubyInteger
-
denominator
Description copied from class:RubyNumeric
numeric_denominator- Overrides:
denominator
in classRubyInteger
-
convertToRational
- Overrides:
convertToRational
in classRubyNumeric
-
sqrt
- Specified by:
sqrt
in classRubyInteger
-