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 classDeprecated.static classDeprecated.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested 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_ALLOCATORFields 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, varTableStampFields 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 valuedoubleasDouble(ThreadContext context) Return a double representation of this numerical valueintasInt(ThreadContext context) Returns the value of this numeric and a java int.longasLong(ThreadContext context) Return the value of this numeric as a 64-bit long.final IRubyObjectcallCoerced(ThreadContext context, String method, IRubyObject other) protected final IRubyObjectcallCoerced(ThreadContext context, String method, IRubyObject other, boolean err) final IRubyObjectcallCoerced(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObjectcallCoerced(ThreadContext context, CallSite site, IRubyObject other, boolean err) ceil()Deprecated.ceil(ThreadContext context) MRI: num_ceilstatic intcheck_intstatic voidcheckInt(IRubyObject arg, long num) coerce(IRubyObject other) Deprecated.coerce(ThreadContext context, IRubyObject other) num_coerceprotected final IRubyObjectcoerceBin(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObjectcoerceBin(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObjectcoerceBit(ThreadContext context, String method, IRubyObject other) rb_num_coerce_bit coercion taking two argumentsprotected final IRubyObjectcoerceBit(ThreadContext context, JavaSites.CheckedSites site, IRubyObject other) protected final IRubyObjectcoerceCmp(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObjectcoerceCmp(ThreadContext context, CallSite site, IRubyObject other) protected final voidcoerceFailed(ThreadContext context, IRubyObject arg) coerce_failedprotected final IRubyObjectcoerceRelOp(ThreadContext context, String method, IRubyObject other) Deprecated.protected final IRubyObjectcoerceRelOp(ThreadContext context, CallSite site, IRubyObject other) protected final IRubyObjectcoerceRescue(ThreadContext context, IRubyObject other) coerce_rescueprotected static IRubyObjectcompareWithZero(ThreadContext context, IRubyObject num, JavaSites.CheckedSites site) conjugate(ThreadContext context) numeric_realDeprecated.convertToRational(ThreadContext context) static RubyClasscreateNumericClass(ThreadContext context, RubyClass Object, RubyModule Comparable) static IRubyObjectrb_dbl_cmp (numeric.c)static RubyIntegerDeprecated.UseConvert.asInteger(ThreadContext, double)instead.static IRubyObjectDeprecated.UseConvert.asFloat(ThreadContext, long)instead.denominator(ThreadContext context) numeric_denominatordiv(ThreadContext context, IRubyObject other) MRI: num_divdivmod(ThreadContext context, IRubyObject other) num_divmodprotected final RubyArraydoCoerce(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 intfix2int(RubyFixnum arg) Deprecated.static intfix2int(IRubyObject arg) Deprecated.static longfix2long(IRubyObject arg) Deprecated.static booleanstatic longfloat2long(RubyFloat flt) Deprecated.static longfloat2ulong(RubyFloat flt) Convert the given RubyFloat into an unsigned long, encoded as a signed long.static booleanfloatStep(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl, boolean allowEndless, Block block) static doublefloatStepSize(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.doubleDeprecated.UseasDouble(ThreadContext)instead.intDeprecated.UseasInt(ThreadContext)instead.longDeprecated.UseasLong(ThreadContext)instead.static RoundingModegetRoundingMode(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 RubyNumericDeprecated.UseConvert.asFixnum(ThreadContext, long)instead.Deprecated.integer_p(ThreadContext context) num_int_pstatic RubyNumericintervalStepSize(ThreadContext context, IRubyObject from, IRubyObject to, IRubyObject step, boolean excl) booleanDeprecated.UseisNegativeNumber(ThreadContext)instead.isNegative(ThreadContext context) num_negative_pbooleanisNegativeNumber(ThreadContext context) booleanDeprecated.UseisPositiveNumber(ThreadContext)instead.isPositive(ThreadContext context) num_positive_pbooleanisPositiveNumber(ThreadContext context) booleanisReal()booleanisZero()Deprecated.UseisZero(ThreadContext)instead.booleanisZero(ThreadContext context) magnitude(ThreadContext context) num_abs/1.9modulo(ThreadContext context, IRubyObject other) num_modulostatic booleannegativeInt(ThreadContext context, IRubyObject num) static booleannegFixable(double l) static booleanstatic RubyNumericnewNumeric(Ruby runtime) nonzero_p(ThreadContext context) num_nonzero_pnum_imaginary(ThreadContext context) num_imaginarystatic bytenum2chr(IRubyObject arg) Deprecated.static doublenum2dbl(IRubyObject arg) Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)instead.static doublenum2dbl(ThreadContext context, IRubyObject arg) Deprecated.UseConvert.toDouble(ThreadContext, IRubyObject)instead.static IRubyObjectnum2fix(IRubyObject val) Deprecated.static IRubyObjectnum2fix(ThreadContext context, IRubyObject val) Deprecated.static intnum2int(IRubyObject arg) Deprecated.static longnum2long(IRubyObject arg) rb_num2long and FIX2LONG (numeric.c)static longnum2ulong(IRubyObject arg) Convert the given value into an unsigned long, encoded as a signed long.numerator(ThreadContext context) numeric_numeratorstatic IRubyObjectnumFuncall(ThreadContext context, IRubyObject x, CallSite site) static IRubyObjectnumFuncall(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 IRubyObjectop_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 booleanposFixable(double l) static booleanstatic booleanpositiveInt(ThreadContext context, IRubyObject num) quo(ThreadContext context, IRubyObject other) num_quofinal IRubyObjectrbClone()RubyMethod clone.final IRubyObjectrbClone(IRubyObject[] args) Deprecated.final IRubyObjectrbClone(ThreadContext context) final IRubyObjectrbClone(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 IRubyObjectsingleton_method_added(ThreadContext context, IRubyObject self, IRubyObject name) num_saddedstep(ThreadContext context, IRubyObject[] args, Block block) num_stepstatic RubyFloatstr2fnum(Ruby runtime, RubyString arg) Same as RubyNumeric.str2fnum passing false for strict.static RubyFloatstr2fnum(Ruby runtime, RubyString arg, boolean strict) static IRubyObjectstr2fnum(Ruby runtime, RubyString arg, boolean strict, boolean exception) Converts a string representation of a floating-point number to the numeric value.static RubyIntegerstr2inum(Ruby runtime, RubyString str, int base) Deprecated.static RubyIntegerstr2inum(Ruby runtime, RubyString str, int base, boolean strict) Deprecated.static IRubyObjectstr2inum(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> TConvert 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, toStringMethods 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, yieldUnderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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. Ifbaseis 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_notin 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_copyin 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_cmpin classRubyBasicObject
-
eql_p
num_eql- Overrides:
eql_pin 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:IRubyObjectConvert the object to the specified Java class, if possible.- Specified by:
toJavain interfaceIRubyObject- Overrides:
toJavain 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:
rbClonein classRubyBasicObject
-
rbClone
Description copied from interface:IRubyObjectRubyMethod clone.- Specified by:
rbClonein interfaceIRubyObject- Overrides:
rbClonein classRubyBasicObject- Returns:
- a cloned object
-
dup
Description copied from interface:IRubyObjectRubyMethod dup.- Specified by:
dupin interfaceIRubyObject- Overrides:
dupin 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.