public class RubyBigDecimal extends RubyNumeric
Modifier and Type | Class and Description |
---|---|
static class |
RubyBigDecimal.BigDecimalKernelMethods |
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException
RubyObject.Data
RubyBasicObject.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_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 |
---|
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, num2fix, num2int, num2long, numerator, numFuncall, numFuncall, numRemainder, op_cmp, op_not, op_num_equal, polar, posFixable, posFixable, positiveInt, quo_19, quo, rbClone, real_p, real, rect, round, round, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, truncate
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, equals, hashCode, inspect, puts, specificEval, toRubyString
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_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, 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, rbClone, rbClone, 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, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
public 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()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public 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()
RubyBasicObject
hash
in class RubyBasicObject
public IRubyObject initialize_copy(IRubyObject original)
RubyNumeric
initialize_copy
in class RubyNumeric
public IRubyObject op_mod(ThreadContext context, IRubyObject other)
@Deprecated public IRubyObject op_mod19(ThreadContext context, IRubyObject arg)
public IRubyObject remainder(ThreadContext context, IRubyObject arg)
RubyNumeric
remainder
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()
RubyNumeric
op_uplus
in class RubyNumeric
public IRubyObject op_uminus(ThreadContext context)
RubyNumeric
op_uminus
in class RubyNumeric
public 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 RubyBasicObject
public IRubyObject eql_p(ThreadContext context, IRubyObject arg)
RubyNumeric
eql_p
in class RubyNumeric
public IRubyObject op_eqq(ThreadContext context, IRubyObject arg)
RubyObject
op_eqq
in interface IRubyObject
op_eqq
in class RubyObject
public 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)
RubyNumeric
ceil
in class RubyNumeric
public IRubyObject coerce(IRubyObject other)
RubyNumeric
coerce
in class RubyNumeric
public RubyArray coerce(ThreadContext context, IRubyObject other)
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 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)
RubyNumeric
divmod
in class RubyNumeric
public IRubyObject exponent()
public IRubyObject finite_p()
public IRubyObject floor(ThreadContext context)
RubyNumeric
floor
in class RubyNumeric
public IRubyObject floor(ThreadContext context, IRubyObject arg)
public IRubyObject frac(ThreadContext context)
public IRubyObject infinite_p(ThreadContext context)
infinite_p
in class RubyNumeric
public IRubyObject inspect(ThreadContext context)
public IRubyObject nan_p(ThreadContext context)
public IRubyObject nonzero_p(ThreadContext context)
RubyNumeric
nonzero_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()
RubyBasicObject
convertToFloat
in interface IRubyObject
convertToFloat
in class RubyBasicObject
public final IRubyObject to_int()
public IRubyObject to_int(ThreadContext context)
RubyNumeric
to_int
in class RubyNumeric
public RubyInteger convertToInteger()
RubyBasicObject
convertToInteger
in interface IRubyObject
convertToInteger
in class RubyBasicObject
public 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 RubyNumeric
public IRubyObject 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 RubyBasicObject
public RubyString to_s(ThreadContext context)
public RubyString to_s(ThreadContext context, IRubyObject arg)
public java.lang.String toString()
RubyObject
toString
in class RubyObject
@Deprecated public IRubyObject to_s(IRubyObject[] args)
public IRubyObject fix()
public IRubyObject truncate(ThreadContext context)
RubyNumeric
truncate
in class RubyNumeric
public IRubyObject truncate(ThreadContext context, IRubyObject arg)
public IRubyObject zero_p(ThreadContext context)
RubyNumeric
zero_p
in class RubyNumeric
@Deprecated public IRubyObject zero_p()
public <T> T toJava(java.lang.Class<T> target)
IRubyObject
toJava
in interface IRubyObject
toJava
in class RubyNumeric
target
- 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-2018 JRuby. All Rights Reserved.