Top Description Fields Constructors Methods
org.jruby

public Class RubyFloat

extends RubyNumeric
implements Appendable
Class Inheritance
All Implemented Interfaces
org.jruby.Appendable
Annotations
@JRubyClass
name:Float
parent:Numeric
Imports
java.math.BigInteger, .RoundingMode, java.util.Locale, org.jcodings.specific.ASCIIEncoding, .USASCIIEncoding, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.api.JRubyAPI, org.jruby.ast.util.ArgsUtil, org.jruby.runtime.Arity, .ClassIndex, .Helpers, .JavaSites.FloatSites, .ObjectAllocator, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.marshal.MarshalDumper, .MarshalLoader, org.jruby.util.ByteList, .ConvertDouble, .Numeric, .Sprintf, org.jruby.util.io.RubyInputStream, .RubyOutputStream

A representation of a float object

Field Summary

Modifier and TypeField and Description
pack-priv static final int
DBL_MANT_DIG

float_to_r, float_decode

public static final int
public static final double
public static final int
public static final double
private static final ByteList
public static final int
public static final int
public static final int
public static final int
public static final int
public static final double
private static final ByteList
public static final ByteList
private static final ByteList
public static final ByteList
public static final ByteList
public static final int
public static final int
pack-priv final double
Inherited from org.jruby.RubyNumeric:
DBL_EPSILON

Constructor Summary

AccessConstructor and Description
public
RubyFloat(Ruby runtime)

public
RubyFloat(Ruby runtime, double value)

private
RubyFloat(RubyClass klass, double value)

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
abs(ThreadContext context)

Overrides org.jruby.RubyNumeric.abs.

flo_abs

public void
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.

public IRubyObject
ceil(ThreadContext context)

Overrides org.jruby.RubyNumeric.ceil.

MRI: flo_ceil

public IRubyObject
ceil(ThreadContext context, IRubyObject digits)

MRI: flo_ceil

public IRubyObject
coerce(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.coerce.

num_coerce

public final int
compareTo(IRubyObject
another IRubyObject
other
)

Overrides org.jruby.RubyBasicObject.compareTo.

Implements java.lang.Comparable.compareTo.

Compares this Ruby object with another.

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.

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

public static RubyClass
public IRubyObject
denominator(ThreadContext context)

Overrides org.jruby.RubyNumeric.denominator.

flo_denominator

public IRubyObject
divmod(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.divmod.

flo_divmod

private static double
doRound(ThreadContext context, RoundingMode roundingMode, double number, double scale)

public final boolean
eql(IRubyObject other)

Overrides org.jruby.RubyBasicObject.eql.

Implements org.jruby.runtime.builtin.IRubyObject.eql.

short circuit for Float key comparison

public IRubyObject
eql_p(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.eql_p.

num_eql

public IRubyObject

Returns:

true if this Float and the given object are effectively identical, false otherwise
equal_p
(ThreadContext
the current context
context
,
IRubyObject
the object with which to compare
obj
)

Overrides org.jruby.RubyBasicObject.equal_p.

Compare this Float object with the given object and determine whether they are effectively identical.

public boolean
equals(Object
object to compare
other
)

Overrides org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

private boolean
public boolean
public IRubyObject
finite_p()
Deprecated since 10.0.

public IRubyObject
private static long
floatHash(Ruby runtime, double value)

private IRubyObject
floatRoundByRational(ThreadContext context, IRubyObject ndigits, RoundingMode mode)

rb_flo_round_by_rational

private static boolean
floatRoundOverflow(int ndigits, long[] binexp)

private static boolean
floatRoundUnderflow(int ndigits, long[] binexp)

private static boolean

Returns:

true of the value can be represented as a "flonum", false otherwise
flonumable
(double
the double value in question
value
)

Determine if the given double value is representable as a "flonum", a bit-manipulated version of itself that emulates the CRuby "flonum" tagged pointer.

private static boolean

Returns:

true if the double is in the non-zero "flonum" range, false otherwise
flonumRange
(long
the bits of the double in question
longBits
)

Determine if the given double bits are in the "flonum" range, excluding positive zero.

public IRubyObject
floor(ThreadContext context)

Overrides org.jruby.RubyNumeric.floor.

MRI: flo_floor

public IRubyObject
floor(ThreadContext context, IRubyObject digits)

MRI: flo_floor

public IRubyObject
floor(ThreadContext context, IRubyObject[] args)
Deprecated

public Class<?>
getJavaClass()

Overrides org.jruby.RubyBasicObject.getJavaClass.

Implements org.jruby.runtime.builtin.IRubyObject.getJavaClass.

Will return the Java interface that most closely can represent this object, when working through Java integration translations.

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.

public double

Returns:

Value of property value.
getValue
()

Get the raw float value.

public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

public final int
hashCode()

Overrides org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

public IRubyObject

Returns:

the object ID for this Float
id
()

Overrides org.jruby.RubyBasicObject.id.

Implements org.jruby.runtime.builtin.IRubyObject.id.

Produce an object ID for this Float.

public static IRubyObject
induced_from(ThreadContext context, IRubyObject recv, IRubyObject number)
Deprecated

rb_flo_induced_from

public IRubyObject
infinite_p()
Deprecated since 10.0.

public IRubyObject
public boolean
public boolean
public IRubyObject
isNegative(ThreadContext context)

Overrides org.jruby.RubyNumeric.isNegative.

num_negative_p

public boolean
public IRubyObject
isPositive(ThreadContext context)

Overrides org.jruby.RubyNumeric.isPositive.

num_positive_p

public boolean
public final boolean
public IRubyObject
private ByteList
public static void
marshalTo(RubyFloat aFloat, MarshalStream output)
Deprecated for removal since 10.0.

public static void
public IRubyObject
nan_p(ThreadContext context)

flo_is_nan_p

public IRubyObject
nan_p()
Deprecated

public static RubyFloat
newFloat(Ruby runtime, double value)

public IRubyObject
next_float()
Deprecated since 10.0.

public IRubyObject
public IRubyObject
nonzero_p(ThreadContext context)

Overrides org.jruby.RubyNumeric.nonzero_p.

num_nonzero_p

public IRubyObject
numerator(ThreadContext context)

Overrides org.jruby.RubyNumeric.numerator.

flo_numerator

public IRubyObject
public IRubyObject
op_cmp(ThreadContext context, double other)

public IRubyObject
op_div(ThreadContext context, IRubyObject other)

MRI: flo_div

public IRubyObject
op_div(ThreadContext context, double other)

public IRubyObject
public IRubyObject
op_equal(ThreadContext context, double other)

public IRubyObject
op_ge(ThreadContext context, IRubyObject other)

flo_ge

public IRubyObject
op_ge(ThreadContext context, double other)

public IRubyObject
op_gt(ThreadContext context, IRubyObject other)

flo_gt

public IRubyObject
op_gt(ThreadContext context, double other)

public IRubyObject
op_le(ThreadContext context, IRubyObject other)

flo_le

public IRubyObject
op_le(ThreadContext context, double other)

public IRubyObject
op_lt(ThreadContext context, IRubyObject other)

flo_lt

public IRubyObject
op_lt(ThreadContext context, double other)

public IRubyObject
public IRubyObject
op_minus(ThreadContext context, double other)

public IRubyObject
op_mod(ThreadContext context, IRubyObject other)

flo_mod

public IRubyObject
op_mod(ThreadContext context, double other)

public IRubyObject
op_mul(ThreadContext context, IRubyObject other)

flo_mul

public IRubyObject
op_mul(ThreadContext context, double other)

public IRubyObject
op_not_equal(ThreadContext context, double other)

public IRubyObject
public IRubyObject
op_plus(ThreadContext context, double other)

public IRubyObject
op_pow(ThreadContext context, IRubyObject other)

flo_pow

public IRubyObject
op_pow(ThreadContext context, double other)

public IRubyObject
public IRubyObject
op_uminus()
Deprecated

private static boolean

Returns:

true of the bits represent positive zero, false otherwise
positiveZero
(long
the bits of the double in question
longBits
)

Determine of the given double bits represent positive zero.

public IRubyObject
prev_float()
Deprecated since 10.0.

public IRubyObject
public IRubyObject
quo(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.quo.

flo_quo

public IRubyObject
rationalize(ThreadContext context, IRubyObject[] args)

float_rationalize

public IRubyObject
round(ThreadContext context)

Overrides org.jruby.RubyNumeric.round.

MRI: flo_round

public IRubyObject
round(ThreadContext context, IRubyObject arg0)

MRI: flo_round

public IRubyObject
round(ThreadContext context, IRubyObject _digits, IRubyObject _opts)

MRI: flo_round

public IRubyObject
round(ThreadContext context, IRubyObject[] args)
Deprecated

private static double
roundHalfDown(double x, double s)

private static double
roundHalfEven(double x, double s)

private static double
roundHalfUp(double x, double s)

private static double
roundHalfUp(double n)

public IRubyObject
roundShared(ThreadContext context, int ndigits, RoundingMode mode)

public int
signum()
Deprecated since 10.0.

public int
public RubyClass
singletonClass(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.singletonClass.

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

Will either return the existing singleton class for this object, or create a new one and return that.

private static JavaSites.FloatSites
sites(ThreadContext context)

Hides org.jruby.RubyNumeric.sites.

Retrieve the call sites for this class.

public IRubyObject
to_f()
Deprecated since 10.0.

public IRubyObject
public IRubyObject
public IRubyObject
private RubyInteger
public IRubyObject
truncate(ThreadContext context)

Overrides org.jruby.RubyNumeric.truncate.

MRI: flo_truncate

public IRubyObject
truncate(ThreadContext context, IRubyObject n)

MRI: flo_truncate

public static RubyFloat
unmarshalFrom(UnmarshalStream input)
Deprecated for removal since 10.0.

public static RubyFloat
public IRubyObject
zero_p(ThreadContext context)

Overrides org.jruby.RubyNumeric.zero_p.

MRI: flo_zero_p

public IRubyObject
zero_p()
Deprecated

Inherited from org.jruby.RubyNumeric:
abs2argasNumericcallCoercedcallCoercedcallCoercedcallCoercedceilcheckIntcheckIntcoercecoerceBincoerceBincoerceBitcoerceBitcoerceCmpcoerceCmpcoerceFailedcoerceRelOpcoerceRelOpcoerceRescuecompareNumberWithZerocompareWithZeroconjugateconvertToRationalconvertToRationalcreateNumericClassdbl2ivaldbl2numdbl_cmpdivdoCoercedupfdivfix2intfix2intfix2longfixablefloat2longfloat2ulongfloatStepfloatStepSizefloorgetBigIntegerValuegetCoercedgetDoubleValuegetIntValuegetLongValuegetRoundingModeidividivimageinitialize_copyint2fixinteger_pinteger_pintervalStepSizeisNegativeisPositiveisRealisZeromodulomodulonegativeIntnegFixablenegFixablenewNumericnum2chrnum2dblnum2dblnum2fixnum2fixnum2intnum2longnum2ulongnum_imaginarynumFuncallnumFuncallnumRemainderop_notop_num_equalop_uplusop_upluspolarposFixableposFixablepositiveIntrbClonerbClonerbClonerbClonerealreal_prectremainderroundscalar_psingleton_method_addedstepstr2fnumstr2fnumstr2fnumstr2inumstr2inumstr2inumto_cto_inttoJavatruncate