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
FIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, VAR_TABLE_OFFSET, varTable, varTableStamp
NULL_ARRAY
Constructor and Description |
---|
RubyBigDecimal(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) |
RubyBigDecimal(Ruby runtime,
RubyClass klass) |
RubyBigDecimal(Ruby runtime,
RubyClass klass,
BigDecimal value) |
RubyBigDecimal(Ruby runtime,
RubyClass klass,
RubyBigDecimal rbd) |
abs, abs2, arg, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerceBin, coerceBody, coerceCmp, coerceRelOp, conjugate, createNumericClass, dbl_cmp, dbl2num, denominator, div, div19, 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, truncate, zero_p
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, equals, getNativeTypeIndex, hashCode, initialize, initialize, inspect, op_eqq, puts, specificEval, toString
addFinalizer, 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, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getNativeHandle, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, 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, 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, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, 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, 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 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, BigDecimal value)
public RubyBigDecimal(Ruby runtime, RubyClass klass, BigDecimal value)
public RubyBigDecimal(Ruby runtime, BigDecimal value, int infinitySign)
public RubyBigDecimal(Ruby runtime, BigDecimal value, int infinitySign, int zeroSign)
public RubyBigDecimal(Ruby runtime, BigDecimal value, boolean isNan)
public RubyBigDecimal(Ruby runtime, RubyBigDecimal rbd)
public RubyBigDecimal(Ruby runtime, RubyClass klass, RubyBigDecimal rbd)
public 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 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(IRubyObject recv, IRubyObject arg)
public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args)
public RubyFixnum hash()
RubyBasicObject
hash
in class RubyBasicObject
public IRubyObject op_mod(ThreadContext context, IRubyObject arg)
public IRubyObject op_mod19(ThreadContext context, IRubyObject other)
public IRubyObject remainder(ThreadContext context, IRubyObject arg)
RubyNumeric
remainder
in class RubyNumeric
public IRubyObject remainder19(ThreadContext context, IRubyObject arg)
public IRubyObject op_mul(ThreadContext context, IRubyObject arg)
public IRubyObject op_mul19(ThreadContext context, IRubyObject arg)
public IRubyObject mult2(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject mult219(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject op_pow(IRubyObject arg)
public IRubyObject op_pow19(IRubyObject exp)
public IRubyObject op_plus(ThreadContext context, IRubyObject b)
public IRubyObject op_plus19(ThreadContext context, IRubyObject b)
public IRubyObject add2(ThreadContext context, IRubyObject b, IRubyObject digits)
public IRubyObject add219(ThreadContext context, IRubyObject b, IRubyObject digits)
public IRubyObject op_uplus()
RubyNumeric
op_uplus
in class RubyNumeric
public IRubyObject op_minus(ThreadContext context, IRubyObject b)
public IRubyObject op_minus19(ThreadContext context, IRubyObject b)
public IRubyObject sub2(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject sub219(ThreadContext context, IRubyObject b, IRubyObject n)
public IRubyObject op_uminus()
public IRubyObject op_quo(ThreadContext context, IRubyObject other)
public IRubyObject op_quo19(ThreadContext context, IRubyObject other)
public IRubyObject op_quo20(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div19(ThreadContext context, IRubyObject r)
public IRubyObject op_div(ThreadContext context, IRubyObject other, IRubyObject digits)
public 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_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)
RubyNumeric
coerce
in class RubyNumeric
public double getDoubleValue()
getDoubleValue
in class RubyNumeric
public long getLongValue()
getLongValue
in class RubyNumeric
public BigInteger getBigIntegerValue()
getBigIntegerValue
in class RubyNumeric
public 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 divmod19(ThreadContext context, IRubyObject other)
RubyNumeric
divmod19
in class RubyNumeric
public 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(String format)
public static boolean formatHasLeadingSpace(String format)
public static boolean formatHasFloatingPointNotation(String format)
public static int formatFractionalDigitGroups(String format)
public IRubyObject to_s(IRubyObject[] args)
public IRubyObject fix()
public IRubyObject truncate(IRubyObject[] args)
public IRubyObject truncate19(IRubyObject[] args)
public IRubyObject zero_p()
public static BigDecimal bigSqrt(BigDecimal squarD, 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.ArithmeticException
- if the argument number is negativeIllegalArgumentException
- if rootMC has precision 0http://oldblog.novaloka.nl/blogger.xs4all.nl/novaloka/archive/2007/09/15/295396.html
Copyright © 2001-2014 JRuby. All Rights Reserved.