BinaryFixedPoint class final

A binary fixed-point value.

The raw integer stores the mathematical value scaled by 2 ^ fractionalBits.

Implemented types

Constructors

BinaryFixedPoint({required BigInt raw, required int fractionalBits, FixedPointSignedness signedness = FixedPointSignedness.unsigned, int totalBits = 64})
Creates a binary fixed-point value from a raw scaled integer.
const
BinaryFixedPoint.parse(String value, {required int fractionalBits, FixedPointRoundingMode rounding = FixedPointRoundingMode.strict, FixedPointSignedness signedness = FixedPointSignedness.unsigned, int totalBits = 64})
Parses value as a binary fixed-point number.
factory

Properties

fractionalBits int
The number of binary fractional bits represented by raw.
final
hashCode int
The hash code for this object.
no setteroverride
kind String
The upstream-compatible kind tag for this value.
no setter
raw BigInt
The raw integer value scaled by 2 ^ fractionalBits.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signedness FixedPointSignedness
Whether raw may be negative.
final
totalBits int
The bit width used to validate raw.
final

Methods

compareTo(BinaryFixedPoint other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDecimalString() String
Formats this value as a decimal string when the representation is finite.
toString() String
A string representation of this object.
override

Operators

operator +(BinaryFixedPoint other) BinaryFixedPoint
Adds other, requiring both values to use the same shape.
operator -(BinaryFixedPoint other) BinaryFixedPoint
Subtracts other, requiring both values to use the same shape.
operator ==(Object other) bool
The equality operator.
override