FixedPointValue.ofDouble constructor
Constructs FixedPointValue of a Dart double rounding away from zero.
Implementation
factory FixedPointValue.ofDouble(double val,
{required bool signed, required int m, required int n}) {
if (!signed & (val < 0)) {
throw RohdHclException('Negative input not allowed with unsigned');
}
final integerValue = (val * pow(2, n)).toInt();
final w = signed ? 1 + m + n : m + n;
final v = LogicValue.ofInt(integerValue, w);
return FixedPointValue(value: v, signed: signed, m: m, n: n);
}