FloatingPoint8E5M2Value.ofDouble constructor
- double inDouble
Numeric conversion of a FloatingPoint8E5M2Value from a host double
Implementation
factory FloatingPoint8E5M2Value.ofDouble(double inDouble) {
if ((inDouble.abs() > maxValue) |
((inDouble != 0) & (inDouble.abs() < minValue))) {
throw RohdHclException('Number exceeds E5M2 range');
}
final fpv = FloatingPointValue.ofDouble(inDouble,
exponentWidth: exponentWidth, mantissaWidth: mantissaWidth);
return FloatingPoint8E5M2Value(
sign: fpv.sign, exponent: fpv.exponent, mantissa: fpv.mantissa);
}