toString method

  1. @override
String toString({
  1. bool integer = false,
})
override

Return a string representation of FloatingPointValue.

If integer is true, returns sign, exponent, mantissa as integers. If integer is false, returns sign, exponent, mantissa as binary strings.

Implementation

@override
String toString({bool integer = false}) {
  if (integer) {
    // Use toBigInt() rather than toInt(): exponent/mantissa can exceed 64
    // bits, and LogicValue.toInt() throws in that case.
    return '(${sign.toBigInt()}'
        ' ${exponent.toBigInt()}'
        ' ${mantissa.toBigInt()})';
  } else {
    return '${sign.toString(includeWidth: false)}'
        ' ${exponent.toString(includeWidth: false)}'
        ' ${mantissa.toString(includeWidth: false)}';
  }
}