An IEEE 754 64-bit floating point number. A Float
is
capable of approximately representing numeric values
between:
Zero is represented by distinct instances +0.0
, -0.0
,
but these instances are equal. -0.0
can be distinguished
from +0.0
using f == 0.0 && f.strictlyNegative
.
In addition, the following special values exist:
infinity
and -infinity
, andAs required by the IEEE standard no undefined value is
equal to any other value, nor even to itself. Thus, the
definition of equals()
for Float
violates the general
contract defined by Object.equals()
.
A floating point value with a zero fractionalPart
is
considered equal to its integer
part.
Literal floating point values are written with a decimal point and, optionally, a magnitude or exponent:
1.0 1.0E6 1.0M 1.0E-6 1.0u
In the case of a fractional magnitude, the decimal point is optional. Underscores may be used to group digits into groups of three.
parseFloat()
no subtypes hierarchy
Initializer |
Float(Float float) |
Attributes | |
absolute | See magnitude |
finite | Source Codeshared Boolean finite |
fractionalPart | Source Codeshared actual Float fractionalPart The fractional part of this number, after truncation of
the integral part. For Refines Number.fractionalPart |
hash | Source Codeshared actual Integer hash A platform-dependent hash code for this Refines Object.hash |
infinite | Source Codeshared Boolean infinite |
integer | Source Codeshared Integer integer This value, represented as an Throws
|
magnitude | Source Codeshared actual Float magnitude The magnitude of this number, defined for any instance
where
Refines Number.magnitude Aliases: absolute |
negated | Source Codeshared actual Float negated The additive inverse of this value. Refines Invertible.negated |
negative | Source Codeshared actual Boolean negative Determines if this value is a negative number or
Refines Number.negative |
notANumber | See undefined |
positive | Source Codeshared actual Boolean positive Determines if this value is a positive number or
Refines Number.positive |
sign | Source Codeshared actual Integer sign The sign of this value. Produces Refines Number.sign |
strictlyNegative | Source Codeshared Boolean strictlyNegative Determines if this value is a negative number, |
strictlyPositive | Source Codeshared Boolean strictlyPositive Determines if this value is a positive number, |
string | Source Codeshared actual String string A string representing this floating point number.
See also formatFloat() Refines Object.string |
undefined | Source Codeshared Boolean undefined Determines whether this value is undefined. The IEEE standard denotes undefined values NaN (an abbreviation of Not a Number). Undefined values include:
An undefined value has the property that it is not
equal ( Aliases: notANumber |
wholePart | Source Codeshared actual Float wholePart The integral value of the number after truncation of
the fractional part. For Refines Number.wholePart |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Invertible<Other> |
Attributes inherited from: Number<Other> |
Methods | |
compare | Source Codeshared actual Comparison compare(Float other) Compares this value with the given value. Implementations must respect the constraints that:
Refines Comparable.compare |
divided | Source Codeshared actual Float divided(Float other) The quotient obtained by dividing this number by the given number. For integral numeric types, this operation results in a remainder. When the given number is Refines Numeric.divided |
equals | Source Codeshared actual Boolean equals(Object that) Determines if the given object is equal to this
Or if:
Refines Object.equals |
largerThan | Source Codeshared actual Boolean largerThan(Float other) Determines if this value is strictly larger than the given value. Refines Comparable.largerThan |
minus | Source Codeshared actual Float minus(Float other) The difference between this number and the given
number. Must produce the value Refines Invertible.minus |
notLargerThan | Source Codeshared actual Boolean notLargerThan(Float other) Determines if this value is smaller than or equal to the given value. Refines Comparable.notLargerThan |
notSmallerThan | Source Codeshared actual Boolean notSmallerThan(Float other) Determines if this value is larger than or equal to the given value. Refines Comparable.notSmallerThan |
plus | Source Codeshared actual Float plus(Float other) The result of adding the given value to this value. This operation should never perform any kind of mutation upon either the receiving value or the argument value. Refines Summable.plus |
plusInteger | Source Codeshared actual Float plusInteger(Integer integer) The result of adding this number to the given
Refines Number.plusInteger |
power | Source Codeshared actual Float power(Float other) The result of raising this number to the given floating
point power, where, following the definition of the
IEEE
Furthermore:
If this is a For any negative power
Refines Exponentiable.power |
powerOfInteger | Source Codeshared actual Float powerOfInteger(Integer integer) The result of raising this number to the given integer
power, where the following indeterminate forms evaluate
to
For any negative integer power
Refines Number.powerOfInteger |
smallerThan | Source Codeshared actual Boolean smallerThan(Float other) Determines if this value is strictly smaller than the given value. Refines Comparable.smallerThan |
times | Source Codeshared actual Float times(Float other) The product of this number and the given number. Refines Numeric.times |
timesInteger | Source Codeshared actual Float timesInteger(Integer integer) The result of multiplying this number by the given
Refines Number.timesInteger |
Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Comparable<Other> |
Methods inherited from: Exponentiable<This,Other> |
Methods inherited from: Invertible<Other> |
Methods inherited from: Number<Other> |
Methods inherited from: Numeric<Other> |
Methods inherited from: Summable<Other> |