toDouble method
Return the value of the floating point number in a Dart double type.
Implementation
double toDouble() {
var doubleVal = double.nan;
if (value.isValid) {
if (exponent.toInt() == 0) {
doubleVal = (sign.toBool() ? -1.0 : 1.0) *
pow(2.0, computeMinExponent(exponent.width)) *
mantissa.toBigInt().toDouble() /
pow(2.0, mantissa.width);
} else if (!isNaN()) {
doubleVal = (sign.toBool() ? -1.0 : 1.0) *
(1.0 + mantissa.toBigInt().toDouble() / pow(2.0, mantissa.width)) *
pow(
2.0,
exponent.toInt().toSigned(exponent.width) -
computeBias(exponent.width));
doubleVal = (sign.toBool() ? -1.0 : 1.0) *
(1.0 + mantissa.toBigInt().toDouble() / pow(2.0, mantissa.width)) *
pow(2.0, exponent.toInt() - computeBias(exponent.width));
}
}
return doubleVal;
}