public class RubyFloat extends RubyNumeric
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException
RubyObject.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
static int |
DIG |
static double |
EPSILON |
static int |
FLOAT_DIG |
static double |
INFINITY |
static int |
MANT_DIG |
static int |
MAX_10_EXP |
static int |
MAX_EXP |
static int |
MIN_10_EXP |
static int |
MIN_EXP |
static double |
NAN |
static int |
RADIX |
static int |
ROUNDS |
DBL_EPSILON, NUMERIC_ALLOCATOR
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
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, UNTRUST_F, 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
NULL_ARRAY
Constructor and Description |
---|
RubyFloat(Ruby runtime) |
RubyFloat(Ruby runtime,
double value) |
Modifier and Type | Method and Description |
---|---|
IRubyObject |
abs(ThreadContext context)
flo_abs
|
IRubyObject |
ceil(ThreadContext context)
MRI: flo_ceil
|
IRubyObject |
ceil(ThreadContext context,
IRubyObject digits)
MRI: flo_ceil
|
IRubyObject |
coerce(IRubyObject other)
flo_coerce
|
int |
compareTo(IRubyObject other)
Compares this Ruby object with another.
|
RubyFloat |
convertToFloat()
Tries to convert this object to a Ruby Float using the "to_f" method.
|
RubyInteger |
convertToInteger()
Tries to convert this object to a Ruby Integer using the "to_int" method.
|
static RubyClass |
createFloatClass(Ruby runtime) |
IRubyObject |
denominator(ThreadContext context)
flo_denominator
|
IRubyObject |
divmod(ThreadContext context,
IRubyObject other)
flo_divmod
|
IRubyObject |
eql_p(IRubyObject other)
flo_eql
|
boolean |
equals(java.lang.Object other)
This override does not do a "checked" dispatch.
|
boolean |
fastEqual(RubyFloat other) |
IRubyObject |
finite_p()
flo_is_finite_p
|
IRubyObject |
floor(ThreadContext context)
MRI: flo_floor
|
IRubyObject |
floor(ThreadContext context,
IRubyObject digits)
MRI: flo_floor
|
IRubyObject |
floor(ThreadContext context,
IRubyObject[] args)
Deprecated.
|
java.math.BigInteger |
getBigIntegerValue() |
double |
getDoubleValue() |
int |
getIntValue()
Return the value of this numeric as a 32-bit long.
|
java.lang.Class<?> |
getJavaClass()
Will return the Java interface that most closely can represent
this object, when working through Java integration translations.
|
long |
getLongValue()
Return the value of this numeric as a 64-bit long.
|
ClassIndex |
getNativeClassIndex()
This is overridden in the other concrete Java builtins to provide a fast way
to determine what type they are.
|
RubyClass |
getSingletonClass()
rb_singleton_class
Note: this method is specialized for RubyFixnum, RubySymbol,
RubyNil and RubyBoolean
Will either return the existing singleton class for this
object, or create a new one and return that.
|
double |
getValue()
Getter for property value.
|
RubyFixnum |
hash()
flo_hash
|
int |
hashCode()
This override does not do "checked" dispatch since Object usually has #hash defined.
|
static IRubyObject |
induced_from(ThreadContext context,
IRubyObject recv,
IRubyObject number)
Deprecated.
|
IRubyObject |
infinite_p()
flo_is_infinite_p
|
boolean |
isInfinite() |
boolean |
isNaN() |
boolean |
isNegative() |
IRubyObject |
isNegative(ThreadContext context)
num_negative_p
|
boolean |
isPositive() |
IRubyObject |
isPositive(ThreadContext context)
num_positive_p
|
boolean |
isZero() |
IRubyObject |
magnitude(ThreadContext context)
flo_abs/1.9
|
static void |
marshalTo(RubyFloat aFloat,
MarshalStream output) |
IRubyObject |
nan_p()
flo_is_nan_p
|
static RubyFloat |
newFloat(Ruby runtime,
double value) |
IRubyObject |
next_float() |
IRubyObject |
nonzero_p(ThreadContext context)
num_nonzero_p
|
IRubyObject |
numerator(ThreadContext context)
flo_numerator
|
IRubyObject |
op_cmp(ThreadContext context,
double other) |
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other)
flo_cmp
|
IRubyObject |
op_div(ThreadContext context,
double other) |
IRubyObject |
op_div(ThreadContext context,
IRubyObject other)
MRI: flo_div
|
IRubyObject |
op_equal(ThreadContext context,
double other) |
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
flo_eq
|
IRubyObject |
op_ge(ThreadContext context,
double other) |
IRubyObject |
op_ge(ThreadContext context,
IRubyObject other)
flo_ge
|
IRubyObject |
op_gt(ThreadContext context,
double other) |
IRubyObject |
op_gt(ThreadContext context,
IRubyObject other)
flo_gt
|
IRubyObject |
op_le(ThreadContext context,
double other) |
IRubyObject |
op_le(ThreadContext context,
IRubyObject other)
flo_le
|
IRubyObject |
op_lt(ThreadContext context,
double other) |
IRubyObject |
op_lt(ThreadContext context,
IRubyObject other)
flo_lt
|
IRubyObject |
op_minus(ThreadContext context,
double other) |
IRubyObject |
op_minus(ThreadContext context,
IRubyObject other)
flo_minus
|
IRubyObject |
op_mod(ThreadContext context,
double other) |
IRubyObject |
op_mod(ThreadContext context,
IRubyObject other)
flo_mod
|
IRubyObject |
op_mod19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
op_mul(ThreadContext context,
double other) |
IRubyObject |
op_mul(ThreadContext context,
IRubyObject other)
flo_mul
|
IRubyObject |
op_plus(ThreadContext context,
double other) |
IRubyObject |
op_plus(ThreadContext context,
IRubyObject other)
flo_plus
|
IRubyObject |
op_pow(ThreadContext context,
double other) |
IRubyObject |
op_pow(ThreadContext context,
IRubyObject other)
flo_pow
|
IRubyObject |
op_pow19(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
op_uminus()
Deprecated.
|
IRubyObject |
op_uminus(ThreadContext context)
flo_uminus
|
IRubyObject |
prev_float() |
IRubyObject |
quo(ThreadContext context,
IRubyObject other)
flo_quo
|
IRubyObject |
rationalize(ThreadContext context,
IRubyObject[] args)
float_rationalize
|
IRubyObject |
round(ThreadContext context)
MRI: flo_round
|
IRubyObject |
round(ThreadContext context,
IRubyObject arg0)
MRI: flo_round
|
IRubyObject |
round(ThreadContext context,
IRubyObject[] args)
Deprecated.
|
IRubyObject |
round(ThreadContext context,
IRubyObject _digits,
IRubyObject _opts)
MRI: flo_round
|
IRubyObject |
roundShared(ThreadContext context,
int ndigits,
java.math.RoundingMode mode) |
int |
signum() |
IRubyObject |
to_f()
flo_fo
|
IRubyObject |
to_r(ThreadContext context) |
IRubyObject |
to_s()
flo_to_s
|
IRubyObject |
truncate(ThreadContext context)
MRI: flo_truncate
|
IRubyObject |
truncate(ThreadContext context,
IRubyObject n)
MRI: flo_truncate
|
static RubyFloat |
unmarshalFrom(UnmarshalStream input) |
IRubyObject |
zero_p()
Deprecated.
|
IRubyObject |
zero_p(ThreadContext context)
MRI: flo_zero_p
|
abs2, arg, asNumeric, callCoerced, callCoerced, callCoerced, callCoerced, ceil, checkInt, checkInt, coerceBin, coerceBin, coerceBit, coerceBit, coerceBody, coerceCmp, coerceCmp, coerceFailed, coerceRelOp, coerceRelOp, coerceRescue, compareWithZero, conjugate, convertToRational, createNumericClass, dbl_cmp, dbl2ival, dbl2num, div, div19, divmod19, doCoerce, dup, eql_p, fdiv, finite_p, fix2int, fix2int, fix2long, fixable, float2long, floatStepSize, floor, getCoerced, getRoundingMode, idiv, idiv, image, infinite_p, initialize_copy, int2fix, integer_p, intervalStepSize, isReal, modulo, modulo19, negativeInt, negFixable, negFixable, newNumeric, num_imaginary, num2chr, num2dbl, num2dbl, num2fix, num2int, num2long, numFuncall, numFuncall, numRemainder, op_cmp, op_not, op_num_equal, op_uplus, polar, posFixable, posFixable, positiveInt, quo_19, rbClone, rbClone, rbClone, rbClone, real_p, real, rect, remainder, round, scalar_p, singleton_method_added, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava, truncate
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, dig1, dig2, eqlInternal, equalInternal, inspect, op_eqq, puts, specificEval, toRubyString, toString
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToHash, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, ensureInstanceVariablesSettable, 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, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id, infectBy, initialize, 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, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing, method_missing19, method, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbInspect, 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_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_method, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
array
public static final int ROUNDS
public static final int RADIX
public static final int MANT_DIG
public static final int DIG
public static final int MIN_EXP
public static final int MAX_EXP
public static final int MAX_10_EXP
public static final int MIN_10_EXP
public static final double EPSILON
public static final double INFINITY
public static final double NAN
public static final int FLOAT_DIG
public RubyFloat(Ruby runtime)
public RubyFloat(Ruby runtime, double value)
public ClassIndex getNativeClassIndex()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public RubyClass getSingletonClass()
RubyBasicObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyBasicObject
public java.lang.Class<?> getJavaClass()
RubyBasicObject
getJavaClass
in interface IRubyObject
getJavaClass
in class RubyBasicObject
public double getValue()
public double getDoubleValue()
getDoubleValue
in class RubyNumeric
public long getLongValue()
RubyNumeric
getLongValue
in class RubyNumeric
public int getIntValue()
RubyNumeric
getIntValue
in class RubyNumeric
public java.math.BigInteger getBigIntegerValue()
getBigIntegerValue
in class RubyNumeric
public RubyFloat convertToFloat()
RubyBasicObject
convertToFloat
in interface IRubyObject
convertToFloat
in class RubyBasicObject
public RubyInteger convertToInteger()
RubyBasicObject
convertToInteger
in interface IRubyObject
convertToInteger
in class RubyBasicObject
public int signum()
public IRubyObject isNegative(ThreadContext context)
RubyNumeric
isNegative
in class RubyNumeric
public IRubyObject isPositive(ThreadContext context)
RubyNumeric
isPositive
in class RubyNumeric
public boolean isNegative()
isNegative
in class RubyNumeric
public boolean isPositive()
isPositive
in class RubyNumeric
@Deprecated public static IRubyObject induced_from(ThreadContext context, IRubyObject recv, IRubyObject number)
public IRubyObject to_s()
to_s
in class RubyBasicObject
public IRubyObject coerce(IRubyObject other)
coerce
in class RubyNumeric
public IRubyObject op_uminus(ThreadContext context)
op_uminus
in class RubyNumeric
@Deprecated public IRubyObject op_uminus()
public IRubyObject op_plus(ThreadContext context, IRubyObject other)
op_plus
in class RubyNumeric
public IRubyObject op_plus(ThreadContext context, double other)
public IRubyObject op_minus(ThreadContext context, IRubyObject other)
public IRubyObject op_minus(ThreadContext context, double other)
public IRubyObject op_mul(ThreadContext context, IRubyObject other)
public IRubyObject op_mul(ThreadContext context, double other)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, double other)
public IRubyObject quo(ThreadContext context, IRubyObject other)
quo
in class RubyNumeric
public IRubyObject op_mod(ThreadContext context, IRubyObject other)
public IRubyObject op_mod(ThreadContext context, double other)
@Deprecated public final IRubyObject op_mod19(ThreadContext context, IRubyObject other)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod
in class RubyNumeric
public IRubyObject op_pow(ThreadContext context, IRubyObject other)
public IRubyObject op_pow(ThreadContext context, double other)
@Deprecated public IRubyObject op_pow19(ThreadContext context, IRubyObject other)
public IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal
in interface IRubyObject
op_equal
in class RubyBasicObject
public IRubyObject op_equal(ThreadContext context, double other)
public boolean fastEqual(RubyFloat other)
public final int compareTo(IRubyObject other)
RubyBasicObject
compareTo
in interface java.lang.Comparable<IRubyObject>
compareTo
in class RubyBasicObject
other
- another IRubyObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp
in class RubyBasicObject
public IRubyObject op_cmp(ThreadContext context, double other)
public IRubyObject op_gt(ThreadContext context, IRubyObject other)
public IRubyObject op_gt(ThreadContext context, double other)
public IRubyObject op_ge(ThreadContext context, IRubyObject other)
public IRubyObject op_ge(ThreadContext context, double other)
public IRubyObject op_lt(ThreadContext context, IRubyObject other)
public IRubyObject op_lt(ThreadContext context, double other)
public IRubyObject op_le(ThreadContext context, IRubyObject other)
public IRubyObject op_le(ThreadContext context, double other)
public IRubyObject eql_p(IRubyObject other)
eql_p
in class RubyBasicObject
public boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
RubyBasicObject.equals(Object)
public RubyFixnum hash()
hash
in class RubyBasicObject
public final int hashCode()
RubyObject
hashCode
in class RubyObject
RubyBasicObject.hashCode()
public IRubyObject to_f()
public IRubyObject abs(ThreadContext context)
abs
in class RubyNumeric
public IRubyObject magnitude(ThreadContext context)
magnitude
in class RubyNumeric
public IRubyObject zero_p(ThreadContext context)
zero_p
in class RubyNumeric
public final boolean isZero()
isZero
in class RubyNumeric
public IRubyObject nonzero_p(ThreadContext context)
RubyNumeric
nonzero_p
in class RubyNumeric
public IRubyObject truncate(ThreadContext context)
truncate
in class RubyNumeric
public IRubyObject truncate(ThreadContext context, IRubyObject n)
public IRubyObject numerator(ThreadContext context)
numerator
in class RubyNumeric
public IRubyObject denominator(ThreadContext context)
denominator
in class RubyNumeric
public IRubyObject to_r(ThreadContext context)
public IRubyObject rationalize(ThreadContext context, IRubyObject[] args)
public IRubyObject floor(ThreadContext context)
floor
in class RubyNumeric
public IRubyObject floor(ThreadContext context, IRubyObject digits)
public IRubyObject ceil(ThreadContext context)
ceil
in class RubyNumeric
public IRubyObject ceil(ThreadContext context, IRubyObject digits)
public IRubyObject round(ThreadContext context)
round
in class RubyNumeric
public IRubyObject round(ThreadContext context, IRubyObject arg0)
public IRubyObject round(ThreadContext context, IRubyObject _digits, IRubyObject _opts)
public IRubyObject roundShared(ThreadContext context, int ndigits, java.math.RoundingMode mode)
public IRubyObject nan_p()
public boolean isNaN()
public IRubyObject infinite_p()
public boolean isInfinite()
public IRubyObject finite_p()
public static void marshalTo(RubyFloat aFloat, MarshalStream output) throws java.io.IOException
java.io.IOException
public static RubyFloat unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOException
public IRubyObject next_float()
public IRubyObject prev_float()
@Deprecated public IRubyObject zero_p()
@Deprecated public IRubyObject floor(ThreadContext context, IRubyObject[] args)
@Deprecated public IRubyObject round(ThreadContext context, IRubyObject[] args)
Copyright © 2001-2021 JRuby. All Rights Reserved.