Package org.jruby.ext.bigdecimal
Class RubyBigDecimal
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyNumeric
org.jruby.ext.bigdecimal.RubyBigDecimal
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jruby.RubyNumeric
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeExceptionNested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BigDecimalstatic final intprivate static final shortstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate static final Patternprivate intprivate booleanprivate static final BigDecimalprivate static final BigDecimalprivate static final longprivate static final shortstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate static final doubleprivate BigDecimalprivate static final ByteListprivate static final shortprivate intFields inherited from class org.jruby.RubyNumeric
DBL_EPSILONFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields 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, 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, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionRubyBigDecimal(Ruby runtime, BigDecimal value) RubyBigDecimal(Ruby runtime, BigDecimal value, boolean isNan) RubyBigDecimal(Ruby runtime, BigDecimal value, int infinitySign) RubyBigDecimal(Ruby runtime, BigDecimal value, int infinitySign, int zeroSign) RubyBigDecimal(Ruby runtime, RubyBigDecimal rbd) Deprecated.RubyBigDecimal(Ruby runtime, RubyClass klass) RubyBigDecimal(Ruby runtime, RubyClass klass, BigDecimal value) RubyBigDecimal(Ruby runtime, RubyClass klass, BigDecimal value, int zeroSign, int infinitySign, boolean isNaN) RubyBigDecimal(Ruby runtime, RubyClass klass, RubyBigDecimal rbd) Deprecated. -
Method Summary
Modifier and TypeMethodDescription_dump(ThreadContext context) _dump(ThreadContext context, IRubyObject unused) static RubyBigDecimal_load(ThreadContext context, IRubyObject recv, IRubyObject from) abs()private BigDecimaladd2(ThreadContext context, IRubyObject b, IRubyObject digits) add219(ThreadContext context, IRubyObject b, IRubyObject digits) Deprecated.private IRubyObjectaddInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, IRubyObject digits) private RubyBigDecimaladdSpecialCases(ThreadContext context, RubyBigDecimal val) private static StringBuilderappendSign(StringBuilder buff, String str, int signum) private static longbigDecimalVar(Ruby runtime, String variableName) static BigDecimalbigSqrt(BigDecimal squarD, MathContext rootMC) Returns the correctly rounded square root of a positive BigDecimal.private static RubyBigDecimalcannotBeCoerced(ThreadContext context, IRubyObject value, boolean must) ceil(ThreadContext context) MRI: num_ceilceil(ThreadContext context, IRubyObject arg) private voidprivate static IRubyObjectcheckOverUnderFlow(Ruby runtime, ArithmeticException ex, boolean nullDefault, boolean strict, boolean exception) private IRubyObjectcmp(ThreadContext context, IRubyObject arg, char op) coerce(IRubyObject other) num_coercecoerce(ThreadContext context, IRubyObject other) private static booleancontentEquals(String str1, char[] str2, int s2, int e2) Tries to convert this object to a Ruby Float using the "to_f" method.Tries to convert this object to a Ruby Integer using the "to_int" method.static RubyClasscreateBigDecimal(Ruby runtime) private static RubyBigDecimaldiv2Impl(ThreadContext context, RubyNumeric a, RubyNumeric b, int ix) private static BigDecimaldivide(BigDecimal target, BigDecimal divisor, MathContext mc) divmod(ThreadContext context, IRubyObject other) num_divmodprivate RubyBigDecimaldivSpecialCases(ThreadContext context, RubyBigDecimal val) static IRubyObjectdouble_fig(ThreadContext context, IRubyObject recv) private CharSequenceengineeringValue(String arg) eql_p(ThreadContext context, IRubyObject arg) num_eqlprivate static StringerrMessageType(ThreadContext context, IRubyObject value) exponent()private static booleanfalsyEqlCheck(ThreadContext context, IRubyObject arg) finite_p()fix()private CharSequencefloatingPointValue(String arg) floor(ThreadContext context) MRI: num_floorfloor(ThreadContext context, IRubyObject arg) private RubyBigDecimalfloorImpl(ThreadContext context, int n) private RubyBigDecimalfloorNaNInfinityCheck(ThreadContext context) static intformatFractionalDigitGroups(String format) static booleanformatHasFloatingPointNotation(String format) static booleanformatHasLeadingPlus(String format) static booleanformatHasLeadingSpace(String format) frac(ThreadContext context) private Stringdoubleprivate intintReturn the value of this numeric as a 32-bit long.longReturn the value of this numeric as a 64-bit long.This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.private static intgetPositiveInt(ThreadContext context, IRubyObject arg) private static intgetPrecisionInt(Ruby runtime, IRubyObject v) private static intgetPrecLimit(Ruby runtime) private static RoundingModegetRoundingMode(Ruby runtime) private StringgetValue()private static RubyBigDecimalgetVpRubyObjectWithPrecInner(ThreadContext context, RubyRational value, RoundingMode mode) private static RubyBigDecimalgetVpValue(ThreadContext context, IRubyObject value, boolean must) private RubyBigDecimalgetVpValueWithPrec(ThreadContext context, IRubyObject value, boolean must) private static intprivate static IRubyObjecthandleFloatDomainError(Ruby runtime, String message, boolean strict, boolean exception) private static IRubyObjecthandleInvalidArgument(ThreadContext context, RubyString arg, boolean strict, boolean exception) private static IRubyObjecthandleMissingPrecision(ThreadContext context, String name, boolean strict, boolean exception) hash()rb_obj_id Will return the hash code of this object.private RubyIntegeridiv(ThreadContext context, RubyRational val) static IRubyObjectinduced_from(ThreadContext context, IRubyObject recv, IRubyObject arg) infinite_p(ThreadContext context) (package private) static StringinfinityString(int infinitySign) initialize_copy(IRubyObject original) num_init_copyinspect(ThreadContext context) static IRubyObjectinterpret_loosely(ThreadContext context, IRubyObject recv, IRubyObject str) private static RaiseExceptioninvalidArgumentError(ThreadContext context, RubyString arg) private static booleanprivate static booleanisExponentOutOfRange(char[] str, int off, int end) private booleanprivate static booleanisInfinityExceptionMode(Ruby runtime) private booleanisNaN()private static booleanisNaNExceptionMode(Ruby runtime) private static booleanisOverflowExceptionMode(Ruby runtime) private static booleanisUnderflowExceptionMode(Ruby runtime) final booleanisZero()private static booleanisZeroBase(char[] str, int off, int end) private static booleanisZeroDivideExceptionMode(Ruby runtime) private static RoundingModejavaRoundingModeFromRubyRoundingMode(ThreadContext context, IRubyObject arg) static IRubyObjectlimit(ThreadContext context, IRubyObject recv) Retrieve vpPrecLimit.static IRubyObjectlimit(ThreadContext context, IRubyObject recv, IRubyObject arg) Set new vpPrecLimit if Fixnum and return the old value.static IRubyObjectmode(ThreadContext context, IRubyObject recv, IRubyObject[] args) private static IRubyObjectmodeExecute(ThreadContext context, RubyModule BigDecimal, Block block, String intVariableName) mult2(ThreadContext context, IRubyObject b, IRubyObject n) mult219(ThreadContext context, IRubyObject b, IRubyObject n) Deprecated.private RubyBigDecimalmultImpl(Ruby runtime, RubyBigDecimal val) multiplyWith(ThreadContext context, RubyBignum value) multiplyWith(ThreadContext context, RubyFloat value) multiplyWith(ThreadContext context, RubyInteger value) nan_p(ThreadContext context) static IRubyObjectnew_(ThreadContext context, IRubyObject recv, IRubyObject arg) Deprecated.static IRubyObjectnew_(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg) Deprecated.static IRubyObjectnew_(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg, IRubyObject opts) Deprecated.private static RubyBigDecimalnewFloatSpecialCases(Ruby runtime, RubyFloat val) private static RubyBigDecimalnewInfinity(Ruby runtime, int sign) private static RaiseExceptionnewInfinityFloatDomainError(Ruby runtime, int sign) private static RubyBigDecimalnewInstance(Ruby runtime, IRubyObject recv, RubyBigDecimal arg) private static RubyBigDecimalnewInstance(Ruby runtime, IRubyObject recv, RubyBignum arg, MathContext mathContext) private static RubyBigDecimalnewInstance(Ruby runtime, IRubyObject recv, RubyFixnum arg, MathContext mathContext) private static RubyBigDecimalnewInstance(Ruby runtime, IRubyObject recv, RubyFloat arg, MathContext mathContext) static RubyBigDecimalnewInstance(IRubyObject recv, IRubyObject[] args) Deprecated.private static IRubyObjectnewInstance(ThreadContext context, RubyClass recv, RubyString arg, MathContext mathContext, boolean strict, boolean exception) private static RubyBigDecimalnewInstance(ThreadContext context, RubyRational arg, MathContext mathContext) static RubyBigDecimalnewInstance(ThreadContext context, IRubyObject recv, IRubyObject arg) static IRubyObjectnewInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, boolean strict, boolean exception) static RubyBigDecimalnewInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg) static IRubyObjectnewInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg, boolean strict, boolean exception) private static RubyBigDecimalprivate static RaiseExceptionnewNaNFloatDomainError(Ruby runtime) private RubyBigDecimalnewPowOfInfinity(ThreadContext context, RubyNumeric exp) private RubyBigDecimalnewPowOfZero(ThreadContext context, RubyNumeric exp) private static RubyBigDecimalDeprecated.nonzero_p(ThreadContext context) num_nonzero_pop_cmp(ThreadContext context, IRubyObject arg) op_div(ThreadContext context, IRubyObject other) op_div(ThreadContext context, IRubyObject other, IRubyObject digits) final IRubyObjectop_div19(ThreadContext context, IRubyObject r) Deprecated.final IRubyObjectop_div19(ThreadContext context, IRubyObject other, IRubyObject digits) Deprecated.op_eqq(ThreadContext context, IRubyObject arg) rb_equal The Ruby "===" method is used by default in case/when statements.op_ge(ThreadContext context, IRubyObject arg) op_gt(ThreadContext context, IRubyObject arg) op_le(ThreadContext context, IRubyObject arg) op_lt(ThreadContext context, IRubyObject arg) op_minus(ThreadContext context, IRubyObject b) op_minus19(ThreadContext context, IRubyObject b) Deprecated.op_mod(ThreadContext context, IRubyObject other) op_mod19(ThreadContext context, IRubyObject arg) Deprecated.op_mul(ThreadContext context, IRubyObject arg) op_mul19(ThreadContext context, IRubyObject arg) Deprecated.op_plus(ThreadContext context, IRubyObject b) op_plus19(ThreadContext context, IRubyObject b) Deprecated.op_pow(IRubyObject arg) Deprecated.op_pow(ThreadContext context, IRubyObject exp) op_pow19(IRubyObject exp) Deprecated.op_pow19(ThreadContext context, IRubyObject exp) Deprecated.op_quo(ThreadContext context, IRubyObject other) op_quo19(ThreadContext context, IRubyObject other) Deprecated.op_quo20(ThreadContext context, IRubyObject other) Deprecated.op_uminus(ThreadContext context) num_uminusop_uplus()num_uplusprivate static booleanprivate static booleanprivate BigDecimalpowNegative(int times) precs(ThreadContext context) private RubyBigDecimalquoImpl(ThreadContext context, RubyBigDecimal that) remainder(ThreadContext context, IRubyObject arg) num_remainderremainder19(ThreadContext context, IRubyObject arg) Deprecated.private IRubyObjectremainderInternal(ThreadContext context, RubyBigDecimal val, IRubyObject arg) private static Stringround(ThreadContext context, IRubyObject[] args) round(ThreadContext context, IRubyObject scale, IRubyObject mode) private static intsafeLongToInt(long longValue) static IRubyObjectsave_exception_mode(ThreadContext context, IRubyObject recv, Block block) static IRubyObjectsave_limit(ThreadContext context, IRubyObject recv, Block block) static IRubyObjectsave_rounding_mode(ThreadContext context, IRubyObject recv, Block block) private RubyBigDecimalprivate RubyBigDecimalsetResult(int prec) private static BigIntegersign()private RubyFixnumprivate static JavaSites.BigDecimalSitessites(ThreadContext context) split(ThreadContext context) private Stringsqrt(IRubyObject arg) sub2(ThreadContext context, IRubyObject b, IRubyObject n) sub219(ThreadContext context, IRubyObject b, IRubyObject n) Deprecated.private IRubyObjectsubInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, int prec) private RubyBigDecimalsubSpecialCases(ThreadContext context, RubyBigDecimal val) to_f()final IRubyObjectto_int()(package private) final RubyIntegerto_int(ThreadContext context) num_to_intto_int19()Deprecated.to_r(ThreadContext context) to_s()rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj.to_s(IRubyObject[] args) Deprecated.to_s(ThreadContext context) to_s(ThreadContext context, IRubyObject arg) private static BigDecimaltoBigDecimal(RubyInteger value) private RubyFloatprivate static RubyIntegertoInteger(Ruby runtime, BigDecimal result) <T> TConvert the object to the specified Java class, if possible.toString()The default toString method is just a wrapper that calls the Ruby "to_s" method.private RubyStringtoStringImpl(Ruby runtime, String arg) truncate(ThreadContext context) MRI: num_truncatetruncate(ThreadContext context, IRubyObject arg) private RubyBigDecimaltruncateInternal(Ruby runtime, int arg) private Stringstatic IRubyObjectver(ThreadContext context, IRubyObject recv) Deprecated.private static IRubyObjectvpPrecLimit(Ruby runtime) zero_p()Deprecated.zero_p(ThreadContext context) num_zero_pMethods inherited from class org.jruby.RubyNumeric
abs, abs2, arg, asNumeric, callCoerced, callCoerced, callCoerced, callCoerced, ceil, checkInt, checkInt, coerceBin, coerceBin, coerceBit, coerceBit, coerceBody, coerceCmp, coerceCmp, coerceFailed, coerceRelOp, coerceRelOp, coerceRescue, compareWithZero, conjugate, convertToRational, createNumericClass, dbl_cmp, dbl2ival, dbl2num, denominator, div, div19, divmod19, doCoerce, dup, fdiv, finite_p, fix2int, fix2int, fix2long, fixable, float2long, float2ulong, floatStep, floatStepSize, floor, getCoerced, getRoundingMode, idiv, idiv, image, int2fix, integer_p, intervalStepSize, isNegative, isNegative, isPositive, isPositive, isReal, magnitude, modulo, modulo19, negativeInt, negFixable, negFixable, newNumeric, num_imaginary, num2chr, num2dbl, num2dbl, num2fix, num2int, num2long, num2ulong, numerator, numFuncall, numFuncall, numRemainder, op_cmp, op_not, op_num_equal, polar, posFixable, posFixable, positiveInt, quo, quo_19, rbClone, rbClone, rbClone, rbClone, real, real_p, rect, round, round, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, str2inum, to_c, truncateMethods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, dig1, dig2, eqlInternal, equalInternal, equals, hashCode, inspect, puts, specificEval, toRubyStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToHash, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, ensureInstanceVariablesSettable, eql, eql_p, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInstanceVariables, 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, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method, method_missing, method_missing19, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal, 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, singleton_method_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type, type_deprecated, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
-
Field Details
-
ROUND_DOWN
public static final int ROUND_DOWN -
ROUND_CEILING
public static final int ROUND_CEILING -
ROUND_UP
public static final int ROUND_UP -
ROUND_HALF_DOWN
public static final int ROUND_HALF_DOWN -
ROUND_HALF_EVEN
public static final int ROUND_HALF_EVEN -
ROUND_HALF_UP
public static final int ROUND_HALF_UP -
ROUND_FLOOR
public static final int ROUND_FLOOR -
SIGN_POSITIVE_INFINITE
public static final int SIGN_POSITIVE_INFINITE- See Also:
-
SIGN_POSITIVE_ZERO
public static final int SIGN_POSITIVE_ZERO- See Also:
-
SIGN_NEGATIVE_FINITE
public static final int SIGN_NEGATIVE_FINITE- See Also:
-
SIGN_NaN
public static final int SIGN_NaN- See Also:
-
BASE
public static final int BASE- See Also:
-
ROUND_MODE
public static final int ROUND_MODE- See Also:
-
SIGN_POSITIVE_FINITE
public static final int SIGN_POSITIVE_FINITE- See Also:
-
SIGN_NEGATIVE_INFINITE
public static final int SIGN_NEGATIVE_INFINITE- See Also:
-
SIGN_NEGATIVE_ZERO
public static final int SIGN_NEGATIVE_ZERO- See Also:
-
EXCEPTION_INFINITY
public static final int EXCEPTION_INFINITY- See Also:
-
EXCEPTION_OVERFLOW
public static final int EXCEPTION_OVERFLOW- See Also:
-
EXCEPTION_NaN
public static final int EXCEPTION_NaN- See Also:
-
EXCEPTION_UNDERFLOW
public static final int EXCEPTION_UNDERFLOW- See Also:
-
EXCEPTION_ZERODIVIDE
public static final int EXCEPTION_ZERODIVIDE- See Also:
-
EXCEPTION_ALL
public static final int EXCEPTION_ALL- See Also:
-
VERSION
-
VP_DOUBLE_FIG
private static final short VP_DOUBLE_FIG- See Also:
-
RMPD_COMPONENT_FIGURES
private static final short RMPD_COMPONENT_FIGURES- See Also:
-
BASE_FIG
private static final short BASE_FIG- See Also:
-
SQRT_10
private static final double SQRT_10- See Also:
-
NEGATIVE_ZERO_LONG_BITS
private static final long NEGATIVE_ZERO_LONG_BITS -
isNaN
private boolean isNaN -
infinitySign
private int infinitySign -
zeroSign
private int zeroSign -
value
-
absStripTrailingZeros
-
MAX_FIX
-
MIN_FIX
-
FRACTIONAL_DIGIT_GROUPS
-
-
Constructor Details
-
RubyBigDecimal
-
RubyBigDecimal
-
RubyBigDecimal
-
RubyBigDecimal
-
RubyBigDecimal
-
RubyBigDecimal
-
RubyBigDecimal
RubyBigDecimal(Ruby runtime, RubyClass klass, BigDecimal value, int zeroSign, int infinitySign, boolean isNaN) -
RubyBigDecimal
Deprecated. -
RubyBigDecimal
Deprecated.
-
-
Method Details
-
createBigDecimal
-
getValue
-
getNativeClassIndex
Description copied from class:RubyObjectThis 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:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin classRubyObject- See Also:
-
_dump
-
_dump
-
_load
-
double_fig
-
limit
Retrieve vpPrecLimit. -
limit
Set new vpPrecLimit if Fixnum and return the old value. -
save_limit
-
save_exception_mode
-
save_rounding_mode
-
interpret_loosely
public static IRubyObject interpret_loosely(ThreadContext context, IRubyObject recv, IRubyObject str) -
modeExecute
private static IRubyObject modeExecute(ThreadContext context, RubyModule BigDecimal, Block block, String intVariableName) -
mode
-
bigDecimalVar
-
getRoundingMode
-
isNaNExceptionMode
-
isInfinityExceptionMode
-
isOverflowExceptionMode
-
isUnderflowExceptionMode
-
isZeroDivideExceptionMode
-
cannotBeCoerced
private static RubyBigDecimal cannotBeCoerced(ThreadContext context, IRubyObject value, boolean must) -
errMessageType
-
toBigDecimal
-
getVpRubyObjectWithPrecInner
private static RubyBigDecimal getVpRubyObjectWithPrecInner(ThreadContext context, RubyRational value, RoundingMode mode) -
getVpValueWithPrec
-
getVpValue
-
induced_from
-
newInstance
-
newInstance
private static RubyBigDecimal newInstance(Ruby runtime, IRubyObject recv, RubyFixnum arg, MathContext mathContext) -
newInstance
private static RubyBigDecimal newInstance(ThreadContext context, RubyRational arg, MathContext mathContext) -
newInstance
private static RubyBigDecimal newInstance(Ruby runtime, IRubyObject recv, RubyFloat arg, MathContext mathContext) -
newFloatSpecialCases
-
newInstance
private static RubyBigDecimal newInstance(Ruby runtime, IRubyObject recv, RubyBignum arg, MathContext mathContext) -
newInstance
private static IRubyObject newInstance(ThreadContext context, RubyClass recv, RubyString arg, MathContext mathContext, boolean strict, boolean exception) -
handleInvalidArgument
private static IRubyObject handleInvalidArgument(ThreadContext context, RubyString arg, boolean strict, boolean exception) -
invalidArgumentError
-
contentEquals
-
isZeroBase
private static boolean isZeroBase(char[] str, int off, int end) -
isExponentOutOfRange
private static boolean isExponentOutOfRange(char[] str, int off, int end) -
newInstance
Deprecated. -
new_
@Deprecated public static IRubyObject new_(ThreadContext context, IRubyObject recv, IRubyObject arg) Deprecated. -
new_
@Deprecated public static IRubyObject new_(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg) Deprecated. -
new_
@Deprecated public static IRubyObject new_(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg, IRubyObject opts) Deprecated. -
newInstance
-
newInstance
public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, boolean strict, boolean exception) -
handleMissingPrecision
private static IRubyObject handleMissingPrecision(ThreadContext context, String name, boolean strict, boolean exception) -
newInstance
public static RubyBigDecimal newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg) -
newInstance
public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg, boolean strict, boolean exception) -
newZero
-
newNaN
-
newNaNFloatDomainError
-
newInfinity
-
newInfinityFloatDomainError
-
setResult
-
setResult
-
absStripTrailingZeros
-
hash
Description copied from class:RubyBasicObjectrb_obj_id 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:
hashin classRubyBasicObject
-
initialize_copy
Description copied from class:RubyNumericnum_init_copy- Overrides:
initialize_copyin classRubyNumeric
-
op_mod
-
op_mod19
Deprecated. -
remainder
Description copied from class:RubyNumericnum_remainder- Overrides:
remainderin classRubyNumeric
-
remainder19
Deprecated. -
remainderInternal
-
op_mul
-
op_mul19
Deprecated. -
mult2
-
multImpl
-
checkOverUnderFlow
private static IRubyObject checkOverUnderFlow(Ruby runtime, ArithmeticException ex, boolean nullDefault, boolean strict, boolean exception) -
handleFloatDomainError
private static IRubyObject handleFloatDomainError(Ruby runtime, String message, boolean strict, boolean exception) -
mult219
Deprecated. -
newPowOfInfinity
-
newPowOfZero
-
vpPrecLimit
-
getPrecLimit
-
op_pow
Deprecated. -
op_pow
-
op_pow19
Deprecated. -
op_pow19
Deprecated. -
powNegative
-
op_plus
- Overrides:
op_plusin classRubyNumeric
-
op_plus19
Deprecated. -
add2
-
add219
Deprecated. -
addInternal
private IRubyObject addInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, IRubyObject digits) -
getPositiveInt
-
addSpecialCases
-
op_uplus
Description copied from class:RubyNumericnum_uplus- Overrides:
op_uplusin classRubyNumeric
-
op_uminus
Description copied from class:RubyNumericnum_uminus- Overrides:
op_uminusin classRubyNumeric
-
op_minus
- Overrides:
op_minusin classRubyNumeric
-
op_minus19
Deprecated. -
sub2
-
sub219
Deprecated. -
subInternal
-
subSpecialCases
-
op_quo
-
quoImpl
-
divide
-
shiftLeftOneBit
-
safeLongToInt
private static int safeLongToInt(long longValue) -
div2Impl
-
op_quo19
Deprecated. -
op_quo20
Deprecated. -
op_div
-
idiv
-
toInteger
-
op_div
-
divSpecialCases
-
op_div19
Deprecated. -
op_div19
@Deprecated public final IRubyObject op_div19(ThreadContext context, IRubyObject other, IRubyObject digits) Deprecated. -
cmp
-
falsyEqlCheck
-
op_cmp
- Overrides:
op_cmpin classRubyBasicObject
-
eql_p
Description copied from class:RubyNumericnum_eql- Overrides:
eql_pin classRubyNumeric
-
op_eqq
Description copied from class:RubyObjectrb_equal The Ruby "===" method is used by default in case/when statements. The Object implementation first checks Java identity equality and then calls the "==" method too.- Specified by:
op_eqqin interfaceIRubyObject- Overrides:
op_eqqin classRubyObject
-
op_lt
-
op_le
-
op_gt
-
op_ge
-
abs
-
ceil
-
ceil
Description copied from class:RubyNumericMRI: num_ceil- Overrides:
ceilin classRubyNumeric
-
coerce
Description copied from class:RubyNumericnum_coerce- Overrides:
coercein classRubyNumeric
-
coerce
-
getDoubleValue
public double getDoubleValue()- Overrides:
getDoubleValuein classRubyNumeric
-
getLongValue
public long getLongValue()Description copied from class:RubyNumericReturn the value of this numeric as a 64-bit long. If the value does not fit in 64 bits, it will be truncated.- Overrides:
getLongValuein classRubyNumeric
-
getIntValue
public int getIntValue()Description copied from class:RubyNumericReturn the value of this numeric as a 32-bit long. If the value does not fit in 32 bits, it will be truncated.- Overrides:
getIntValuein classRubyNumeric
-
getBigIntegerValue
- Overrides:
getBigIntegerValuein classRubyNumeric
-
getBigDecimalValue
-
multiplyWith
-
multiplyWith
-
multiplyWith
-
divmod
Description copied from class:RubyNumericnum_divmod- Overrides:
divmodin classRubyNumeric
-
exponent
-
finite_p
-
floorNaNInfinityCheck
-
floorImpl
-
floor
Description copied from class:RubyNumericMRI: num_floor- Overrides:
floorin classRubyNumeric
-
floor
-
frac
-
infinite_p
- Overrides:
infinite_pin classRubyNumeric
-
inspect
-
nan_p
-
nonzero_p
Description copied from class:RubyNumericnum_nonzero_p- Overrides:
nonzero_pin classRubyNumeric
-
nonzero_p
Deprecated. -
precs
-
round
-
round
-
javaRoundingModeFromRubyRoundingMode
private static RoundingMode javaRoundingModeFromRubyRoundingMode(ThreadContext context, IRubyObject arg) -
sign
-
signValue
-
split
-
splitDigits
-
getSignificantDigits
-
getAllDigits
-
getExponent
private int getExponent() -
sqrt
-
getPrecisionInt
-
to_f
-
toFloat
-
convertToFloat
Description copied from class:RubyBasicObjectTries to convert this object to a Ruby Float using the "to_f" method.- Specified by:
convertToFloatin interfaceIRubyObject- Overrides:
convertToFloatin classRubyBasicObject- Returns:
- float representation of this
-
to_int
-
to_int
Description copied from class:RubyNumericnum_to_int- Overrides:
to_intin classRubyNumeric
-
to_int
-
convertToInteger
Description copied from class:RubyBasicObjectTries to convert this object to a Ruby Integer using the "to_int" method.- Specified by:
convertToIntegerin interfaceIRubyObject- Overrides:
convertToIntegerin classRubyBasicObject- Returns:
- an integer representation of this
-
to_r
-
to_int19
Deprecated. -
removeTrailingZeroes
-
formatHasLeadingPlus
-
formatHasLeadingSpace
-
formatHasFloatingPointNotation
-
formatFractionalDigitGroups
-
posSpace
-
posSign
-
groups
-
isZero
public final boolean isZero()- Overrides:
isZeroin classRubyNumeric
-
isNaN
private boolean isNaN() -
isInfinity
private boolean isInfinity() -
unscaledValue
-
appendSign
-
engineeringValue
-
floatingPointValue
-
to_s
Description copied from class:RubyBasicObjectrb_any_to_s call-seq: obj.to_s => string Returns a string representing obj. The defaultto_sprints 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.''- Overrides:
to_sin classRubyBasicObject
-
to_s
-
to_s
-
toStringImpl
-
toString
Description copied from class:RubyObjectThe default toString method is just a wrapper that calls the Ruby "to_s" method.- Overrides:
toStringin classRubyObject
-
to_s
Deprecated. -
fix
-
truncateInternal
-
truncate
Description copied from class:RubyNumericMRI: num_truncate- Overrides:
truncatein classRubyNumeric
-
truncate
-
zero_p
Description copied from class:RubyNumericnum_zero_p- Overrides:
zero_pin classRubyNumeric
-
zero_p
Deprecated. -
toJava
Description copied from interface:IRubyObjectConvert the object to the specified Java class, if possible.- Specified by:
toJavain interfaceIRubyObject- Overrides:
toJavain classRubyNumeric- Parameters:
target- The target type to which the object should be converted.- See Also:
-
bigSqrt
Returns the correctly rounded square root of a positive BigDecimal. This method performs the fast Square Root by Coupled Newton Iteration algorithm by Timm Ahrendt, from the book "Pi, unleashed" by Jörg Arndt in a neat loop.The code is based on Frans Lelieveld's code , used here with permission.
- Parameters:
squarD- The number to get the root from.rootMC- Precision and rounding mode.- Returns:
- the root of the argument number
- Throws:
ArithmeticException- if the argument number is negativeIllegalArgumentException- if rootMC has precision 0
-
checkFloatDomain
private void checkFloatDomain() -
infinityString
-
isEven
-
ver
Deprecated. -
sites
-