public class RubyFloat extends RubyNumeric
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeExceptionRubyObject.DataRubyBasicObject.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_ALLOCATORIVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_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, varTableStampNULL_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, truncateattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, inspect, op_eqq, puts, specificEval, toRubyString, toStringaddFinalizer, 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, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderclone, finalize, getClass, notify, notifyAll, wait, wait, waitarraypublic 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()
RubyObjectgetNativeClassIndex in interface CoreObjectTypegetNativeClassIndex in class RubyObjectClassIndexpublic RubyClass getSingletonClass()
RubyBasicObjectgetSingletonClass in interface IRubyObjectgetSingletonClass in class RubyBasicObjectpublic java.lang.Class<?> getJavaClass()
RubyBasicObjectgetJavaClass in interface IRubyObjectgetJavaClass in class RubyBasicObjectpublic double getValue()
public double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
RubyNumericgetLongValue in class RubyNumericpublic int getIntValue()
RubyNumericgetIntValue in class RubyNumericpublic java.math.BigInteger getBigIntegerValue()
getBigIntegerValue in class RubyNumericpublic RubyFloat convertToFloat()
RubyBasicObjectconvertToFloat in interface IRubyObjectconvertToFloat in class RubyBasicObjectpublic RubyInteger convertToInteger()
RubyBasicObjectconvertToInteger in interface IRubyObjectconvertToInteger in class RubyBasicObjectpublic int signum()
public IRubyObject isNegative(ThreadContext context)
RubyNumericisNegative in class RubyNumericpublic IRubyObject isPositive(ThreadContext context)
RubyNumericisPositive in class RubyNumericpublic boolean isNegative()
isNegative in class RubyNumericpublic 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 RubyBasicObjectpublic IRubyObject coerce(IRubyObject other)
coerce in class RubyNumericpublic 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 RubyNumericpublic 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 RubyNumericpublic 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 RubyNumericpublic 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 IRubyObjectop_equal in class RubyBasicObjectpublic IRubyObject op_equal(ThreadContext context, double other)
public boolean fastEqual(RubyFloat other)
public final int compareTo(IRubyObject other)
RubyBasicObjectcompareTo in interface java.lang.Comparable<IRubyObject>compareTo in class RubyBasicObjectother - another IRubyObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp in class RubyBasicObjectpublic 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 RubyBasicObjectpublic boolean equals(java.lang.Object other)
RubyObjectequals in class RubyObjectRubyBasicObject.equals(Object)public RubyFixnum hash()
hash in class RubyBasicObjectpublic final int hashCode()
RubyObjecthashCode in class RubyObjectRubyBasicObject.hashCode()public IRubyObject to_f()
public IRubyObject abs(ThreadContext context)
abs in class RubyNumericpublic IRubyObject magnitude(ThreadContext context)
magnitude in class RubyNumericpublic IRubyObject zero_p(ThreadContext context)
zero_p in class RubyNumericpublic final boolean isZero()
isZero in class RubyNumericpublic IRubyObject nonzero_p(ThreadContext context)
RubyNumericnonzero_p in class RubyNumericpublic IRubyObject truncate(ThreadContext context)
truncate in class RubyNumericpublic IRubyObject truncate(ThreadContext context, IRubyObject n)
public IRubyObject numerator(ThreadContext context)
numerator in class RubyNumericpublic IRubyObject denominator(ThreadContext context)
denominator in class RubyNumericpublic IRubyObject to_r(ThreadContext context)
public IRubyObject rationalize(ThreadContext context, IRubyObject[] args)
public IRubyObject floor(ThreadContext context)
floor in class RubyNumericpublic IRubyObject floor(ThreadContext context, IRubyObject digits)
public IRubyObject ceil(ThreadContext context)
ceil in class RubyNumericpublic IRubyObject ceil(ThreadContext context, IRubyObject digits)
public IRubyObject round(ThreadContext context)
round in class RubyNumericpublic 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.IOExceptionpublic static RubyFloat unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOExceptionpublic 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-2019 JRuby. All Rights Reserved.