FloatingPointValue class
A flexible representation of floating point values. A FloatingPointValue
has a mantissa in [0,2)
with 0 <= exponent <= maxExponent();
A value
which FloatingPointValue.isNormal has minExponent() <= exponent <= maxExponent()
and a mantissa in the range of [1,2)
. Subnormal numbers
are represented with a zero exponent and leading zeros in the mantissa
capture the negative exponent value.
- Implemented types
- Implementers
- Annotations
Constructors
- FloatingPointValue({required LogicValue sign, required LogicValue exponent, required LogicValue mantissa})
-
Constructor for a FloatingPointValue with the provided
sign
,exponent
, andmantissa
.factory - FloatingPointValue.ofBinaryStrings(String sign, String exponent, String mantissa)
-
A wrapper around FloatingPointValuePopulator.ofString that computes the
widths of the exponent and mantissa from the input string.
factory
- FloatingPointValue.ofSpacedBinaryString(String fp)
-
A wrapper around FloatingPointValuePopulator.ofSpacedBinaryString that
computes the widths of the exponent and mantissa from the input string.
factory
- FloatingPointValue.uninitialized()
- Creates an unpopulated version of a FloatingPointValue, intended to be called with the populator.
Properties
- bias → int
-
Return the bias of this FloatingPointValue.
no setter
- exponent ↔ LogicValue
-
The exponent of the floating point: this is biased about a midpoint for
positive and negative exponents.
latefinal
- exponentWidth → int
-
The exponent width.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isAnInfinity → bool
-
Return true if the represented floating point number is considered
infinity or negative infinity
no setter
- isAZero → bool
-
Return true if the represented floating point number is zero. Note
that the equality operator will treat
FloatingPointConstants.positiveZero
and FloatingPointConstants.negativeZero as equal.
no setter
- isExponentAllOnes → bool
-
Test if exponent is all '1's.
no setter
- isExponentAllZeros → bool
-
Test if exponent is all '0's.
no setter
- isMantissaAllZeroes → bool
-
Test if mantissa is all '0's.
no setter
- isNaN → bool
-
Return true if the represented floating point number is considered
NaN or "Not a Number".
no setter
- mantissa ↔ LogicValue
-
The mantissa of the floating point.
latefinal
- mantissaWidth → int
-
The mantissa width.
no setter
- maxExponent → int
-
Return the maximum exponent of this FloatingPointValue.
no setter
- minExponent → int
-
Return the minimum exponent of this FloatingPointValue.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sign ↔ LogicValue
-
The sign of the value: 1 means a negative value.
latefinal
- supportsInfinities → bool
-
Indicates whether FloatingPointConstants.positiveInfinity and
FloatingPointConstants.negativeInfinity representations are supported.
no setter
- value → LogicValue
-
The full floating point value concatenated as a LogicValue.
latefinal
Methods
-
abs(
) → FloatingPointValue - Absolute value operation for FloatingPointValue.
-
clonePopulator(
) → FloatingPointValuePopulator< FloatingPointValue> -
Creates a FloatingPointValuePopulator for the same type as
this
and with the same widths. -
compareTo(
Object other) → int -
Floating point comparison to implement Comparable<>
override
-
getConstantComponents(
FloatingPointConstants constantFloatingPoint) → ({LogicValue exponent, LogicValue mantissa, LogicValue sign}) - Return the set of LogicValues for a given FloatingPointConstants at a given exponentWidth and mantissaWidth.
-
isNormal(
) → bool -
Return a Logic true if this FloatingPointVa;ie contains a normal number,
defined as having mantissa in the range
[1,2)
. -
isSubnormal(
) → bool - Return true if the represented floating point number is considered "subnormal", including isAZero.
-
negate(
) → FloatingPointValue - Negate operation for FloatingPointValue.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDouble(
) → double - Return the value of the floating point number in a Dart double type.
-
toString(
{bool integer = false}) → String -
Return a string representation of FloatingPointValue.
override
-
ulp(
) → FloatingPointValue - Compute the unit in the last place for the given FloatingPointValue.
-
validate(
) → void - Validate the FloatingPointValue to ensure widths and other characteristics are legal.
-
withinRounding(
FloatingPointValue other) → bool - Return true if the other FloatingPointValue is within a rounding error of this value.
Operators
-
operator *(
FloatingPointValue multiplicand) → FloatingPointValue - Multiply operation for FloatingPointValue.
-
operator +(
FloatingPointValue addend) → FloatingPointValue - Addition operation for FloatingPointValue.
-
operator -(
FloatingPointValue subend) → FloatingPointValue - Subtract operation for FloatingPointValue.
-
operator /(
FloatingPointValue divisor) → FloatingPointValue - Divide operation for FloatingPointValue.
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
populator(
{required int exponentWidth, required int mantissaWidth}) → FloatingPointValuePopulator< FloatingPointValue> -
Creates a FloatingPointValuePopulator with the provided
exponentWidth
andmantissaWidth
, which can then be used to complete construction of a FloatingPointValue using population functions.