Package org.jruby
Class RubyNumeric
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyNumeric
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
- Direct Known Subclasses:
RubyBigDecimal
,RubyComplex
,RubyFloat
,RubyInteger
,RubyRational
Base class for all numerical types in ruby.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated.static class
Deprecated.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
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, 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
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionRubyNumeric
(RubyClass metaClass) RubyNumeric
(Ruby runtime, RubyClass metaClass) RubyNumeric
(Ruby runtime, RubyClass metaClass, boolean useObjectSpace) RubyNumeric
(Ruby runtime, RubyClass metaClass, boolean useObjectSpace, boolean canBeTainted) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionabs
(ThreadContext context) num_absabs2
(ThreadContext context) numeric_abs2arg
(ThreadContext context) numeric_argasBigInteger
(ThreadContext context) Return a BigInteger representation of this numerical valuedouble
asDouble
(ThreadContext context) Return a double representation of this numerical valueint
asInt
(ThreadContext context) Returns the value of this numeric and a java int.long
asLong
(ThreadContext context) Return the value of this numeric as a 64-bit long.final IRubyObject
callCoerced
(ThreadContext context, String method, IRubyObject other) protected final IRubyObject
callCoerced
(ThreadContext context, String method, IRubyObject other, boolean err) final IRubyObject
callCoerced
(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObject
callCoerced
(ThreadContext context, CallSite site, IRubyObject other, boolean err) ceil()
Deprecated.ceil
(ThreadContext context) MRI: num_ceilstatic int
check_intstatic void
checkInt
(IRubyObject arg, long num) coerce
(IRubyObject other) Deprecated.coerce
(ThreadContext context, IRubyObject other) num_coerceprotected final IRubyObject
coerceBin
(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObject
coerceBin
(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObject
coerceBit
(ThreadContext context, String method, IRubyObject other) rb_num_coerce_bit coercion taking two argumentsprotected final IRubyObject
coerceBit
(ThreadContext context, JavaSites.CheckedSites site, IRubyObject other) protected final IRubyObject
coerceCmp
(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObject
coerceCmp
(ThreadContext context, CallSite site, IRubyObject other) protected final void
coerceFailed
(ThreadContext context, IRubyObject arg) coerce_failedprotected final IRubyObject
coerceRelOp
(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObject
coerceRelOp
(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObject
coerceRescue
(ThreadContext context, IRubyObject other) coerce_rescueprotected static IRubyObject
compareWithZero
(ThreadContext context, IRubyObject num, JavaSites.CheckedSites site) conjugate
(ThreadContext context) numeric_realDeprecated.convertToRational
(ThreadContext context) static RubyClass
createNumericClass
(ThreadContext context, RubyClass Object, RubyModule Comparable) static IRubyObject
rb_dbl_cmp (numeric.c)static RubyInteger
Deprecated.UseConvert.asInteger(ThreadContext, double)
instead.static IRubyObject
Deprecated.UseConvert.asFloat(ThreadContext, long)
instead.denominator
(ThreadContext context) numeric_denominatordiv
(ThreadContext context, IRubyObject other) MRI: num_divdivmod
(ThreadContext context, IRubyObject other) num_divmodprotected final RubyArray
doCoerce
(ThreadContext context, IRubyObject other, boolean err) do_coercedup()
RubyMethod dup.eql_p
(ThreadContext context, IRubyObject other) num_eqlfdiv
(ThreadContext context, IRubyObject other) num_fdivfinite_p
(ThreadContext context) static int
fix2int
(RubyFixnum arg) Deprecated.static int
fix2int
(IRubyObject arg) Deprecated.static long
fix2long
(IRubyObject arg) Deprecated.static boolean
static long
float2long
(RubyFloat flt) Deprecated.static long
float2ulong
(RubyFloat flt) Convert the given RubyFloat into an unsigned long, encoded as a signed long.static boolean
floatStep
(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl, boolean allowEndless, Block block) static double
floatStepSize
(double beg, double end, double unit, boolean excludeLast) Returns the number of unit-sized steps between the given beg and end.floor()
Deprecated.floor
(ThreadContext context) MRI: num_floorDeprecated.protected final IRubyObject[]
getCoerced
(ThreadContext context, IRubyObject other, boolean error) Numeric methods.double
Deprecated.UseasDouble(ThreadContext)
instead.int
Deprecated.UseasInt(ThreadContext)
instead.long
Deprecated.UseasLong(ThreadContext)
instead.static RoundingMode
getRoundingMode
(ThreadContext context, IRubyObject opts) idiv
(ThreadContext context, long other) idiv
(ThreadContext context, IRubyObject other) MRI: rb_int_idiv and overridesimage
(ThreadContext context) numeric_imageinfinite_p
(ThreadContext context) initialize_copy
(ThreadContext context, IRubyObject arg) num_init_copystatic RubyNumeric
Deprecated.UseConvert.asFixnum(ThreadContext, long)
instead.Deprecated.integer_p
(ThreadContext context) num_int_pstatic RubyNumeric
intervalStepSize
(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl) boolean
Deprecated.UseisNegativeNumber(ThreadContext)
instead.isNegative
(ThreadContext context) num_negative_pboolean
isNegativeNumber
(ThreadContext context) boolean
Deprecated.UseisPositiveNumber(ThreadContext)
instead.isPositive
(ThreadContext context) num_positive_pboolean
isPositiveNumber
(ThreadContext context) boolean
isReal()
boolean
isZero()
Deprecated.UseisZero(ThreadContext)
instead.boolean
isZero
(ThreadContext context) magnitude
(ThreadContext context) num_abs/1.9modulo
(ThreadContext context, IRubyObject other) num_modulostatic boolean
negativeInt
(ThreadContext context, IRubyObject num) static boolean
negFixable
(double l) static boolean
static RubyNumeric
newNumeric
(Ruby runtime) nonzero_p
(ThreadContext context) num_nonzero_pnum_imaginary
(ThreadContext context) num_imaginarystatic byte
num2chr
(IRubyObject arg) Deprecated.static double
num2dbl
(IRubyObject arg) Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)
instead.static double
num2dbl
(ThreadContext context, IRubyObject arg) Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)
instead.static IRubyObject
num2fix
(IRubyObject val) Deprecated.static IRubyObject
num2fix
(ThreadContext context, IRubyObject val) Deprecated.static int
num2int
(IRubyObject arg) Deprecated.static long
num2long
(IRubyObject arg) rb_num2long and FIX2LONG (numeric.c)static long
num2ulong
(IRubyObject arg) Convert the given value into an unsigned long, encoded as a signed long.numerator
(ThreadContext context) numeric_numeratorstatic IRubyObject
numFuncall
(ThreadContext context, IRubyObject x, CallSite site) static IRubyObject
numFuncall
(ThreadContext context, IRubyObject x, CallSite site, IRubyObject value) numRemainder
(ThreadContext context, IRubyObject y) op_cmp
(ThreadContext context, IRubyObject other) num_cmpop_minus
(ThreadContext context, IRubyObject other) op_not
(ThreadContext context) protected final IRubyObject
op_num_equal
(ThreadContext context, IRubyObject other) num_equal, doesn't override RubyObject.op_equalop_plus
(ThreadContext context, IRubyObject other) op_uminus
(ThreadContext context) num_uminusop_uplus()
Deprecated.op_uplus
(ThreadContext context) num_upluspolar
(ThreadContext context) numeric_polarstatic boolean
posFixable
(double l) static boolean
static boolean
positiveInt
(ThreadContext context, IRubyObject num) quo
(ThreadContext context, IRubyObject other) num_quofinal IRubyObject
rbClone()
RubyMethod clone.final IRubyObject
rbClone
(IRubyObject[] args) Deprecated.final IRubyObject
rbClone
(ThreadContext context) final IRubyObject
rbClone
(ThreadContext context, IRubyObject arg) real
(ThreadContext context) numeric_realreal_p
(ThreadContext context) num_real_prect
(ThreadContext context) numeric_rectremainder
(ThreadContext context, IRubyObject y) num_remainderround()
Deprecated.round
(ThreadContext context) MRI: num_roundscalar_p()
Deprecated.static IRubyObject
singleton_method_added
(ThreadContext context, IRubyObject self, IRubyObject name) num_saddedstep
(ThreadContext context, IRubyObject[] args, Block block) num_stepstatic RubyFloat
str2fnum
(Ruby runtime, RubyString arg) Same as RubyNumeric.str2fnum passing false for strict.static RubyFloat
str2fnum
(Ruby runtime, RubyString arg, boolean strict) static IRubyObject
str2fnum
(Ruby runtime, RubyString arg, boolean strict, boolean exception) Converts a string representation of a floating-point number to the numeric value.static RubyInteger
str2inum
(Ruby runtime, RubyString str, int base) Deprecated.static RubyInteger
str2inum
(Ruby runtime, RubyString str, int base, boolean strict) Deprecated.static IRubyObject
str2inum
(Ruby runtime, RubyString str, int base, boolean strict, boolean exception) Converts a string representation of an integer to the integer value.to_c
(ThreadContext context) numeric_to_cto_int
(ThreadContext context) num_to_int<T> T
Convert the object to the specified Java class, if possible.truncate()
Deprecated.truncate
(ThreadContext context) MRI: num_truncatezero_p
(ThreadContext context) num_zero_pMethods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, equals, finishObjectClass, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize, initialize_copy, inspect, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal, op_match, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, to_s, to_s, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Field Details
-
DBL_EPSILON
public static final double DBL_EPSILON- See Also:
-
-
Constructor Details
-
RubyNumeric
-
RubyNumeric
-
RubyNumeric
-
RubyNumeric
@Deprecated public RubyNumeric(Ruby runtime, RubyClass metaClass, boolean useObjectSpace, boolean canBeTainted) Deprecated.
-
-
Method Details
-
createNumericClass
public static RubyClass createNumericClass(ThreadContext context, RubyClass Object, RubyModule Comparable) -
getRoundingMode
-
getLongValue
Deprecated.UseasLong(ThreadContext)
instead.Return the value of this numeric as a 64-bit long. If the value does not fit in 64 bits, it will be truncated. -
getIntValue
Deprecated.UseasInt(ThreadContext)
instead.Return the value of this numeric as a 32-bit long. If the value does not fit in 32 bits, it will be truncated. -
asBigInteger
Return a BigInteger representation of this numerical value- Parameters:
context
- the current thread context- Returns:
- a BigInteger
-
asDouble
Return a double representation of this numerical value- Parameters:
context
- the current thread context- Returns:
- a double
-
asInt
Returns the value of this numeric and a java int. -
asLong
Return the value of this numeric as a 64-bit long. -
getDoubleValue
Deprecated.UseasDouble(ThreadContext)
instead.- Returns:
-
getBigIntegerValue
Deprecated. -
newNumeric
-
num2int
Deprecated.rb_num2int, NUM2INT if you know it is Integer useConvert.toInt(ThreadContext, IRubyObject)
. -
checkInt
check_int -
checkInt
-
num2chr
Deprecated.NUM2CHR -
num2long
rb_num2long and FIX2LONG (numeric.c) -
float2long
Deprecated. -
num2ulong
Convert the given value into an unsigned long, encoded as a signed long. Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed long bits accordingly.- Parameters:
arg
- the argument to convert- Returns:
- an unsigned long encoded as a signed long, or raise an error if out of range
-
float2ulong
Convert the given RubyFloat into an unsigned long, encoded as a signed long. Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed long bits accordingly.- Parameters:
flt
- the argument to convert- Returns:
- an unsigned long encoded as a signed long, or raise an error if out of range
-
dbl2num
Deprecated.UseConvert.asFloat(ThreadContext, long)
instead. -
dbl2ival
Deprecated.UseConvert.asInteger(ThreadContext, double)
instead. -
num2dbl
Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)
instead. -
num2dbl
Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)
instead.rb_num2dbl and NUM2DBL -
dbl_cmp
rb_dbl_cmp (numeric.c) -
fix2long
Deprecated.- Parameters:
arg
-- Returns:
-
fix2int
Deprecated. -
fix2int
Deprecated. -
str2inum
@Deprecated(since="10.0") public static RubyInteger str2inum(Ruby runtime, RubyString str, int base) Deprecated. -
int2fix
Deprecated.UseConvert.asFixnum(ThreadContext, long)
instead.- Parameters:
runtime
-val
-- Returns:
-
num2fix
Deprecated. -
num2fix
Deprecated. -
str2inum
public static IRubyObject str2inum(Ruby runtime, RubyString str, int base, boolean strict, boolean exception) Converts a string representation of an integer to the integer value. Parsing starts at the beginning of the string (after leading and trailing whitespace have been removed), and stops at the end or at the first character that can't be part of an integer. Leading signs are allowed. Ifbase
is zero, strings that begin with '0[xX]', '0[bB]', or '0' (optionally preceded by a sign) will be treated as hex, binary, or octal numbers, respectively. If a non-zero base is given, only the prefix (if any) that is appropriate to that base will be parsed correctly. For example, if the base is zero or 16, the string "0xff" will be converted to 256, but if the base is 10, it will come out as zero, since 'x' is not a valid decimal digit. If the string fails to parse as a number, zero is returned.- Parameters:
runtime
- the ruby runtimestr
- the string to be convertedbase
- the expected base of the number (for example, 2, 8, 10, 16), or 0 if the method should determine the base automatically (defaults to 10). Values 0 and 2-36 are permitted. Any other value will result in an ArgumentError.strict
- if true, enforce the strict criteria for String encoding of numeric values, as required by Integer('n'), and raise an exception when those criteria are not met. Otherwise, allow lax expression of values, as permitted by String#to_i, and return a value in almost all cases (excepting illegal radix). TODO: describe the rules/criteria- Returns:
- a RubyFixnum or (if necessary) a RubyBignum representing the result of the conversion, which will be zero if the conversion failed.
-
str2inum
@Deprecated(since="10.0") public static RubyInteger str2inum(Ruby runtime, RubyString str, int base, boolean strict) Deprecated. -
str2fnum
Same as RubyNumeric.str2fnum passing false for strict.- Parameters:
runtime
- the ruby runtimearg
- the string to be converted- Returns:
- a RubyFloat representing the result of the conversion, which will be 0.0 if the conversion failed.
-
str2fnum
Converts a string representation of a floating-point number to the numeric value. Parsing starts at the beginning of the string (after leading and trailing whitespace have been removed), and stops at the end or at the first character that can't be part of a number. If the string fails to parse as a number, 0.0 is returned.- Parameters:
runtime
- the ruby runtimearg
- the string to be convertedstrict
- if true, enforce the strict criteria for String encoding of numeric values, as required by Float('n'), and raise an exception when those criteria are not met. Otherwise, allow lax expression of values, as permitted by String#to_f, and return a value in all cases. TODO: describe the rules/criteria- Returns:
- a RubyFloat representing the result of the conversion, which will be 0.0 if the conversion failed.
-
str2fnum
-
getCoerced
Numeric methods. (num_*) -
callCoerced
protected final IRubyObject callCoerced(ThreadContext context, String method, IRubyObject other, boolean err) -
callCoerced
-
callCoerced
protected final IRubyObject callCoerced(ThreadContext context, CallSite site, IRubyObject other, boolean err) -
callCoerced
-
doCoerce
do_coerce -
coerceRescue
coerce_rescue -
coerceFailed
coerce_failed -
coerceBin
@Deprecated protected final IRubyObject coerceBin(ThreadContext context, String method, IRubyObject other) Deprecated.rb_num_coerce_bin coercion taking two arguments -
coerceBin
-
coerceBit
rb_num_coerce_bit coercion taking two arguments -
coerceBit
protected final IRubyObject coerceBit(ThreadContext context, JavaSites.CheckedSites site, IRubyObject other) -
coerceCmp
@Deprecated protected final IRubyObject coerceCmp(ThreadContext context, String method, IRubyObject other) Deprecated.rb_num_coerce_cmp coercion used for comparisons -
coerceCmp
-
coerceRelOp
@Deprecated protected final IRubyObject coerceRelOp(ThreadContext context, String method, IRubyObject other) Deprecated.rb_num_coerce_relop coercion used for relative operators -
coerceRelOp
-
asNumeric
-
op_not
- Overrides:
op_not
in classRubyBasicObject
-
singleton_method_added
public static IRubyObject singleton_method_added(ThreadContext context, IRubyObject self, IRubyObject name) num_sadded -
initialize_copy
num_init_copy- Overrides:
initialize_copy
in classRubyBasicObject
- Parameters:
context
- the thread contextarg
- the original- Returns:
- a copy unless the same thing
-
coerce
Deprecated.Usecoerce(ThreadContext, IRubyObject)
instead.- Parameters:
other
-- Returns:
-
coerce
num_coerce -
op_uplus
Deprecated. -
op_uplus
num_uplus -
num_imaginary
num_imaginary -
op_uminus
num_uminus -
op_plus
-
op_minus
-
op_cmp
num_cmp- Overrides:
op_cmp
in classRubyBasicObject
-
eql_p
num_eql- Overrides:
eql_p
in classRubyBasicObject
-
quo
num_quo -
div
MRI: num_div -
idiv
MRI: rb_int_idiv and overrides -
idiv
-
divmod
num_divmod -
fdiv
num_fdiv -
modulo
num_modulo -
remainder
num_remainder -
numRemainder
-
positiveInt
-
negativeInt
-
abs
num_abs -
magnitude
num_abs/1.9 -
to_int
num_to_int -
real_p
num_real_p -
isReal
public boolean isReal() -
scalar_p
Deprecated. -
integer_p
Deprecated. -
integer_p
num_int_p -
zero_p
num_zero_p -
isZero
Deprecated.UseisZero(ThreadContext)
instead.- Returns:
-
isZero
-
nonzero_p
num_nonzero_p -
floor
MRI: num_floor -
ceil
MRI: num_ceil -
round
MRI: num_round -
truncate
MRI: num_truncate -
step
num_step -
intervalStepSize
public static RubyNumeric intervalStepSize(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl) -
floatStep
public static boolean floatStep(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl, boolean allowEndless, Block block) -
floatStepSize
public static double floatStepSize(double beg, double end, double unit, boolean excludeLast) Returns the number of unit-sized steps between the given beg and end. NOTE: the returned value is either Double.POSITIVE_INFINITY, or a rounded value appropriate to be cast to a long MRI: ruby_float_step_size -
op_num_equal
num_equal, doesn't override RubyObject.op_equal -
numerator
numeric_numerator -
denominator
numeric_denominator -
convertToRational
Deprecated. -
convertToRational
-
to_c
numeric_to_c -
real
numeric_real -
image
numeric_image -
abs2
numeric_abs2 -
arg
numeric_arg -
rect
numeric_rect -
polar
numeric_polar -
conjugate
numeric_real -
toJava
Description copied from interface:IRubyObject
Convert the object to the specified Java class, if possible.- Specified by:
toJava
in interfaceIRubyObject
- Overrides:
toJava
in classRubyBasicObject
- Type Parameters:
T
- type- Parameters:
target
- The target type to which the object should be converted.- Returns:
- java type
- See Also:
-
isNegative
num_negative_p -
isPositive
num_positive_p -
isNegative
Deprecated.UseisNegativeNumber(ThreadContext)
instead.- Returns:
-
isNegativeNumber
-
isPositive
Deprecated.UseisPositiveNumber(ThreadContext)
instead.- Returns:
-
isPositiveNumber
-
compareWithZero
protected static IRubyObject compareWithZero(ThreadContext context, IRubyObject num, JavaSites.CheckedSites site) -
finite_p
-
infinite_p
-
rbClone
Deprecated. -
rbClone
-
rbClone
- Overrides:
rbClone
in classRubyBasicObject
-
rbClone
Description copied from interface:IRubyObject
RubyMethod clone.- Specified by:
rbClone
in interfaceIRubyObject
- Overrides:
rbClone
in classRubyBasicObject
- Returns:
- a cloned object
-
dup
Description copied from interface:IRubyObject
RubyMethod dup.- Specified by:
dup
in interfaceIRubyObject
- Overrides:
dup
in classRubyBasicObject
- Returns:
- a dup-ed object
-
numFuncall
-
numFuncall
public static IRubyObject numFuncall(ThreadContext context, IRubyObject x, CallSite site, IRubyObject value) -
fixable
-
posFixable
-
negFixable
-
posFixable
public static boolean posFixable(double l) -
negFixable
public static boolean negFixable(double l) -
floor
Deprecated. -
ceil
Deprecated. -
round
Deprecated. -
truncate
Deprecated.num_truncate
-
coerce(ThreadContext, IRubyObject)
instead.