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_ALLOCATOROBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_FNULL_ARRAY| Constructor and Description |
|---|
RubyBigDecimal(Ruby runtime,
java.math.BigDecimal value) |
RubyBigDecimal(Ruby runtime,
RubyClass klass) |
abs, abs2, arg, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerceBin, coerceBody, coerceCmp, coerceRelOp, conjugate, createNumericClass, dbl_cmp, dbl2num, denominator, div, div19, divmod19, doCoerce, fdiv, fix2int, fix2int, fix2long, floatStep, floor, getCoerced, image, initialize_copy, int2fix, integer_p, magnitude, modulo, modulo19, newNumeric, nonzero_p, num_imaginary, num2chr, num2dbl, num2fix, num2int, num2long, numerator, op_cmp, op_num_equal, op_uminus, polar, quo_19, quo, real, rect, round, sadded, scalar_p, step, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava, zero_pattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, equals, getNativeTypeIndex, hashCode, initialize, op_eqq, puts, specificEval, toStringaddFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize19, initialize19, initialize19, initialize19, initialize19, initObjectId, 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, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_equal_19, op_equal, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, 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, send19, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_s, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderpublic 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 EXCEPTION_OVERFLOW
public static final int SIGN_POSITIVE_ZERO
public static final int EXCEPTION_ALL
public static final int SIGN_NEGATIVE_FINITE
public static final int EXCEPTION_UNDERFLOW
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 EXCEPTION_INFINITY
public static final int SIGN_NEGATIVE_INFINITE
public static final int EXCEPTION_ZERODIVIDE
public static final int SIGN_NEGATIVE_ZERO
public static final int EXCEPTION_NaN
public RubyBigDecimal(Ruby runtime, java.math.BigDecimal value)
public java.math.BigDecimal getValue()
public static RubyBigDecimal newBigDecimal(IRubyObject recv, IRubyObject[] args, Block unusedBlock)
public static IRubyObject ver(IRubyObject recv)
public IRubyObject dump(IRubyObject[] args, Block unusedBlock)
public static RubyBigDecimal load(IRubyObject recv, IRubyObject from, Block block)
public static IRubyObject double_fig(IRubyObject recv)
public static IRubyObject limit(IRubyObject recv, IRubyObject[] args)
public static IRubyObject mode(ThreadContext context, IRubyObject recv, IRubyObject[] args)
public static IRubyObject induced_from(IRubyObject recv, IRubyObject arg)
public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args)
public RubyFixnum hash()
RubyBasicObjecthash in class RubyBasicObjectpublic IRubyObject op_mod(ThreadContext context, IRubyObject arg)
public IRubyObject remainder(ThreadContext context, IRubyObject arg)
RubyNumericremainder in class RubyNumericpublic IRubyObject op_mul(ThreadContext context, IRubyObject arg)
public IRubyObject mult2(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject op_pow(IRubyObject arg)
public IRubyObject op_plus(ThreadContext context, IRubyObject b)
public IRubyObject add2(ThreadContext context, IRubyObject b, IRubyObject digits)
public IRubyObject op_uplus()
RubyNumericop_uplus in class RubyNumericpublic IRubyObject op_minus(ThreadContext context, IRubyObject arg)
public IRubyObject sub2(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject op_uminus()
public IRubyObject op_quo(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(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_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(IRubyObject[] args)
public IRubyObject ceil19(IRubyObject[] args)
public IRubyObject coerce(IRubyObject other)
RubyNumericcoerce in class RubyNumericpublic double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
getLongValue in class RubyNumericpublic java.math.BigInteger getBigIntegerValue()
getBigIntegerValue in class RubyNumericpublic 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(IRubyObject[] args)
public IRubyObject floor19(IRubyObject[] args)
public IRubyObject frac()
public IRubyObject infinite_p()
public IRubyObject inspect(ThreadContext context)
public IRubyObject nan_p()
public IRubyObject nonzero_p()
public IRubyObject precs()
@Deprecated public IRubyObject round(IRubyObject[] args)
public IRubyObject round(ThreadContext context, IRubyObject[] args)
public IRubyObject sign()
public RubyArray split()
public IRubyObject sqrt(IRubyObject arg)
public IRubyObject to_f()
public IRubyObject to_int()
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 IRubyObject to_s(IRubyObject[] args)
public IRubyObject fix()
public IRubyObject truncate()
RubyNumerictruncate in class RubyNumericpublic IRubyObject truncate(IRubyObject arg)
public IRubyObject zero_p()
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 0http://oldblog.novaloka.nl/blogger.xs4all.nl/novaloka/archive/2007/09/15/295396.htmlCopyright © 2002-2009 JRuby Team. All Rights Reserved.