Top Inners Fields Constructors Methods
org.jruby.ext.bigdecimal

public Class RubyBigDecimal

extends RubyNumeric
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, .MathContext, .RoundingMode, java.util.ArrayList, .List, .Locale, java.util.regex.Matcher, .Pattern, org.jruby.*, org.jruby.anno.JRubyConstant, .JRubyMethod, org.jruby.api.Access, .JRubyAPI, org.jruby.ast.util.ArgsUtil, org.jruby.exceptions.RaiseException, org.jruby.runtime.Arity, .Block, .ClassIndex, .JavaSites, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ByteList, .Numeric, .SafeDoubleParser, .StringSupport

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static enum

Field Summary

Modifier and TypeField and Description
private transient BigDecimal
public static final int
private static final short
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private static final Pattern
private int
private boolean
private static final BigDecimal
private static final BigDecimal
private static final long
private static final short
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private static final double
private BigDecimal
private static final ByteList
private static final short
private int
Inherited from org.jruby.RubyNumeric:
DBL_EPSILON

Constructor Summary

AccessConstructor and Description
public
RubyBigDecimal(Ruby runtime, RubyClass klass)

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)

pack-priv
RubyBigDecimal(Ruby runtime, RubyClass klass, BigDecimal value, int zeroSign, int infinitySign, boolean isNaN)

public
RubyBigDecimal(Ruby runtime, RubyBigDecimal rbd)
Deprecated

public
RubyBigDecimal(Ruby runtime, RubyClass klass, RubyBigDecimal rbd)
Deprecated

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
public IRubyObject
_dump(ThreadContext context, IRubyObject unused)

public static RubyBigDecimal
public IRubyObject
abs()
Deprecated since 10.0.

public IRubyObject
abs(ThreadContext context)

Overrides org.jruby.RubyNumeric.abs.

num_abs

private BigDecimal
public IRubyObject
private IRubyObject
private RubyBigDecimal
private static StringBuilder
appendSign(final StringBuilder buff, final String str, int signum)

public BigInteger
asBigInteger(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyNumeric.asBigInteger.

Return a BigInteger representation of this numerical value

public double
asDouble(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyNumeric.asDouble.

Return a double representation of this numerical value

public int
asInt(ThreadContext context)

Overrides org.jruby.RubyNumeric.asInt.

Returns the value of this numeric and a java int.

public long
asLong(ThreadContext context)

Overrides org.jruby.RubyNumeric.asLong.

Return the value of this numeric as a 64-bit long.

private IRubyObject
private static long
bigDecimalVar(ThreadContext context, String variableName)

public static BigDecimal

Returns:

the root of the argument number
bigSqrt
(BigDecimal
The number to get the root from.
squarD
,
MathContext
Precision and rounding mode.
rootMC
)

Returns the correctly rounded square root of a positive BigDecimal.

private static RubyBigDecimal
cannotBeCoerced(ThreadContext context, IRubyObject value, boolean must)

public IRubyObject
public IRubyObject
ceil(ThreadContext context)

Overrides org.jruby.RubyNumeric.ceil.

MRI: num_ceil

private void
private static IRubyObject
checkOverUnderFlow(ThreadContext context, final ArithmeticException ex, boolean nullDefault, boolean strict, boolean exception)

private IRubyObject
cmp(ThreadContext context, final IRubyObject arg, final char op)

public RubyArray<T extends IRubyObject>
coerce(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.coerce.

num_coerce

private static boolean
contentEquals(final String str1, final char[] str2, final int s2, final int e2)

public RubyFloat
convertToFloat()

Overrides org.jruby.RubyBasicObject.convertToFloat.

Implements org.jruby.runtime.builtin.IRubyObject.convertToFloat.

Tries to convert this object to a Ruby Float using the "to_f" method.

public RubyInteger
convertToInteger()

Overrides org.jruby.RubyBasicObject.convertToInteger.

Implements org.jruby.runtime.builtin.IRubyObject.convertToInteger.

Deprecated

Tries to convert this object to a Ruby Integer using the "to_int" method.

public static RubyClass
private static RubyBigDecimal
div2Impl(ThreadContext context, RubyNumeric a, RubyNumeric b, final int ix)

private static BigDecimal
divide(BigDecimal target, BigDecimal divisor, MathContext mc)

public IRubyObject
divmod(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.divmod.

num_divmod

private RubyBigDecimal
public static IRubyObject
private CharSequence
public IRubyObject
private static String
public IRubyObject
exponent()
Deprecated

public IRubyObject
private static boolean
falsyEqlCheck(final ThreadContext context, final IRubyObject arg)

public IRubyObject
public IRubyObject
finite_p()
Deprecated

public IRubyObject
fix()
Deprecated since 10.0.

public IRubyObject
fix(ThreadContext context)

private CharSequence
public IRubyObject
floor(ThreadContext context)

Overrides org.jruby.RubyNumeric.floor.

MRI: num_floor

public IRubyObject
private RubyBigDecimal
floorImpl(ThreadContext context, int n)

private RubyBigDecimal
public static int
public static boolean
public static boolean
public static boolean
public IRubyObject
private String
public BigDecimal
private int
private static RubyBigDecimal
getInfinity(ThreadContext context, final int sign)

private static RubyBigDecimal
getInfinity(ThreadContext context, final int sign, final RubyBigDecimal.InfinityErrorMsgType type)

private static RubyBigDecimal
public ClassIndex
getNativeClassIndex()

Overrides org.jruby.RubyObject.getNativeClassIndex.

Implements org.jruby.runtime.marshal.CoreObjectType.getNativeClassIndex.

This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.

private static int
private int
private static int
private int[]
private static int
private static RoundingMode
private String
public BigDecimal
private static RubyBigDecimal
private static RubyBigDecimal
getVpValue(ThreadContext context, IRubyObject value, boolean must)

private RubyBigDecimal
getVpValueWithPrec(ThreadContext context, IRubyObject value, boolean must)

private static RubyBigDecimal
getZero(ThreadContext context, final int sign)

private static int
private static IRubyObject
handleFloatDomainError(ThreadContext context, String message, boolean strict, boolean exception)

private static IRubyObject
handleInvalidArgument(ThreadContext context, RubyString arg, boolean strict, boolean exception)

private static IRubyObject
handleMissingPrecision(ThreadContext context, String name, boolean strict, boolean exception)

public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

private RubyInteger
public static IRubyObject
public IRubyObject
pack-priv static String
infinityString(final int infinitySign)

public IRubyObject
initialize_copy(ThreadContext
the thread context
context
,
IRubyObject
the original
original
)

Overrides org.jruby.RubyNumeric.initialize_copy.

num_init_copy

public IRubyObject
inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Returns a string containing a human-readable representation of obj.

public static IRubyObject
private static RaiseException
private static boolean
isEven(ThreadContext context, final RubyNumeric x)

private static boolean
isExponentOutOfRange(final char[] str, final int off, final int end)

private boolean
private static boolean
private boolean
private static boolean
private static boolean
private static boolean
public final boolean
private static boolean
isZeroBase(final char[] str, final int off, final int end)

private static boolean
private static RoundingMode
public static IRubyObject
limit(ThreadContext context, IRubyObject recv)

Retrieve vpPrecLimit.

public static IRubyObject
limit(ThreadContext context, IRubyObject recv, IRubyObject arg)

Set new vpPrecLimit if Fixnum and return the old value.

public static IRubyObject
mode(ThreadContext context, IRubyObject recv, IRubyObject[] args)

private static IRubyObject
modeExecute(final ThreadContext context, final RubyModule BigDecimal, final Block block, final String intVariableName)

public IRubyObject
private RubyBigDecimal
public RubyNumeric
public RubyNumeric
public RubyNumeric
public IRubyObject
public IRubyObject
private static RubyBigDecimal
private static RaiseException
newInfinityFloatDomainError(ThreadContext context, final int sign)

private static RaiseException
private static RubyBigDecimal
private static RubyBigDecimal
newInstance(ThreadContext context, IRubyObject recv, RubyFixnum arg, MathContext mathContext)

private static RubyBigDecimal
private static RubyBigDecimal
newInstance(ThreadContext context, IRubyObject recv, RubyFloat arg, MathContext mathContext)

private static RubyBigDecimal
newInstance(ThreadContext context, IRubyObject recv, RubyBignum arg, MathContext mathContext)

private static IRubyObject
newInstance(ThreadContext context, RubyClass recv, RubyString arg, MathContext mathContext, boolean strict, boolean exception)

public static RubyBigDecimal
newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg)
Deprecated

public static IRubyObject
newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, boolean strict, boolean exception)
Deprecated

public static RubyBigDecimal
public static IRubyObject
newInstance(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject mathArg, boolean strict, boolean exception)

private static RaiseException
private RubyBigDecimal
private RubyBigDecimal
public IRubyObject
nonzero_p(ThreadContext context)

Overrides org.jruby.RubyNumeric.nonzero_p.

num_nonzero_p

public IRubyObject
nonzero_p()
Deprecated

public IRubyObject
public IRubyObject
public IRubyObject
op_div(ThreadContext context, IRubyObject other, IRubyObject digits)

public IRubyObject
public IRubyObject
op_eqq(ThreadContext context, IRubyObject arg)

Overrides org.jruby.RubyObject.op_eqq.

Implements org.jruby.runtime.builtin.IRubyObject.op_eqq.

rb_equal The Ruby "===" method is used by default in case/when statements.

public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
op_quo(ThreadContext context, IRubyObject object, IRubyObject digits)

public IRubyObject
public IRubyObject
private static boolean
private static boolean
private BigDecimal
powNegative(ThreadContext context, final int times)

public IRubyObject
public RubyArray<T extends IRubyObject>
public IRubyObject
precs(ThreadContext context)
Deprecated

private RubyBigDecimal
public IRubyObject
private IRubyObject
private static String
public IRubyObject
round(ThreadContext context, IRubyObject[] args)

public IRubyObject
private static int
private static int
safeLongToInt(long longValue)

public static IRubyObject
public static IRubyObject
save_limit(ThreadContext context, IRubyObject recv, Block block)

public static IRubyObject
public IRubyObject
private RubyBigDecimal
private RubyBigDecimal
setResult(ThreadContext context, int prec)

private static BigInteger
public IRubyObject
public IRubyObject
private RubyFixnum
private static JavaSites.BigDecimalSites
sites(ThreadContext context)

Hides org.jruby.RubyNumeric.sites.

Retrieve the call sites for this class.

public RubyArray<T extends IRubyObject>
private String
public IRubyObject
sqrt(IRubyObject arg)
Deprecated since 10.0.

public IRubyObject
public IRubyObject
private IRubyObject
private RubyBigDecimal
public IRubyObject
to_f()
Deprecated since 10.0.

public IRubyObject
public final IRubyObject
to_int()
Deprecated since 10.0.

public IRubyObject
to_int(ThreadContext context)

Overrides org.jruby.RubyNumeric.to_int.

num_to_int

pack-priv final RubyInteger
to_int(Ruby runtime)
Deprecated since 10.0.

public IRubyObject
public RubyString
public RubyString
public IRubyObject
to_s(IRubyObject[] args)
Deprecated

private static BigDecimal
toBigDecimal(ThreadContext context, final RubyInteger value)

private RubyFloat
toFloat(ThreadContext context, final boolean checkFlow)

private static RubyInteger
toInteger(ThreadContext context, final BigDecimal result)

public <T> T
toJava(Class<T>
The target type to which the object should be converted.
target
)

Overrides org.jruby.RubyNumeric.toJava.

Implements org.jruby.runtime.builtin.IRubyObject.toJava.

Convert the object to the specified Java class, if possible.

public String
toString()

Overrides org.jruby.RubyObject.toString.

The default toString method is just a wrapper that calls the Ruby "to_s" method.

private RubyString
public IRubyObject
truncate(ThreadContext context)

Overrides org.jruby.RubyNumeric.truncate.

MRI: num_truncate

public IRubyObject
private RubyBigDecimal
truncateInternal(ThreadContext context, int arg)

private String
private static IRubyObject
public IRubyObject
zero_p(ThreadContext context)

Overrides org.jruby.RubyNumeric.zero_p.

num_zero_p

public IRubyObject
zero_p()
Deprecated

Inherited from org.jruby.RubyNumeric:
abs2argasNumericcallCoercedcallCoercedcallCoercedcallCoercedceilcheckIntcheckIntcoercecoerceBincoerceBincoerceBitcoerceBitcoerceCmpcoerceCmpcoerceFailedcoerceRelOpcoerceRelOpcoerceRescuecompareWithZeroconjugateconvertToRationalconvertToRationalcreateNumericClassdbl2ivaldbl2numdbl_cmpdenominatordivdoCoercedupfdivfix2intfix2intfix2longfixablefloat2longfloat2ulongfloatStepfloatStepSizefloorgetBigIntegerValuegetCoercedgetDoubleValuegetIntValuegetLongValuegetRoundingModeidividivimageint2fixinteger_pinteger_pintervalStepSizeisNegativeisNegativeisNegativeNumberisPositiveisPositiveisPositiveNumberisRealisZeromagnitudemodulonegativeIntnegFixablenegFixablenewNumericnum2chrnum2dblnum2dblnum2fixnum2fixnum2intnum2longnum2ulongnum_imaginarynumeratornumFuncallnumFuncallnumRemainderop_notop_num_equalop_upluspolarposFixableposFixablepositiveIntquorbClonerbClonerbClonerbClonerealreal_prectroundroundscalar_psingleton_method_addedstepstr2fnumstr2fnumstr2fnumstr2inumstr2inumstr2inumto_ctruncate