public class RubyBigDecimal extends RubyNumeric
| Modifier and Type | Class and Description |
|---|---|
static class |
RubyBigDecimal.BigDecimalKernelMethods |
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeExceptionRubyObject.DataRubyBasicObject.Finalizer| Modifier and Type | Field and Description |
|---|---|
static int |
BASE |
static int |
EXCEPTION_ALL |
static int |
EXCEPTION_INFINITY |
static int |
EXCEPTION_NaN |
static int |
EXCEPTION_OVERFLOW |
static int |
EXCEPTION_UNDERFLOW |
static int |
EXCEPTION_ZERODIVIDE |
static int |
ROUND_CEILING |
static int |
ROUND_DOWN |
static int |
ROUND_FLOOR |
static int |
ROUND_HALF_DOWN |
static int |
ROUND_HALF_EVEN |
static int |
ROUND_HALF_UP |
static int |
ROUND_MODE |
static int |
ROUND_UP |
static int |
SIGN_NaN |
static int |
SIGN_NEGATIVE_FINITE |
static int |
SIGN_NEGATIVE_INFINITE |
static int |
SIGN_NEGATIVE_ZERO |
static int |
SIGN_POSITIVE_FINITE |
static int |
SIGN_POSITIVE_INFINITE |
static int |
SIGN_POSITIVE_ZERO |
DBL_EPSILON, NUMERIC_ALLOCATORIVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_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, varTableStampNULL_ARRAY| Constructor and Description |
|---|
RubyBigDecimal(Ruby runtime,
java.math.BigDecimal value) |
RubyBigDecimal(Ruby runtime,
java.math.BigDecimal value,
boolean isNan) |
RubyBigDecimal(Ruby runtime,
java.math.BigDecimal value,
int infinitySign) |
RubyBigDecimal(Ruby runtime,
java.math.BigDecimal value,
int infinitySign,
int zeroSign) |
RubyBigDecimal(Ruby runtime,
RubyBigDecimal rbd)
Deprecated.
|
RubyBigDecimal(Ruby runtime,
RubyClass klass) |
RubyBigDecimal(Ruby runtime,
RubyClass klass,
java.math.BigDecimal value) |
RubyBigDecimal(Ruby runtime,
RubyClass klass,
RubyBigDecimal rbd)
Deprecated.
|
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, 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, numerator, numFuncall, numFuncall, numRemainder, op_cmp, op_not, op_num_equal, polar, posFixable, posFixable, positiveInt, quo_19, quo, rbClone, rbClone, rbClone, rbClone, real_p, real, rect, round, round, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, truncateattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, equals, hashCode, inspect, puts, specificEval, toRubyStringaddFinalizer, 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_p, 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, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, 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, isImmediate, 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_equal, 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, yieldUnderclone, finalize, getClass, notify, notifyAll, wait, wait, waitarraypublic static final int ROUND_DOWN
public static final int ROUND_CEILING
public static final int ROUND_UP
public static final int ROUND_HALF_DOWN
public static final int ROUND_HALF_EVEN
public static final int ROUND_HALF_UP
public static final int ROUND_FLOOR
public static final int SIGN_POSITIVE_INFINITE
public static final int SIGN_POSITIVE_ZERO
public static final int SIGN_NEGATIVE_FINITE
public static final int SIGN_NaN
public static final int BASE
public static final int ROUND_MODE
public static final int SIGN_POSITIVE_FINITE
public static final int SIGN_NEGATIVE_INFINITE
public static final int SIGN_NEGATIVE_ZERO
public static final int EXCEPTION_INFINITY
public static final int EXCEPTION_OVERFLOW
public static final int EXCEPTION_NaN
public static final int EXCEPTION_UNDERFLOW
public static final int EXCEPTION_ZERODIVIDE
public static final int EXCEPTION_ALL
public RubyBigDecimal(Ruby runtime, java.math.BigDecimal value)
public RubyBigDecimal(Ruby runtime, java.math.BigDecimal value, int infinitySign)
public RubyBigDecimal(Ruby runtime, java.math.BigDecimal value, int infinitySign, int zeroSign)
public RubyBigDecimal(Ruby runtime, java.math.BigDecimal value, boolean isNan)
@Deprecated public RubyBigDecimal(Ruby runtime, RubyBigDecimal rbd)
@Deprecated public RubyBigDecimal(Ruby runtime, RubyClass klass, RubyBigDecimal rbd)
public java.math.BigDecimal getValue()
public ClassIndex getNativeClassIndex()
RubyObjectgetNativeClassIndex in interface CoreObjectTypegetNativeClassIndex in class RubyObjectClassIndexpublic static IRubyObject ver(ThreadContext context, IRubyObject recv)
public IRubyObject _dump(ThreadContext context)
public IRubyObject _dump(ThreadContext context, IRubyObject unused)
public static RubyBigDecimal _load(ThreadContext context, IRubyObject recv, IRubyObject from)
public static IRubyObject double_fig(ThreadContext context, IRubyObject recv)
public static IRubyObject limit(ThreadContext context, IRubyObject recv)
public static IRubyObject limit(ThreadContext context, IRubyObject recv, IRubyObject arg)
public static IRubyObject save_limit(ThreadContext context, IRubyObject recv, Block block)
public static IRubyObject save_exception_mode(ThreadContext context, IRubyObject recv, Block block)
public static IRubyObject save_rounding_mode(ThreadContext context, IRubyObject recv, Block block)
public static IRubyObject mode(ThreadContext context, IRubyObject recv, IRubyObject[] args)
public static IRubyObject induced_from(ThreadContext context, IRubyObject recv, IRubyObject arg)
@Deprecated public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args)
@Deprecated public static RubyBigDecimal new_(ThreadContext context, IRubyObject recv, IRubyObject arg)
@Deprecated public static RubyBigDecimal new_(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg)
public static RubyBigDecimal newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg)
public static RubyBigDecimal newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg)
public RubyFixnum hash()
RubyBasicObjecthash in class RubyBasicObjectpublic IRubyObject initialize_copy(IRubyObject original)
RubyNumericinitialize_copy in class RubyNumericpublic IRubyObject op_mod(ThreadContext context, IRubyObject other)
@Deprecated public IRubyObject op_mod19(ThreadContext context, IRubyObject arg)
public IRubyObject remainder(ThreadContext context, IRubyObject arg)
RubyNumericremainder in class RubyNumeric@Deprecated public IRubyObject remainder19(ThreadContext context, IRubyObject arg)
public IRubyObject op_mul(ThreadContext context, IRubyObject arg)
@Deprecated public IRubyObject op_mul19(ThreadContext context, IRubyObject arg)
public IRubyObject mult2(ThreadContext context, IRubyObject b, IRubyObject n)
@Deprecated public IRubyObject mult219(ThreadContext context, IRubyObject b, IRubyObject n)
@Deprecated public IRubyObject op_pow(IRubyObject arg)
public RubyBigDecimal op_pow(ThreadContext context, IRubyObject exp)
@Deprecated public IRubyObject op_pow19(IRubyObject exp)
@Deprecated public RubyBigDecimal op_pow19(ThreadContext context, IRubyObject exp)
public IRubyObject op_plus(ThreadContext context, IRubyObject b)
op_plus in class RubyNumeric@Deprecated public IRubyObject op_plus19(ThreadContext context, IRubyObject b)
public IRubyObject add2(ThreadContext context, IRubyObject b, IRubyObject digits)
@Deprecated public IRubyObject add219(ThreadContext context, IRubyObject b, IRubyObject digits)
public IRubyObject op_uplus()
RubyNumericop_uplus in class RubyNumericpublic IRubyObject op_uminus(ThreadContext context)
RubyNumericop_uminus in class RubyNumericpublic IRubyObject op_minus(ThreadContext context, IRubyObject b)
@Deprecated public IRubyObject op_minus19(ThreadContext context, IRubyObject b)
public IRubyObject sub2(ThreadContext context, IRubyObject b, IRubyObject n)
@Deprecated public IRubyObject sub219(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject op_quo(ThreadContext context, IRubyObject other)
@Deprecated public IRubyObject op_quo19(ThreadContext context, IRubyObject other)
@Deprecated public IRubyObject op_quo20(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject other, IRubyObject digits)
@Deprecated public final IRubyObject op_div19(ThreadContext context, IRubyObject r)
@Deprecated public final IRubyObject op_div19(ThreadContext context, IRubyObject other, IRubyObject digits)
public IRubyObject op_cmp(ThreadContext context, IRubyObject arg)
op_cmp in class RubyBasicObjectpublic IRubyObject eql_p(ThreadContext context, IRubyObject arg)
RubyNumericeql_p in class RubyNumericpublic IRubyObject op_eqq(ThreadContext context, IRubyObject arg)
RubyObjectop_eqq in interface IRubyObjectop_eqq in class RubyObjectpublic IRubyObject op_lt(ThreadContext context, IRubyObject arg)
public IRubyObject op_le(ThreadContext context, IRubyObject arg)
public IRubyObject op_gt(ThreadContext context, IRubyObject arg)
public IRubyObject op_ge(ThreadContext context, IRubyObject arg)
public IRubyObject abs()
public IRubyObject ceil(ThreadContext context, IRubyObject arg)
public IRubyObject ceil(ThreadContext context)
RubyNumericceil in class RubyNumericpublic IRubyObject coerce(IRubyObject other)
RubyNumericcoerce in class RubyNumericpublic RubyArray coerce(ThreadContext context, IRubyObject other)
public double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
RubyNumericgetLongValue in class RubyNumericpublic int getIntValue()
RubyNumericgetIntValue in class RubyNumericpublic java.math.BigInteger getBigIntegerValue()
getBigIntegerValue in class RubyNumericpublic java.math.BigDecimal getBigDecimalValue()
public RubyNumeric multiplyWith(ThreadContext context, RubyInteger value)
public RubyNumeric multiplyWith(ThreadContext context, RubyFloat value)
public RubyNumeric multiplyWith(ThreadContext context, RubyBignum value)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
RubyNumericdivmod in class RubyNumericpublic IRubyObject exponent()
public IRubyObject finite_p()
public IRubyObject floor(ThreadContext context)
RubyNumericfloor in class RubyNumericpublic IRubyObject floor(ThreadContext context, IRubyObject arg)
public IRubyObject frac(ThreadContext context)
public IRubyObject infinite_p(ThreadContext context)
infinite_p in class RubyNumericpublic IRubyObject inspect(ThreadContext context)
public IRubyObject nan_p(ThreadContext context)
public IRubyObject nonzero_p(ThreadContext context)
RubyNumericnonzero_p in class RubyNumeric@Deprecated public IRubyObject nonzero_p()
public IRubyObject precs(ThreadContext context)
public IRubyObject round(ThreadContext context, IRubyObject[] args)
public IRubyObject round(ThreadContext context, IRubyObject scale, IRubyObject mode)
public IRubyObject sign()
public RubyArray split(ThreadContext context)
public IRubyObject sqrt(IRubyObject arg)
public IRubyObject to_f()
public RubyFloat convertToFloat()
RubyBasicObjectconvertToFloat in interface IRubyObjectconvertToFloat in class RubyBasicObjectpublic final IRubyObject to_int()
public IRubyObject to_int(ThreadContext context)
RubyNumericto_int in class RubyNumericpublic RubyInteger convertToInteger()
RubyBasicObjectconvertToInteger in interface IRubyObjectconvertToInteger in class RubyBasicObjectpublic IRubyObject to_r(ThreadContext context)
@Deprecated public IRubyObject to_int19()
public static boolean formatHasLeadingPlus(java.lang.String format)
public static boolean formatHasLeadingSpace(java.lang.String format)
public static boolean formatHasFloatingPointNotation(java.lang.String format)
public static int formatFractionalDigitGroups(java.lang.String format)
public final boolean isZero()
isZero in class RubyNumericpublic 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 RubyString to_s(ThreadContext context)
public RubyString to_s(ThreadContext context, IRubyObject arg)
public java.lang.String toString()
RubyObjecttoString in class RubyObject@Deprecated public IRubyObject to_s(IRubyObject[] args)
public IRubyObject fix()
public IRubyObject truncate(ThreadContext context)
RubyNumerictruncate in class RubyNumericpublic IRubyObject truncate(ThreadContext context, IRubyObject arg)
public IRubyObject zero_p(ThreadContext context)
RubyNumericzero_p in class RubyNumeric@Deprecated public IRubyObject zero_p()
public <T> T toJava(java.lang.Class<T> target)
IRubyObjecttoJava in interface IRubyObjecttoJava in class RubyNumerictarget - The target type to which the object should be converted.IRubyObject.toJava(java.lang.Class<T>)public static java.math.BigDecimal bigSqrt(java.math.BigDecimal squarD,
java.math.MathContext rootMC)
The code is based on Frans Lelieveld's code , used here with permission.
squarD - The number to get the root from.rootMC - Precision and rounding mode.java.lang.ArithmeticException - if the argument number is negativejava.lang.IllegalArgumentException - if rootMC has precision 0Copyright © 2001-2020 JRuby. All Rights Reserved.